Deal with differences from Ubuntu's sshd

This commit is contained in:
Garrett Holmstrom 2011-09-28 18:17:53 -07:00
parent f354744043
commit 974de09f58
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,44 @@
Index: cloud-init-fedora/cloudinit/CloudConfig/cc_set_passwords.py
===================================================================
--- cloud-init-fedora.orig/cloudinit/CloudConfig/cc_set_passwords.py
+++ cloud-init-fedora/cloudinit/CloudConfig/cc_set_passwords.py
@@ -104,7 +104,7 @@ def handle(name,cfg,cloud,log,args):
errors.append(e)
try:
- p = util.subp(['service', 'ssh', 'restart'])
+ p = util.subp(['service', cfg.get('ssh_svcname', 'ssh'), 'restart'])
log.debug("restarted sshd")
except:
log.warn("restart of ssh failed")
Index: cloud-init-fedora/cloudinit/CloudConfig/cc_ssh.py
===================================================================
--- cloud-init-fedora.orig/cloudinit/CloudConfig/cc_ssh.py
+++ cloud-init-fedora/cloudinit/CloudConfig/cc_ssh.py
@@ -31,9 +31,10 @@ def handle(name,cfg,cloud,log,args):
global_log = log
# remove the static keys from the pristine image
- for f in glob.glob("/etc/ssh/ssh_host_*key*"):
- try: os.unlink(f)
- except: pass
+ if cfg.get("delete_system_ssh_keys", True):
+ for f in glob.glob("/etc/ssh/ssh_host_*key*"):
+ try: os.unlink(f)
+ except: pass
if cfg.has_key("ssh_keys"):
# if there are keys in cloud-config, use them
@@ -63,8 +64,10 @@ def handle(name,cfg,cloud,log,args):
# if not, generate them
for keytype in util.get_cfg_option_list_or_str(cfg, 'ssh_genkeytypes',
['rsa', 'dsa', 'ecdsa']):
- subprocess.call(['ssh-keygen', '-t', keytype, '-N', '',
- '-f', '/etc/ssh/ssh_host_%s_key' % keytype])
+ keyfile = '/etc/ssh/ssh_host_%s_key' % keytype
+ if not os.path.exists(keyfile):
+ subprocess.call(['ssh-keygen', '-t', keytype, '-N', '',
+ '-f', keyfile])
try:
user = util.get_cfg_option_str(cfg,'user')

View File

@ -5,6 +5,7 @@ ssh_pwauth: 0
cc_ready_cmd: ['/bin/true']
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
ssh_genkeytypes: ~
ssh_svcname: sshd
syslog_fix_perms: ~
locale_configfile: /etc/sysconfig/i18n

View File

@ -31,6 +31,8 @@ Patch7: cloud-init-0.6.2-puppetenable.patch
Patch8: cloud-init-0.6.2-sshkeytypes.patch
# https://bugs.launchpad.net/cloud-init/+bug/857926
Patch10: cloud-init-0.6.2-runparts-emptydir.patch
# Deal with differences between out sshd service and Ubuntu's (not yet upstream)
Patch11: cloud-init-0.6.2-sshsvc.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -71,6 +73,7 @@ ssh keys and to let the user run various scripts.
%patch7 -p1
%patch8 -p1
%patch10 -p1
%patch11 -p1
cp -p %{SOURCE2} README.fedora
@ -156,6 +159,7 @@ fi
- Consolidated selinux file context patches
- Fixed cloud-init.service dependencies
- Updated sshkeytypes patch
- Dealt with differences from Ubuntu's sshd
* Sat Sep 24 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.5.bzr457
- Rebased against upstream rev 457