summaryrefslogtreecommitdiff
path: root/cloudinit/config
Commit message (Collapse)AuthorAgeFilesLines
* cloud-init: fix capitalisation of SSH (#126)Daniel Watkins2019-12-187-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | * cc_ssh: fix capitalisation of SSH * doc: fix capitalisation of SSH * cc_keys_to_console: fix capitalisation of SSH * ssh_util: fix capitalisation of SSH * DataSourceIBMCloud: fix capitalisation of SSH * DataSourceAzure: fix capitalisation of SSH * cs_utils: fix capitalisation of SSH * distros/__init__: fix capitalisation of SSH * cc_set_passwords: fix capitalisation of SSH * cc_ssh_import_id: fix capitalisation of SSH * cc_users_groups: fix capitalisation of SSH * cc_ssh_authkey_fingerprints: fix capitalisation of SSH
* doc: update cc_ssh clarify host and auth keysJoshua Powers2019-12-181-40/+49
| | | | | | * Add headers for Authorized and Host key sections, move the authorized section up as it is probably more relevant. LP: #1827021
* fix unlocking method on FreeBSDIgor Galić2019-12-121-0/+28
| | | | | | | | | on FreeBSD, `lock_passwd` is implemented as `pw usermod <user> -h -` This does not lock the account. It prompts for a password change on the console during cloud-init run. To lock an account, we have to execute: `pw lock <name>` LP: #1854594
* docs: add additional details to per-instance/onceJoshua Powers2019-12-112-2/+6
|
* set_passwords: support for FreeBSD (#46)Igor Galić2019-11-262-6/+57
| | | | | | | | | | | | | | Allow setting of user passwords on FreeBSD The www/chpasswd utility which we depended on for FreeBSD installations does *not* do the same thing as the equally named Linux utility. For FreeBSD, we now use the pw(8) utility (which can only process one user at a time) Additionally, we abstract expire passwd into a function, and override it in the FreeBSD distro class. Co-Authored-By: Chad Smith <chad.smith@canonical.com>
* Correct jumbled documentation for cc_set_hostname module (#64)do3meli2019-11-251-1/+3
| | | LP: #1853543
* switch default FreeBSD salt minion pkg from py27 to py36Dominic Schlegel2019-11-131-1/+1
|
* Add config for ssh-key import and consuming user-dataPavel Zakharov2019-10-312-11/+50
| | | | | | | | | | | | | | | | This patch enables control over SSH public-key import and discarding supplied user-data (both disabled by default). allow-userdata: false ssh: allow_public_ssh_keys: false This feature enables closed appliances to prevent customers from unintentionally breaking the appliance which were not designed for user interaction. The downstream change for this is here: https://github.com/delphix/cloud-init/pull/4
* cc_puppet: Implement csr_attributes.yaml supportMatthias Baur2019-10-311-5/+29
| | | | | | | | | | | This change adds two new parameters: * csr_attributes * csr_attributes_path Those parameters allow to configure the content of the csr_attributes.yaml file. See https://puppet.com/docs/puppet/latest/config_file_csr_attributes.html
* Fix usages of yaml, and move yaml_dump to safeyaml.dumps.Scott Moser2019-10-243-5/+7
| | | | | | | | | | Here we replace uses of the pyyaml module directly with functions provided by cloudinit.safeyaml. Also, change/move cloudinit.util.yaml_dumps to cloudinit.safeyaml.dumps LP: #1849640
* replace any deprecated log.warn with log.warningDominic Schlegel2019-10-1726-91/+89
| | | | | | | | | Commit 6797e822959b84c98cf73e02b2a6e3d6ab3fd4fe replaced the LOG.warn calls that linters were warning about; this also replaces calls that linters would not have recognised (as `log` is generally a parameter in these scenarios). LP: #1508442
* ubuntu-drivers: call db_x_loadtemplatefile to accept NVIDIA EULAChad Smith2019-08-222-35/+128
| | | | | | | | | | | | | | Emit a script allowing cloud-init to set linux/nvidia/latelink debconf selection to true. This avoids having to call debconf-set-selections and allows cloud-init to pre-confgure linux-restricted-modules to link NVIDIA drivers to the running kernel. Cloud-init loads this debconf template and sets the value to true in the debconf database by sourcing debconf's /usr/share/debconf/confmodule and uses db_x_loadtemplatefile to register cloud-init's setting for linux/nvidia/latelink. LP: #1840080
* ubuntu-drivers: emit latelink=true debconf to accept nvidia eulaChad Smith2019-08-193-6/+26
| | | | | | | | To accept NVIDIA EULA, cloud-init needs to emit latelink=true debconf setting to the linux-restricted-modules package to allow NVIDIA drivers to properly link to the running kernel. LP: #1840080
* pyflakes: remove unused variableJoshua Powers2019-08-151-1/+1
|
* Add support for publishing host keys to GCE guest attributesRick Wright2019-08-092-0/+221
| | | | | | | | | | | | | | | | | | | | | This adds an empty publish_host_keys() method to the default datasource that is called by cc_ssh.py. This feature can be controlled by the 'ssh_publish_hostkeys' config option. It is enabled by default but can be disabled by setting 'enabled' to false. Also, a blacklist of key types is supported. In addition, this change implements ssh_publish_hostkeys() for the GCE datasource, attempting to write the hostkeys to the instance's guest attributes. Using these hostkeys for ssh connections is currently supported by the alpha version of Google's 'gcloud' command-line tool. (On Google Compute Engine, this feature will be enabled by setting the 'enable-guest-attributes' metadata key to 'true' for the project/instance that you would like to use this feature for. When connecting to the instance for the first time using 'gcloud compute ssh' the hostkeys will be read from the guest attributes for the instance and written to the user's local known_hosts file for Google Compute Engine instances.)
* cc_set_passwords: rewrite documentationDaniel Watkins2019-08-071-19/+34
| | | | | | What we had previously was inaccurate in a few respects. LP: #1838794
* Fix a couple of issues raised by a coverity scanDaniel Watkins2019-07-101-1/+1
| | | | | | | | * cc_lxd: fix copy/paste error in debug logging * DataSourceCloudSigma: remove unreachable code * This unreachable code was introduced in a refactor (in 2015) which removed the need for an exception handler, but retained the logging from the exception handler as an unreachable fall-through.
* Fix spelling error making 'an Ubuntu' consistent.Brian Murray2019-05-311-1/+1
|
* freebsd: ability to grow root file systemGonéri Le Bouder2019-05-282-4/+5
| | | | | | | - UFS file system support - GPT partition table support - add support for newfs's -L parameter (label) - move freebsd specific test from Azure to freebsd
* cc_mounts: check if mount -a on no-change fstab pathJason Zions (MSFT)2019-05-081-0/+11
| | | | | | | | | | | | | | Under some circumstances, cc_disk_setup may reformat volumes which already appear in /etc/fstab (e.g. Azure ephemeral drive is reformatted from NTFS to ext4 after service-heal). Normally, cc_mounts only calls mount -a if it altered /etc/fstab. With this change cc_mounts will read /proc/mounts and verify if configured mounts are already mounted and if not raise flag to request a mount -a. This handles the case where no changes to fstab occur but a mount -a is required due to change in underlying device which prevented the .mount unit from running until after disk was reformatted. LP: #1825596
* cc_apt_configure: fix typo in apt documentationDominic Schlegel2019-04-171-1/+1
|
* ubuntu_advantage: rewrite cloud-config moduleChad Smith2019-04-042-265/+307
| | | | | | | | | | | | | | | | | | | | | | ubuntu-advantage-tools version 19 has a different command line interface. Update cloud-init's config module to accept new ubuntu_advantage configuration settings. * Underscores better than hyphens: deprecate 'ubuntu-advantage'   cloud-config key in favor of 'ubuntu_advantage' * Attach machines with either sso credentials of UA user_token * Services are enabled by name though an 'enable' list * Raise warnings if deprecated ubuntu-advantage config keys are   present, or errors if its config we cannott adapt to Ubuntu Advantage support can now be configured via #cloud-config with the following yaml: ubuntu_advantage:   token: 'thisismyubuntuadvantagetoken'   enable: [esm, fips, livepatch] Co-Authored-By: Daniel Watkins <daniel.watkins@canonical.com>
* Add ubuntu_drivers config moduleDaniel Watkins2019-03-192-0/+286
| | | | | | | | | | | | | The ubuntu_drivers config module enables usage of the 'ubuntu-drivers' command. At this point it only serves as a way of installing NVIDIA drivers for general purpose graphics processing unit (GPGPU) functionality. Also, a small usability improvement to get_cfg_by_path to allow it to take a string for the key path "toplevel/second/mykey" in addition to the original: ("toplevel", "second", "mykey")
* cc_apt_pipelining: stop disabling pipelining by defaultDaniel Watkins2019-02-272-2/+30
| | | | | | | | | | | | This was introduced due to Ubuntu using S3 mirrors, and S3 having a buggy pipelining implementation. Those Ubuntu mirrors are no longer in production and, furthremore, apt has also grown the ability to handle servers with broken pipelining. As such, we can stop disabling pipelining, which should result in improved apt download speeds. LP: #1794982
* cc_rsyslog: Escape possible nested setDaniel Watkins2019-02-261-1/+1
| | | | | | | Under Python 3.7, we are seeing `FutureWarning: Possible nested set at position 23`; escaping this bracket causes that warning to disappear. LP: #1816967
* Enable encrypted_data_bag_secret support for ChefEric Williams2019-02-251-0/+3
| | | | | | | | | | | Encrypted data bags require a secrets file to be present to decrypt, and the location of the file must be configured the Chef client configuration file, client.rb. This update enables cloud-init's chef module to update that setting in client.rb. LP: #1817082
* Resolve flake8 comparison and pycodestyle over-ident issuesParide Legovini2019-01-301-1/+1
| | | | | | Fixes: - flake8: use ==/!= to compare str, bytes, and int literals - pycodestyle: E117 over-indented
* flake8: use ==/!= to compare str, bytes, and int literalsParide Legovini2019-01-281-3/+3
|
* lxd: install zfs-linux instead of zfs meta packageJohnson Shi2019-01-251-1/+1
| | | | | | | | | | | | | | When using the LXD module cloud-init will attempt to install ZFS if it does not exist on the target system. However instead of installing the `zfsutils-linux` package it attempts to install `zfs` resulting in an error. Ubuntu Xenial (16.04) has zfs meta package, but Bionic (18.04) does not. Use the specific base package instead of zfs meta. Co-authored-by: Michael Skalka <michael.skalka@canonical.com> LP: #1799779
* cc_set_passwords: Fix regex when parsing hashed passwordsMarlin Cremers2019-01-152-1/+41
| | | | | | | Correct invalid regex to match hashes starting with the following: - $1, $2a, $2y, $5 or $6 LP: #1811446
* write_files: add support for appending to files.James Baxter2018-12-061-1/+6
| | | | | Add 'append: true' to write_files entries to append 'content' to file specified by 'path' key. This modifies the file open mode to append.
* resizefs: Prefix discovered devpath with '/dev/' when path does not existIgor Galić2018-11-141-0/+7
| | | | | | | In some environments, like FreeBSD, gpart can return the device basename instead of the full path. If this discovered devpath does not exist and is missing the '/dev/' prefix, add that prefix in an attempt to find the device.
* Correct spelling in an error message (udevadm).Katie McLaughlin2018-10-111-1/+1
| | | | Fix a typo in a RuntimeError path. (udevamd -> udevadm).
* lxd: adjust to snap installed lxd.Scott Moser2018-09-261-1/+4
| | | | | | | | Relax expectation on path to lxc and lxd. The deb path still does install them in /usr/bin/ but that is overly pedantic. Add a 'lxd waitready' (present since lxd 0.5) to wait until lxd is ready before operating on it.
* config: disable ssh access to a configured user accountChad Smith2018-09-084-16/+198
| | | | | | | | | | | | | Cloud config can now disable ssh access to non-root users. When defining the 'users' list in cloud-configuration a boolean 'ssh_redirect_user: true' can be provided to disable ssh logins for that user. Any ssh 'public-keys' defined in cloud meta-data will be added and disabled in .ssh/authorized_keys. Any attempts to ssh as this user using acceptable ssh keys will be presented with a message like the following: Please login as the user "ubuntu" rather than the user "youruser".
* tests: Disallow use of util.subp except for where needed.Scott Moser2018-09-052-4/+10
| | | | | | | | | | | | | | | | | | In many cases, cloud-init uses 'util.subp' to run a subprocess. This is not really desirable in our unit tests as it makes the tests dependent upon existance of those utilities. The change here is to modify the base test case class (CiTestCase) to raise exception any time subp is called. Then, fix all callers. For cases where subp is necessary or actually desired, we can use it via   a.) context hander CiTestCase.allow_subp(value)   b.) class level self.allowed_subp = value Both cases the value is a list of acceptable executable names that will be called (essentially argv[0]). Some cleanups in AltCloud were done as the code was being updated.
* Add unit tests for config/cc_ssh.pyFrancis Ginther2018-09-011-0/+147
| | | | | These tests focus on the apply_credentials method and the ssh setup for root and a distro default user.
* pylint: Fix pylint warnings reported in pylint 2.0.0.Scott Moser2018-07-212-29/+30
| | | | | | | | | Pylint 2.0.0 was recently released and complains more about logging-not-lazy than it used to. I've fixed those warnings, here. The changes in rh_subscription are more extensive. pylint may be complaining incorrectly there, but the tests were not correctly un-doing all of their mock/patching. This cleans those up and makes pylint happy.
* docs: note in rtd about avoiding /tmp when writing filesChad Smith2018-07-093-1/+17
| | | | LP: #1727876
* docs: Fix a small spelling error.Oz N Tiram2018-06-281-1/+1
| | | | standargs -> standards.
* docs: represent sudo:false in docs for user_groups config moduleChad Smith2018-06-191-2/+6
|
* lxd: Delete default network and detach device if lxd-init created them.Scott Moser2018-06-151-8/+56
| | | | | | | | | | | | | | | | | Newer versions (3.0.1+) of lxd create the 'lxdbr0' network when 'lxd init --auto' is invoked. When cloud-init is given a network configuration to pass on to lxc and that config had no name specified or 'lxdbr0', then cloud-init would fail to create the network as it already exists. Similarly, we need to remove the device from the default profile so that the attach code can work. Also, add a _lxc method and use it to make sure we're getting the --force-local flag everywhere. LP: #1776958
* pyflakes: fix unused variable references identified by pyflakes 2.0.0.Scott Moser2018-05-291-1/+1
| | | | | | A newer version of pyflakes (2.0.0) was released. It identifed some unused variables that version 1.6.0 did not identify. The change here merely fixes those unused variables.
* yaml_load/schema: Add invalid line and column nums to error messageChad Smith2018-05-231-16/+44
| | | | | | | | | | Yaml tracebacks are generally hard to read for average users. Add a bit of logic to util.yaml_load and schema validation to look for YAMLError.context_marker or problem_marker line and column counts. No longer log the full exceeption traceback from the yaml_load error, instead just LOG.warning for the specific error and point to the offending line and column where the problem exists.
* cc_mounts: Do not add devices to fstab that are already present.Lars Kellogg-Stedman2018-05-221-19/+34
| | | | | | | Do not add new entries to /etc/fstab for devices that already have an existing fstab entry. Resolves: rhbz#1542578
* read_file_or_url: move to url_helper, fix bug in its FileResponse.Scott Moser2018-05-172-5/+6
| | | | | | | | | | | | | The result of a read_file_or_url on a file and on a url would differ in behavior. str(UrlResponse) would return UrlResponse.contents.decode('utf-8') while str(FileResponse) would return str(FileResponse.contents) The difference being "b'foo'" versus "foo". As part of the general goal of cleaning util, move read_file_or_url into url_helper.
* flake8: fix flake8 errors in previous commit.Scott Moser2018-05-161-2/+2
|
* typos: Fix spelling mistakes in cc_mounts.py log messagesStephen Ford2018-05-161-9/+9
| | | | This also makes some of the messages more consistent.
* FreeBSD: Invoke growfs on ufs filesystems such that it does not prompt.Harm Weites2018-05-011-1/+1
| | | | | | | | By default, FreeBSD's growfs runs interactively asking a question which can be mitigated using the '-y' command line option. The fix here is simply to pass -y to growfs to avoid the prompt. LP: #1404745
* net: detect unstable network names and trigger a settle if neededRyan Harper2018-04-261-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The cloud-init-local.service expects that any network device name changes have already been completed by the kernel or udev daemon. In some situations we've found that the renaming of interfaces from kernel names (eth0, eth1, etc) to their persistent names (eno1, ens3, enp0s1, etc) may happen after cloud-init-local has started where it reads values from sysfs about what network devices are present, and which device to use as a fallback nic. Subsequently, cloud-init-local would write out network configuration for a kernel device name which would no longer be present by the time that networking services start to bring up the devices. The result is that the instance does not get networking configured. Prior to use of systemd-networkd, the Ubuntu 'networking.service' unit included a call to udevadm settle which is why this race is not seen on a Xenial system. This change adds the ability to detect if an interface has a stable name, if if we find one without stable names and stable names have not been disabled (net.ifnames=0 in /proc/cmdline), then cloud-init will invoke udevadm settle. LP: #1766287