summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_set_passwords.py
AgeCommit message (Collapse)Author
2020-06-08Move subp into its own module. (#416)Scott Moser
This was painful, but it finishes a TODO from cloudinit/subp.py. It moves the following from util to subp: ProcessExecutionError subp which target_path I moved subp_blob_in_tempfile into cc_chef, which is its only caller. That saved us from having to deal with it using write_file and temp_utils from subp (which does not import any cloudinit things now). It is arguable that 'target_path' could be moved to a 'path_utils' or something, but in order to use it from subp and also from utils, we had to get it out of utils.
2020-03-25set_passwords: avoid chpasswd on BSD (#268)Gonéri Le Bouder
Avoid chpasswd on all the BSD variants.
2020-01-24cc_set_password: increase random pwlength from 9 to 20 (#189)Ryan Harper
Increasing the bits of security from 52 to 115. LP: #1860795
2019-12-18cloud-init: fix capitalisation of SSH (#126)Daniel Watkins
* 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
2019-11-26set_passwords: support for FreeBSD (#46)Igor Galić
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>
2019-10-17replace any deprecated log.warn with log.warningDominic Schlegel
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
2019-08-07cc_set_passwords: rewrite documentationDaniel Watkins
What we had previously was inaccurate in a few respects. LP: #1838794
2019-01-15cc_set_passwords: Fix regex when parsing hashed passwordsMarlin Cremers
Correct invalid regex to match hashes starting with the following: - $1, $2a, $2y, $5 or $6 LP: #1811446
2018-04-20set_passwords: Add newline to end of sshd config, only restart if updated.Scott Moser
This admittedly does a fairly extensive re-factor to simply add a newline to the end of sshd_config. It makes the ssh_config updating portion of set_passwords more testable and adds tests for that. The new function is in 'update_ssh_config_lines' which allows you to update a config with multiple changes even though only a single one is currently used. We also only restart the ssh daemon now if a change was made to the config file. Before it was always restarted if the user specified a value for ssh_pwauth other than 'unchanged'. Thanks to Lorens Kockum for initial diagnosis and patch. LP: #1677205
2017-04-12util: teach write_file about copy_mode optionLars Kellogg-Stedman
On centos/fedora/rhel/derivatives, /etc/ssh/sshd_config has mode 0600, but cloud-init unilaterally sets file modes to 0644 when no explicit mode is passed to util.write_file. On ubuntu/debian, this file has mode 0644. With this patch, write_file learns about the copy_mode option, which will cause it to use the mode of the existing file by default, falling back to the explicit mode parameter if the file does not exist. LP: #1644064 Resolves: rhbz#1295984
2017-03-24Add support for setting hashed passwordsTore S. Lonoy
This change will add support for hashed passwords in cc_set_passwords. It checks if a password is a hash with by checking that it matches in fairly safe way, and also that the password does not have a ":" in it. chpasswd needs to know if the password is hashed or not, so two lists is created so chpasswd is feed with the correct one. LP: #1570325
2017-03-17test: Adding integratiron test for password as listJoshua Powers
This adds an integration test for setting passwords when given as a list rather than a string. This also updates the docs and tests so that Random is now RANDOM as is correct.
2017-03-10Further fix regression to support 'password' for default user.Scott Moser
The adjusted change did not support #cloud-config password: passw0rd This correctly fixes that regression.
2017-03-10fix regression when no chpasswd/list was provided.Scott Moser
This regression was caused by my rework of Sergio's branch. The change now still works when there is no chpasswd/list provided.
2017-03-09Support chpasswd/list being a list in addition to a string.Sergio Lystopad
cc_set_passwords previously supported 'list' as a multiline string: chpasswd: list: | user:pass1 user015:R This patch adds support for user/pairs as a list: chpasswd: list: - user:pass1 - user015:R LP: #1665694
2017-03-07doc: Fix configuration example for cc_set_passwords module.Sergio Lystopad
The documentation indicated chpasswd/list should be a list when the code only accepts a string. LP: #1665773
2016-12-22LICENSE: Allow dual licensing GPL-3 or Apache 2.0Jon Grimm
This has been a recurring ask and we had initially just made the change to the cloud-init 2.0 codebase. As the current thinking is we'll just continue to enhance the current codebase, its desirable to relicense to match what we'd intended as part of the 2.0 plan here. - put a brief description of license in LICENSE file - put full license versions in LICENSE-GPLv3 and LICENSE-Apache2.0 - simplify the per-file header to reference LICENSE - tox: ignore H102 (Apache License Header check) Add license header to files that ship. Reformat headers, make sure everything has vi: at end of file. Non-shipping files do not need the copyright header, but at the moment tests/ have it.
2016-10-19Move user/group functions to new ug_util fileJoshua Harlow
The amount of code to do user and group normalization and extraction deserves its own file so move the code that does this to a new file and update references to the old location. This removes some of the funkyness done in config modules to avoid namespace and attribute clashes as well.
2016-09-30Improve module documentation and doc cleanup.Wesley Wiedenmeier
This adds lots of config module documentation in a standard format. It will greatly improve the content at readthedocs. Additionally: * Add a 'doc' env to tox.ini * Changed default highlight language for sphinx conf from python to yaml most examples in documentation are yaml configs * Updated datasource examples to highlight sh code properly
2016-05-12Fix up a ton of flake8 issuesJoshua Harlow
2016-03-14fix long lineScott Moser
2016-03-14merge with trunkScott Moser
2015-02-10pep8Scott Moser
2015-02-10fix use of 'letters' and translateScott Moser
2014-12-03Handle more possible ssh_pwauth valuesChris Cosby
Update ssh_pwauth handler to accept all values mentioned in doc/examples/cloud-config.txt
2014-09-10pyflakes fixes.Scott Moser
make pyflakes now passes.
2014-08-26further remove evidence of pylint.Scott Moser
This just removes comments '# pylint:' things and other code remnents of pylint.
2014-02-06Added arch distro class to merge requestNate House nathan.house@rackspace.com
2014-02-05Cleanup and cloud-init-local local/net mount dep fixNate House nathan.house@rackspace.com
2014-02-04Merge gentoo branch and updated set-password to support systemctlNate House nathan.house@rackspace.com
2014-02-03Update yum unittestNate House nathan.house@rackspace.com
2014-01-28exclude modules fix 1Nate House nathan.house@rackspace.com
2014-01-27Adds distro module exclude supportNate House nathan.house@rackspace.com
2014-01-24init_cmd distro unique supports gentoo init scriptsNate House nathan.house@rackspace.com
2014-01-23Package manager install / update fixes and service restart fooNate House nathan.house@rackspace.com
2013-07-23Fix password setting for rhel5.Scott Moser
Changing password via 'chpasswd' command in rhel5 would fail, if input to the 'chpasswd' command doesn't end with '\n'. The fix is just to append a carriage return to the input.
2013-06-19fix and cleanup usage of util.logexcJuerg Haefliger
2012-10-27Helpful cleanups.harlowja
1. Remove the usage of the path.join function now that all code should be going through the util file methods (and they can be mocked out as needed). 2. Adjust all occurences of the above join function to either not use it or replace it with the standard os.path.join (which can also be mocked out as needed) 3. Fix pylint from complaining about the tests folder 'helpers.py' not being found 4. Add a pylintrc file that is used instead of the options hidden in the 'run_pylint' tool.
2012-09-28Add a comment as to why distros can't beJoshua Harlow
imported without being renamed due to previous usage of the attribute 'distros'
2012-09-28Rework the rest of the locations that usedJoshua Harlow
the previous 'user' and make those locations go through the new distros functions to select the default user or the user list (depending on usage). Adjust the tests to check the new 'default' field that signifies the default user + test the new method to extract just the default user from a normalized user dictionary.
2012-08-31Removed admin group from default Ubuntu user group list.Ben Howard
Fixed change password behavior to work with new user list handling (LP: #1044553)
2012-08-22fix errors from 'make pep8'Scott Moser
2012-08-22Simplified users[0] detection, and ensured compatability with previous user ↵Ben Howard
password control code
2012-07-011. Rename util functions to is_true and is_falseharlowja
2. Move the config loading functions to where they are used (in stages) 3. Adjust cc_set_passwords to use the is_true and is_false renamed functions 4. Adjust the init stage to have a _read_base_config function used to load the base 'initial' configuration from the following locations a. Kernel cmdline b. Conf.d location (+ the cloud.cfg location) c. Built-in configuration
2012-06-21Simplify sshd config loading to make it use one set of functions/objects/classesJoshua Harlow
2012-06-211. Renames for debug message from 'transform' to 'module'harlowja
2. Fixing up more cloud.path.joins found to use the right ro/rw filename
2012-06-20Massive pylint + pep8 fixups!Joshua Harlow
2012-06-20Renamed back to 'cc_*' with the reasoning being that 'cc_' providesJoshua Harlow
some protection against module name collisions when importing.