summaryrefslogtreecommitdiff
path: root/cloudinit/config
AgeCommit message (Collapse)Author
2021-11-01Fix unhandled apt_configure case. (#1065)Brett Holman
Don't throw an exception when mirror arch is unspecified.
2021-10-29Allow libexec for hotplug (#1088)James Falcon
When we added the install hotplug module, we forgot to update the redhet/cloud-init.spec.in file and allow for execution on /usr/libexec. This PR adds that functionality.
2021-10-29Remove (deprecated) apt-key (#1068)Brett Holman
Also, add the "signed by" option to source definitions. This enables users to limit the scope of trust for individual keys. LP: #1836336
2021-10-27cc_ssh.py: Add configuration for controlling ssh-keygen output (#1083)dermotbradley
When ssh host keys are generated during initial boot the full output of ssh-keygen, including the randomart for the key, is displayed on the console for each of the generated key types, which takes up a large amount of screen output (17 lines per key type). With this change ssh-keygen output is still displayed by default. Setting ssh_quiet_keygen to True will prevent ssh-keygen output from appearing. If only the fingerprints of the host keys should be displayed then this can be achieved using the existing emit_keys_to_console and/or ssh_fp_console_blacklist settings.
2021-10-27Add "install hotplug" module (SC-476) (#1069)James Falcon
This commit removes automatically installing udev rules for hotplug and adds a module to install them instead. Automatically including the udev rules and checking if hotplug was enabled consumed too many resources in certain circumstances. Moving the rules to a module ensures we don't spend extra extra cycles on hotplug if hotplug functionality isn't desired. LP: #1946003
2021-10-25Add module 'write-files-deferred' executed in stage 'final' (#916)Lucendio
The main idea is to introduce a second module that takes care of writing files, but in the 'final' stage. While the introduction of a second module would allow for choosing the appropriate place withing the order of modules (and stages), there is no addition top-level directive being added to the cloud configuration schema. Instead, 'write-files' schema is being extended to include a 'defer' attribute used only by the 'write-deffered-files' modules. The new module 'write-deferred-files' reuses as much as possible of the 'write-files' functionality.
2021-10-20Leave the details of service management to the distro (#1074)Andy Fiddaman
Various modules restart services and they all have logic to try and detect if they are running on a system that needs 'systemctl' or 'service', and then have code to decide which order the arguments need to be etc. On top of that, not all modules do this in the same way. The duplication and different approaches are not ideal but this also makes it hard to add support for a new distribution that does not use either 'systemctl' or 'service'. This change adds a new manage_service() method to the distro class and updates several modules to use it.
2021-10-19cc_ssh.py: fix private key group owner and permissions (#1070)Emanuele Giuseppe Esposito
When default host keys are created by sshd-keygen (/etc/ssh/ssh_host_*_key) in RHEL/CentOS/Fedora, openssh it performs the following: # create new keys if ! $KEYGEN -q -t $KEYTYPE -f $KEY -C '' -N '' >&/dev/null; then exit 1 fi # sanitize permissions /usr/bin/chgrp ssh_keys $KEY /usr/bin/chmod 640 $KEY /usr/bin/chmod 644 $KEY.pub Note that the group ssh_keys exists only in RHEL/CentOS/Fedora. Now that we disable sshd-keygen to allow only cloud-init to create them, we miss the "sanitize permissions" part, where we set the group owner as ssh_keys and the private key mode to 640. According to https://bugzilla.redhat.com/show_bug.cgi?id=2013644#c8, failing to set group ownership and permissions like openssh does makes the RHEL openscap tool generate an error. Signed-off-by: Emanuele Giuseppe Esposito eesposit@redhat.com RHBZ: 2013644
2021-10-15testing: add get_cloud function (SC-461) (#1038)James Falcon
Also added supporting distro/datasource classes and updated tests that have a `get_cloud` call.
2021-10-08Use specified tmp location for growpart (#1046)jshen28
Growpart uses mktemp internally to save some date. This could lead to conflicts with tmpfile clean service during boot. This patch explicitly make it uses a tmp file under /var/tmp Signed-off-by: ushen <yshxxsjt715@gmail.com>
2021-10-07Allow comments in runcmd and report failed commands correctly (#1049)Brett Holman
Allow comments in runcmd and report failed commands correctly A `runcmd` script may fail to parse properly, but does not mark `runcmd` as failed when that occurs. Additionally `shellify()` fails to correctly parse scripts that contain a comment line. Rectify both issues and add unit tests to verify correct behavior. LP: #1853146
2021-09-29Make wording for module frequency consistent (#1039)Nicolas Bock
Some modules' frequency are documented as `always` while others as `per always`. The difference in wording can be confusing. This change updates all such modules to use `always`. Signed-off-by: Nicolas Bock <nicolas.bock@canonical.com>
2021-09-29Use ascii code for growpart (#1036)jshen28
growpart not working well for environment using UTF-8 encoding. This patch forces growpart command to use C locale. Root issue likely: https://bugs.launchpad.net/ubuntu/+source/cloud-utils/+bug/1928167
2021-09-22docs: update cc_disk_setup for fs to raw disk (#1017)James Falcon
2021-09-17docs: fix typo and include sudo for report bugs commands (#1022)Renan Rodrigo
Remove a duplicate "a" in the docs, and change the bug reporting documentation to tell users to run the commands with sudo. LP: #1940236
2021-09-13Improve ug_util.py (#1013)Shreenidhi Shedi
No functional changes.
2021-09-13Support openEuler OS (#1012)zhuzaifangxuele
openEuler Homepage: https://www.openeuler.org/en/
2021-09-02cc_update_etc_hosts: Use the distribution-defined path for the hosts file (#983)Andy Fiddaman
The distribution class has a field that specifies the location of the system hosts file and this can be overridden in subclasses. While the field is correctly used in distro.update_etc_hosts(), the update_etc_hosts module does not use it and just assumes '/etc/hosts' This fixes the module to use the distribution-specific variable.
2021-09-01Add CloudLinux OS support (#1003)Alexandr Kravchenko
https://www.cloudlinux.com/
2021-09-01puppet config: add the start_agent option (#1002)Andrew Bogott
The current code starts the puppet agent and also sets autostart in all cases. This conflicts with a common pattern where puppet itself manages the agent and autostart state. For example, in my deploy puppet disables the puppet agent and replaces it with a cron. This causes various races both within this cloud-init unit and within puppet itself while cloud-init and puppet fight over whether or not to enable the service.
2021-08-12cc_resolv_conf: fix typos (#969)Shreenidhi Shedi
Add tests for cc_resolv_conf handler
2021-08-10cc_puppet: support AIO installations and more (#960)Gabriel Nagy
- update the puppet module to support AIO installations by setting `install_type` to `aio` - make the install collection configurable through the `collection` parameter; by default the rolling `puppet` collection will be used, which installs the latest version) - when `install_type` is `aio`, puppetlabs repos will be purged after installation; set `cleanup` to `False` to prevent this - AIO installations are performed by downloading and executing a shell script; the URL for this script can be overridden using the `aio_install_url` parameter - make it possible to run puppet agent after installation/configuration via the `exec` key - by default, puppet agent will run with the `--test` argument; this can be overridden via the `exec_args` key
2021-08-05Add support for EuroLinux 7 && EuroLinux 8 (#957)Aleksander Baranowski
2021-08-03Implementing device_aliases as described in docs (#945)Mal Graty
Implement missing device_aliases feature The device_aliases key has been documented as part of disk_setup for years, however the feature was never implemented. This implements the feature as documented allowing usercfg (rather than dsconfig) to create a mapping of device names. This is not to be confused with disk_aliases, a very similar map but existing solely for use by datasources. LP: #1867532
2021-07-21Add VZLinux support (#951)eb3095
Virtuozzo Linux is a distro based off of CentOS 8, similar to Alma Linux and Rocky Linux.
2021-06-18Add support for VMware PhotonOS (#909)sshedi
Also added a new (currently experimental) systemd-networkd renderer, and includes a small refactor to cc_resolv_conf.py to support the resolved.conf used by systemd-resolved.
2021-06-14add DragonFlyBSD support (#904)Gonéri Le Bouder
- Mostly based on FreeBSD, the main exception is that `find_devs_with_on_freebsd` does not work. - Since we cannot get the CDROM or the partition labels, `find_devs_with_on_dragonflybsd()` has a more naive approach and returns all the block devices.
2021-05-25Add Rocky Linux support to cloud-init (#906)Louis Abel
Rocky Linux is a RHEL-compatible distribution so all changes that have been made should be trivial.
2021-05-18Added support for importing keys via primary/security mirror clauses (#882)Paul Goins
Presently, mirror keys cannot be associated with primary/security mirrors. Unfortunately, this prevents use of Landscape-managed package mirrors as the mirror key for the Landscape-hosted repository cannot be provided. This patch allows the same key-related fields usable on "sources" entries to be used on the "primary" and "security" entries as well. LP: #1925395
2021-05-07cc_disk_setup.py: remove UDEVADM_CMD definition as not used (#886)dermotbradley
UDEVADM_CMD is defined but not actually used in cc_disk_setup.py so remove it. Also modify the comment at top of read_parttbl function to remove the reference to udevadm which implies it is used to scan the partition table.
2021-05-07Add AlmaLinux OS support (#872)Andrew Lukoshko
AlmaLinux OS is RHEL-compatible so all the changes needed are trivial.
2021-05-03Revert "Add support to resize rootfs if using LVM (#721)" (#887)Daniel Watkins
This reverts commit 74fa008bfcd3263eb691cc0b3f7a055b17569f8b. During pre-release testing, we discovered two issues with this commit. Firstly, there's a typo in the udevadm command that causes a TypeError for _all_ growpart executions. Secondly, the LVM resizing does not appear to successfully resize everything up to the LV, though some things do get resized. We certainly want this change, so we'll be happy to review and land it alongside an integration test which confirms that it is working as expected. LP: #1922742
2021-04-26Fix chef module run failure when chef_license is set (#868)Ben Hughes
Move chef_license from TPL_PATH_KEYS to TPL_KEYS as the chef license setting is not a path but must be added to the client config template. Fixes file or folder not found exception raised from ensure_dirs.
2021-04-22Use `partprobe` to re-read partition table if available (#856)Nicolas Bock
The blkdev command is fragile re-reading partition tables if a partition is mounted. This change instead uses the partprobe if it is available. LP: #1920939
2021-04-15add prefer_fqdn_over_hostname config option (#859)hamalq
the above option allows the user to control the behavior of a distro hostname selection if both short hostname and FQDN are supplied. If `prefer_fqdn_over_hostname` is true the FQDN will be selected as hostname; if false the hostname will be selected LP: #1921004
2021-04-14doc: Replace remaining references to user-scripts as a config module (#866)Ryan Harper
git-grep showed a few more locations where we refer to a "user-scripts" config module which is really cc_scripts_user module. Replace these references with slightly different language so as not to confuse future me when looking for "user-scripts" vs. "scripts-user"
2021-03-30Add support to resize rootfs if using LVM (#721)Eduardo Otubo
This patch adds support to resize a single partition of a VM if it's using an LVM underneath. The patch detects if it's LVM if the given block device is a device mapper by its name (e.g. `/dev/dm-1`) and if it has slave devices under it on sysfs. After that syspath is updated to the real block device and growpart will be called to resize it (and automatically its Physical Volume). The Volume Group will be updated automatically and a final call to extend the rootfs to the remaining space available will be made. Using the same growpart configuration, the user can specify only one device to be resized when using LVM and growpart, otherwise cloud-init won't know which one should be resized and will fail. rhbz: #1810878 LP: #1799953 Signed-off-by: Eduardo Otubo <otubo@redhat.com> Signed-off-by: Scott Moser <smoser@brickies.net>
2021-03-19write passwords only to serial console, lock down cloud-init-output.log (#847)Daniel Watkins
Prior to this commit, when a user specified configuration which would generate random passwords for users, cloud-init would cause those passwords to be written to the serial console by emitting them on stderr. In the default configuration, any stdout or stderr emitted by cloud-init is also written to `/var/log/cloud-init-output.log`. This file is world-readable, meaning that those randomly-generated passwords were available to be read by any user with access to the system. This presents an obvious security issue. This commit responds to this issue in two ways: * We address the direct issue by moving from writing the passwords to sys.stderr to writing them directly to /dev/console (via util.multi_log); this means that the passwords will never end up in cloud-init-output.log * To avoid future issues like this, we also modify the logging code so that any files created in a log sink subprocess will only be owner/group readable and, if it exists, will be owned by the adm group. This results in `/var/log/cloud-init-output.log` no longer being world-readable, meaning that if there are other parts of the codebase that are emitting sensitive data intended for the serial console, that data is no longer available to all users of the system. LP: #1918303
2021-02-24cc_keys_to_console.py: Add documentation for recently added config key (#824)dermotbradley
PR #811 added a new config key, emit_keys_to_console, but didn't update the documentation for mention it.
2021-02-23Update cc_set_hostname documentation (#818)Toshi Aoyama
It is distro dependent whether hostname or fqdn is used
2021-02-22cc_keys_to_console: add option to disable key emission (#811)Michael Hudson-Doyle
Specifically: ssh: emit_keys_to_console: false We also port the cc_keys_to_console cloud tests to the new integration testing framework, and add a test for this new option. LP: #1915460
2021-01-20Use proper spelling for Red Hat (#778)Dan Kenigsberg
The company name has two distinct words. Signed-off-by: Dan Kenigsberg <danken@redhat.com>
2021-01-13cc_seed_random: update documentation and fix integration test (#771)Daniel Watkins
The documentation did not mention that the given data may not be the exact string written: the cloud's random data may be added to it. Additionally, the documentation of the command key was incorrect. test_seed_random_data was updated to check that the given data is a prefix of the written data, to match cloud-init's expected (and, now, documented) behaviour. LP: #1911227
2020-12-17cc_ca_certs: add RHEL support (#633)cawamata
This refactors cc_ca_certs to support non-ca-certificates distros, and adds RHEL support.
2020-11-25cc_apt_configure: add riscv64 as a ports arch (#687)Dimitri John Ledkov
2020-11-20Support configuring SSH host certificates. (#660)Jonathan Lung
Existing config writes keys to /etc/ssh after deleting files matching a glob that includes certificate files. Since sshd looks for certificates in the same directory as the keys, a host certificate must be placed in this directory. This update enables the certificate's contents to be specified along with the keys. Co-authored-by: jonathan lung <lungj@heresjono.com> Co-authored-by: jonathan lung <jlung@kepler.space>
2020-11-19cc_resizefs on FreeBSD: Fix _can_skip_ufs_resize (#655)Mina Galić
On FreeBSD, if a UFS has trim: (-t) or MAC multilabel: (-l) flag, resize FS fail, because the _can_skip_ufs_resize check gets tripped up by the missing options. This was reported at FreeBSD Bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250496 and as LP: #1901958 Rather than fixing the parser as in the patches proposed there (and attempted in #636) this pull-request rips out all of it, and simplifies the code. We now use `growfs -N` and check if that returns an error. If it returns the correct kind of error, we can skip the resize, because we either are at the correct size, or the filesystem in question is broken or not UFS. If it returns the wrong kind of error, we just re-raise it. LP: #1901958
2020-11-18cli: add --system param to allow validating system user-data on a machine (#575)Chad Smith
Allow root user to validate the userdata provided to the launched machine using `cloud-init devel schema --system`
2020-11-03Make some language improvements in growpart documentation (#649)Shane Frasier
* Fix awkward English in sentence * Add the missing word "the" * Fix misspelling * Add @jsf9k as a contributor Co-authored-by: Rick Harding <rharding@mitechie.com>
2020-11-02remove unnecessary reboot from gpart resize (#646)Mina Galić
a reboot after `gpart resize` hasn't been necessary since ca FreeBSD 9.2 Co-authored-by: Rick Harding <rharding@mitechie.com>