/usr/lib/python2.6/site-packages/cloudinit/config
NameSizeModeActions
cc_apt_configure.py96000644editdlrm
cc_apt_configure.pyc90130644editdlrm
cc_apt_configure.pyo90130644editdlrm
cc_apt_pipelining.py21110644editdlrm
cc_apt_pipelining.pyc16430644editdlrm
cc_apt_pipelining.pyo16430644editdlrm
cc_bootcmd.py17820644editdlrm
cc_bootcmd.pyc12950644editdlrm
cc_bootcmd.pyo12950644editdlrm
cc_byobu.py28860644editdlrm
cc_byobu.pyc21850644editdlrm
cc_byobu.pyo21850644editdlrm
cc_ca_certs.py38720644editdlrm
cc_ca_certs.pyc33960644editdlrm
cc_ca_certs.pyo33960644editdlrm
cc_chef.py57180644editdlrm
cc_chef.pyc40270644editdlrm
cc_chef.pyo40270644editdlrm
cc_debug.py28690644editdlrm
cc_debug.pyc24440644editdlrm
cc_debug.pyo24440644editdlrm
cc_disable_ec2_metadata.py13120644editdlrm
cc_disable_ec2_metadata.pyc8730644editdlrm
cc_disable_ec2_metadata.pyo8730644editdlrm
cc_disk_setup.py252740644editdlrm
cc_disk_setup.pyc225600644editdlrm
cc_disk_setup.pyo225600644editdlrm
cc_emit_upstart.py17070644editdlrm
cc_emit_upstart.pyc11430644editdlrm
cc_emit_upstart.pyo11430644editdlrm
cc_final_message.py23480644editdlrm
cc_final_message.pyc18600644editdlrm
cc_final_message.pyo18600644editdlrm
cc_foo.py24530644editdlrm
cc_foo.pyc4880644editdlrm
cc_foo.pyo4880644editdlrm
cc_growpart.py96020644editdlrm
cc_growpart.pyc89280644editdlrm
cc_growpart.pyo89280644editdlrm
cc_grub_dpkg.py23440644editdlrm
cc_grub_dpkg.pyc15430644editdlrm
cc_grub_dpkg.pyo15430644editdlrm
cc_keys_to_console.py19430644editdlrm
cc_keys_to_console.pyc13000644editdlrm
cc_keys_to_console.pyo13000644editdlrm
cc_landscape.py29910644editdlrm
cc_landscape.pyc24760644editdlrm
cc_landscape.pyo24760644editdlrm
cc_locale.py13580644editdlrm
cc_locale.pyc8010644editdlrm
cc_locale.pyo8010644editdlrm
cc_mcollective.py37600644editdlrm
cc_mcollective.pyc18400644editdlrm
cc_mcollective.pyo18400644editdlrm
cc_migrator.py31190644editdlrm
cc_migrator.pyc27490644editdlrm
cc_migrator.pyo27490644editdlrm
cc_mounts.py84830644editdlrm
cc_mounts.pyc61530644editdlrm
cc_mounts.pyo61530644editdlrm
cc_package_update_upgrade_install.py35230644editdlrm
cc_package_update_upgrade_install.pyc29370644editdlrm
cc_package_update_upgrade_install.pyo29370644editdlrm
cc_phone_home.py36660644editdlrm
cc_phone_home.pyc24790644editdlrm
cc_phone_home.pyo24790644editdlrm
cc_power_state_change.py51210644editdlrm
cc_power_state_change.pyc49340644editdlrm
cc_power_state_change.pyo49340644editdlrm
cc_puppet.py51660644editdlrm
cc_puppet.pyc30550644editdlrm
cc_puppet.pyo30550644editdlrm
cc_resizefs.py56970644editdlrm
cc_resizefs.pyc47680644editdlrm
cc_resizefs.pyo47680644editdlrm
cc_resolv_conf.py36810644editdlrm
cc_resolv_conf.pyc22130644editdlrm
cc_resolv_conf.pyo22130644editdlrm
cc_rightscale_userdata.py35750644editdlrm
cc_rightscale_userdata.pyc20740644editdlrm
cc_rightscale_userdata.pyo20740644editdlrm
cc_rsyslog.py34120644editdlrm
cc_rsyslog.pyc18480644editdlrm
cc_rsyslog.pyo18480644editdlrm
cc_runcmd.py13480644editdlrm
cc_runcmd.pyc8420644editdlrm
cc_runcmd.pyo8420644editdlrm
cc_salt_minion.py23150644editdlrm
cc_salt_minion.pyc14130644editdlrm
cc_salt_minion.pyo14130644editdlrm
cc_scripts_per_boot.py13690644editdlrm
cc_scripts_per_boot.pyc8060644editdlrm
cc_scripts_per_boot.pyo8060644editdlrm
cc_scripts_per_instance.py13770644editdlrm
cc_scripts_per_instance.pyc8200644editdlrm
cc_scripts_per_instance.pyo8200644editdlrm
cc_scripts_per_once.py13650644editdlrm
cc_scripts_per_once.pyc8040644editdlrm
cc_scripts_per_once.pyo8040644editdlrm
cc_scripts_user.py13880644editdlrm
cc_scripts_user.pyc7880644editdlrm
cc_scripts_user.pyo7880644editdlrm
cc_scripts_vendor.py13980644editdlrm
cc_scripts_vendor.pyc9240644editdlrm
cc_scripts_vendor.pyo9240644editdlrm
cc_seed_random.py31610644editdlrm
cc_seed_random.pyc27670644editdlrm
cc_seed_random.pyo27670644editdlrm
cc_set_hostname.py14600644editdlrm
cc_set_hostname.pyc9320644editdlrm
cc_set_hostname.pyo9320644editdlrm
cc_set_passwords.py55550644editdlrm
cc_set_passwords.pyc40100644editdlrm
cc_set_passwords.pyo40100644editdlrm
cc_ssh.py52250644editdlrm
cc_ssh.pyc41040644editdlrm
cc_ssh.pyo41040644editdlrm
cc_ssh_authkey_fingerprints.py36480644editdlrm
cc_ssh_authkey_fingerprints.pyc35070644editdlrm
cc_ssh_authkey_fingerprints.pyo35070644editdlrm
cc_ssh_import_id.py30390644editdlrm
cc_ssh_import_id.pyc21910644editdlrm
cc_ssh_import_id.pyo21910644editdlrm
cc_timezone.py13160644editdlrm
cc_timezone.pyc7690644editdlrm
cc_timezone.pyo7690644editdlrm
cc_update_etc_hosts.py23910644editdlrm
cc_update_etc_hosts.pyc15090644editdlrm
cc_update_etc_hosts.pyo15090644editdlrm
cc_update_hostname.py16270644editdlrm
cc_update_hostname.pyc11660644editdlrm
cc_update_hostname.pyo11660644editdlrm
cc_users_groups.py12650644editdlrm
cc_users_groups.pyc7920644editdlrm
cc_users_groups.pyo7920644editdlrm
cc_write_files.py35540644editdlrm
cc_write_files.pyc32310644editdlrm
cc_write_files.pyo32310644editdlrm
cc_yum_add_repo.py39440644editdlrm
cc_yum_add_repo.pyc30260644editdlrm
cc_yum_add_repo.pyo30260644editdlrm
__init__.py19700644editdlrm
__init__.pyc13490644editdlrm
__init__.pyo13490644editdlrm
Edit: /usr/lib/python2.6/site-packages/cloudinit/config/cc_ca_certs.py (3872B)
# vi: ts=4 expandtab # # Author: Mike Milner # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import os from cloudinit import util CA_CERT_PATH = "/usr/share/ca-certificates/" CA_CERT_FILENAME = "cloud-init-ca-certs.crt" CA_CERT_CONFIG = "/etc/ca-certificates.conf" CA_CERT_SYSTEM_PATH = "/etc/ssl/certs/" CA_CERT_FULL_PATH = os.path.join(CA_CERT_PATH, CA_CERT_FILENAME) distros = ['ubuntu', 'debian'] def update_ca_certs(): """ Updates the CA certificate cache on the current machine. """ util.subp(["update-ca-certificates"], capture=False) def add_ca_certs(certs): """ Adds certificates to the system. To actually apply the new certificates you must also call L{update_ca_certs}. @param certs: A list of certificate strings. """ if certs: # First ensure they are strings... cert_file_contents = "\n".join([str(c) for c in certs]) util.write_file(CA_CERT_FULL_PATH, cert_file_contents, mode=0644) # Append cert filename to CA_CERT_CONFIG file. # We have to strip the content because blank lines in the file # causes subsequent entries to be ignored. (LP: #1077020) orig = util.load_file(CA_CERT_CONFIG) cur_cont = '\n'.join([l for l in orig.splitlines() if l != CA_CERT_FILENAME]) out = "%s\n%s\n" % (cur_cont.rstrip(), CA_CERT_FILENAME) util.write_file(CA_CERT_CONFIG, out, omode="wb") def remove_default_ca_certs(): """ Removes all default trusted CA certificates from the system. To actually apply the change you must also call L{update_ca_certs}. """ util.delete_dir_contents(CA_CERT_PATH) util.delete_dir_contents(CA_CERT_SYSTEM_PATH) util.write_file(CA_CERT_CONFIG, "", mode=0644) debconf_sel = "ca-certificates ca-certificates/trust_new_crts select no" util.subp(('debconf-set-selections', '-'), debconf_sel) def handle(name, cfg, _cloud, log, _args): """ Call to handle ca-cert sections in cloud-config file. @param name: The module name "ca-cert" from cloud.cfg @param cfg: A nested dict containing the entire cloud config contents. @param cloud: The L{CloudInit} object in use. @param log: Pre-initialized Python logger object to use for logging. @param args: Any module arguments from cloud.cfg """ # If there isn't a ca-certs section in the configuration don't do anything if "ca-certs" not in cfg: log.debug(("Skipping module named %s," " no 'ca-certs' key in configuration"), name) return ca_cert_cfg = cfg['ca-certs'] # If there is a remove-defaults option set to true, remove the system # default trusted CA certs first. if ca_cert_cfg.get("remove-defaults", False): log.debug("Removing default certificates") remove_default_ca_certs() # If we are given any new trusted CA certs to add, add them. if "trusted" in ca_cert_cfg: trusted_certs = util.get_cfg_option_list(ca_cert_cfg, "trusted") if trusted_certs: log.debug("Adding %d certificates" % len(trusted_certs)) add_ca_certs(trusted_certs) # Update the system with the new cert configuration. log.debug("Updating certificates") update_ca_certs()