~smoser/ubuntu/vivid/cloud-init/snappy

« back to all changes in this revision

Viewing changes to cloudinit/config/cc_ssh.py

  • Committer: Scott Moser
  • Date: 2015-02-27 20:55:58 UTC
  • mfrom: (355.2.8 vivid)
  • Revision ID: smoser@ubuntu.com-20150227205558-glrwdgxqkaz6zyxa
* Merge with vivid at 0.7.7~bzr1067-0ubuntu1
* New upstream snapshot.
  * fix broken consumption of gzipped user-data (LP: #1424900)
  * functional user-data on Azure again (LP: #1423972)
  * CloudStack: support fetching password from virtual router (LP: #1422388)
* New upstream snapshot.
  * Fix for ascii decode in DataSourceAzure (LP: #1422993).
* New upstream snapshot.
  * support for gpt partitioning, utilized in Azure [Daniel Watkins]
  * fix bug in exception handling in mount_cb.
* New upstream snapshot.
  * move to python3 (LP: #1247132)
  * systemd: run cloud-init before systemd-user-sessions.service
  * Use the GCE short hostname. (LP: #1383794)
  * Enable user-data encoding support for GCE. (LP: #1404311)
  * Update to use a newer and better OMNIBUS_URL
  * Be more tolerant of 'ssh_authorized_keys' types
  * Fix parse_ssh_config failing in ssh_util.py
  * Increase the robustness/configurability of the chef module.
  * retain trailing newline from template files when using
    jinja2 (LP: #1355343)
  * fix broken output handling (LP: #1387340)
  * digital ocean datasource
  * update url in config drive documentation
  * freebsd: enable correct behavior on Ec2.
  * freebsd: Use the proper virtio FreeBSD network interface name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
"rather than the user \\\"root\\\".\';echo;sleep 10\"")
35
35
 
36
36
KEY_2_FILE = {
37
 
    "rsa_private": ("/etc/ssh/ssh_host_rsa_key", 0600),
38
 
    "rsa_public": ("/etc/ssh/ssh_host_rsa_key.pub", 0644),
39
 
    "dsa_private": ("/etc/ssh/ssh_host_dsa_key", 0600),
40
 
    "dsa_public": ("/etc/ssh/ssh_host_dsa_key.pub", 0644),
41
 
    "ecdsa_private": ("/etc/ssh/ssh_host_ecdsa_key", 0600),
42
 
    "ecdsa_public": ("/etc/ssh/ssh_host_ecdsa_key.pub", 0644),
 
37
    "rsa_private": ("/etc/ssh/ssh_host_rsa_key", 0o600),
 
38
    "rsa_public": ("/etc/ssh/ssh_host_rsa_key.pub", 0o644),
 
39
    "dsa_private": ("/etc/ssh/ssh_host_dsa_key", 0o600),
 
40
    "dsa_public": ("/etc/ssh/ssh_host_dsa_key.pub", 0o644),
 
41
    "ecdsa_private": ("/etc/ssh/ssh_host_ecdsa_key", 0o600),
 
42
    "ecdsa_public": ("/etc/ssh/ssh_host_ecdsa_key.pub", 0o644),
43
43
}
44
44
 
45
45
PRIV_2_PUB = {
68
68
 
69
69
    if "ssh_keys" in cfg:
70
70
        # if there are keys in cloud-config, use them
71
 
        for (key, val) in cfg["ssh_keys"].iteritems():
 
71
        for (key, val) in cfg["ssh_keys"].items():
72
72
            if key in KEY_2_FILE:
73
73
                tgt_fn = KEY_2_FILE[key][0]
74
74
                tgt_perms = KEY_2_FILE[key][1]
75
75
                util.write_file(tgt_fn, val, tgt_perms)
76
76
 
77
 
        for (priv, pub) in PRIV_2_PUB.iteritems():
 
77
        for (priv, pub) in PRIV_2_PUB.items():
78
78
            if pub in cfg['ssh_keys'] or priv not in cfg['ssh_keys']:
79
79
                continue
80
80
            pair = (KEY_2_FILE[priv][0], KEY_2_FILE[pub][0])