3
\me+ @ sH U d Z ddlZddlZddlmZmZ ddlmZ ddlm Z ddl
mZmZm
Z
ddlmZ ddlmZ dd lmZmZ dd
lmZmZmZ ddlmZ ddlmZ d
Zdddeegeededgg dZeeeZ eje Z!dj"dd ee D Z#e$e%e$dddZ&dd Z'edddZ(e%eee$ddd d!Z)d%d#d$Z*dS )&zFSet Passwords: Set user passwords and enable/disable SSH password auth N)
ascii_lettersdigits)dedent)List)featuressubputil)Cloud)Config)
MetaSchemaget_meta_doc)ALL_DISTROSDistroug_util)PER_INSTANCE)update_ssh_configa This module consumes three top-level config keys: ``ssh_pwauth``, ``chpasswd``
and ``password``.
The ``ssh_pwauth`` config key determines whether or not sshd will be configured
to accept password authentication.
The ``chpasswd`` config key accepts a dictionary containing either or both of
``users`` and ``expire``. The ``users`` key is used to assign a password to a
corresponding pre-existing user. The ``expire`` key is used to set
whether to expire all user passwords specified by this module,
such that a password will need to be reset on the user's next login.
.. note::
Prior to cloud-init 22.3, the ``expire`` key only applies to plain text
(including ``RANDOM``) passwords. Post 22.3, the ``expire`` key applies to
both plain text and hashed passwords.
``password`` config key is used to set the default user's password. It is
ignored if the ``chpasswd`` ``users`` is used. Note: the ``list`` keyword is
deprecated in favor of ``users``.
Zcc_set_passwordsz
Set Passwordsz7Set user passwords and enable/disable SSH password authz # Set a default password that would need to be changed
# at first login
ssh_pwauth: true
password: password1
aU # Disable ssh password authentication
# Don't require users to change their passwords on next login
# Set the password for user1 to be 'password1' (OS does hashing)
# Set the password for user2 to a pre-hashed password
# Set the password for user3 to be a randomly generated password,
# which will be written to the system console
ssh_pwauth: false
chpasswd:
expire: false
users:
- name: user1
password: password1
type: text
- name: user2
password: $6$rounds=4096$5DJ8a9WMTEzIo5J4$Yms6imfeBvf3Yfu84mQBerh18l7OR1Wm1BJXZqFSpJ6BVas0AYJqIjP7czkOaAZHZi1kxQ5Y1IhgWN8K9NgxR1
- name: user3
type: RANDOM
)idnametitledescriptionZdistrosZ frequencyZexamplesZactivate_by_schema_keys c C s g | ]}|d kr|qS )ZloLOI01 ).0xr r &/usr/lib/python3.6/cc_set_passwords.py