FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 11-04-2009, 06:50 PM
Peter Jones
 
Default Add handling for sshpw command.

This lets you set passwords to ssh into the anaconda environment.
---
anaconda | 30 ++++++++++++++++++++++++++----
kickstart.py | 3 ++-
2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/anaconda b/anaconda
index ef891de..21b4d4b 100755
--- a/anaconda
+++ b/anaconda
@@ -396,6 +396,22 @@ def setupGraphicalLinks():
except:
pass

+def handleSshPw(ks):
+ import users
+ u = users.Users()
+
+ userdata = ks.sshpw.dataList()
+ for ud in userdata:
+ if u.checkUserExists(ud.username, root="/"):
+ u.setUserPassword(username=ud.username, password=ud.password,
+ isCrypted=ud.isCrypted, lock=ud.lock)
+ else:
+ u.createUser(name=ud.username, password=ud.password,
+ isCrypted=ud.isCrypted, lock=ud.lock,
+ root="/")
+
+ del u
+
def createSshKey(algorithm, keyfile):
path = '/etc/ssh/%s' % (keyfile,)
argv = ['-q','-t',algorithm,'-f',path,'-C',','-N',']
@@ -602,8 +618,6 @@ if __name__ == "__main__":

warnings.showwarning = AnacondaShowWarning

- startSsh()
-
setupTranslations()

# reset python's default SIGINT handler
@@ -727,8 +741,6 @@ if __name__ == "__main__":
if not flags.test and not flags.rootpath and not flags.livecdInstall:
isys.auditDaemon()

- users.createLuserConf(anaconda.rootPath)
-
# setup links required for all install types
for i in ( "services", "protocols", "nsswitch.conf", "joe", "selinux",
"mke2fs.conf" ):
@@ -753,6 +765,16 @@ if __name__ == "__main__":
if earlyKS and not opts.rescue:
opts.rescue = earlyKS.rescue.rescue

+ # we need to have a libuser.conf that points to the installer root for
+ # sshpw, but after that we start sshd, we need one that points to the
+ # install target.
+ luserConf = users.createLuserConf(instPath="")
+ handleSshPw(earlyKS)
+ startSsh()
+ del(os.environ["LIBUSER_CONF"])
+
+ users.createLuserConf(anaconda.rootPath)
+
if opts.rescue:
anaconda.rescue = True

diff --git a/kickstart.py b/kickstart.py
index a961a99..147431b 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -1086,6 +1086,7 @@ commandMap = {
"services": commands.services.FC6_Services,
"shutdown": Reboot,
"skipx": SkipX,
+ "sshpw": commands.sshpw.F13_SshPw,
"text": commands.displaymode.FC3_DisplayMode,
"timezone": Timezone,
"updates": commands.updates.F7_Updates,
@@ -1128,7 +1129,7 @@ class EarlyKSHandler(superclass):

self.maskAllExcept(["vnc", "displaymode", "text", "cmdline",
"graphical", "rescue", "ignoredisk", "clearpart",
- "zerombr"])
+ "zerombr", "sshpw"])

class AnacondaPreParser(KickstartParser):
# A subclass of KickstartParser that only looks for %pre scripts and
--
1.6.5.rc2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 08:05 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org