+ # pre-sshd
+ pre_sshd_script= os.path.join(ssh_source_files, "pre-sshd")
+ if os.path.exists(pre_sshd_script):
+ utils.sysexec_noerr( pre_sshd_script, log )
+
+ # create host keys if needed
+ if not os.path.isdir (ssh_dir):
+ utils.makedirs (ssh_dir)
+ key=ssh_dir+"/ssh_host_key"
+ if not os.path.isfile (key):
+ log.write("Creating host rsa1 key %s\n"%key)
+ utils.sysexec( "ssh-keygen -t rsa1 -b 1024 -f %s -N ''" % key, log )
+ key=ssh_dir+"/ssh_host_rsa_key"
+ if not os.path.isfile (key):
+ log.write("Creating host rsa key %s\n"%key)
+ utils.sysexec( "ssh-keygen -t rsa -f %s -N ''" % key, log )
+ key=ssh_dir+"/ssh_host_dsa_key"
+ if not os.path.isfile (key):
+ log.write("Creating host dsa key %s\n"%key)
+ # very old versions did 'ssh-keygen -d' instead of 'ssh-keygen -t dsa'
+ utils.sysexec( "ssh-keygen -t dsa -f %s -N ''" % key, log )
+
+ # (over)write sshd config
+ utils.sysexec( "cp -f %s/sshd_config %s/sshd_config" % (ssh_source_files,ssh_dir), log )
+
+ ### xxx ### xxx ### xxx ### xxx ### xxx