HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_users_groups.cpython-311.pyc
�

܍~ck�
�l�UdZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZm
Z
ddlmZdd	lmZd
Zddd
edged��ed��ed��ed��ed��ed��gegd�Zeed<e
e��Zeje��ZdZdZdede
dedededdfd �ZdS)!z,Users and Groups: Configure users and groups�)�Logger)�dedent)�log)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ug_util)�PER_INSTANCEa�This module configures users and groups. For more detailed information on user
options, see the :ref:`Including users and groups<yaml_examples>` config
example.

Groups to add to the system can be specified under the ``groups`` key as
a string of comma-separated groups to create, or a list. Each item in
the list should either contain a string of a single group to create,
or a dictionary with the group name as the key and string of a single user as
a member of that group or a list of users who should be members of the group.

.. note::
   Groups are added before users, so any users in a group list must
   already exist on the system.

Users to add can be specified as a string or list under the ``users`` key.
Each entry in the list should either be a string or a dictionary. If a string
is specified, that string can be comma-separated usernames to create or the
reserved string ``default`` which represents the primary admin user used to
access the system. The ``default`` user varies per distribution and is
generally configured in ``/etc/cloud/cloud.cfg`` by the ``default_user`` key.

Each ``users`` dictionary item must contain either a ``name`` or ``snapuser``
key, otherwise it will be ignored. Omission of ``default`` as the first item
in the ``users`` list skips creation the default user. If no ``users`` key is
provided the default behavior is to create the default user via this config::

 users:
 - default

.. note::
    Specifying a hash of a user's password with ``passwd`` is a security risk
    if the cloud-config can be intercepted. SSH authentication is preferred.

.. note::
    If specifying a sudo rule for a user, ensure that the syntax for the rule
    is valid, as it is not checked by cloud-init.

.. note::
    Most of these configuration options will not be honored if the user
    already exists. The following options are the exceptions; they are applied
    to already-existing users: ``plain_text_passwd``, ``hashed_passwd``,
    ``lock_passwd``, ``sudo``, ``ssh_authorized_keys``, ``ssh_redirect_user``.

The ``user`` key can be used to override the ``default_user`` configuration
defined in ``/etc/cloud/cloud.cfg``. The ``user`` value should be a dictionary
which supports the same config keys as the ``users`` dictionary items.
�cc_users_groupszUsers and GroupszConfigure users and groups�allz�        # Add the ``default_user`` from /etc/cloud/cloud.cfg.
        # This is also the default behavior of cloud-init when no `users` key
        # is provided.
        users:
        - default
        z�        # Add the 'admingroup' with members 'root' and 'sys' and an empty
        # group cloud-users.
        groups:
        - admingroup: [root,sys]
        - cloud-users
        a9        # Skip creation of the <default> user and only create newsuper.
        # Password-based login is rejected, but the github user TheRealFalcon
        # and the launchpad user falcojr can SSH as newsuper. The default
        # shell for newsuper is bash instead of system default.
        users:
        - name: newsuper
          gecos: Big Stuff
          groups: users, admin
          sudo: ALL=(ALL) NOPASSWD:ALL
          shell: /bin/bash
          lock_passwd: true
          ssh_import_id:
            - lp:falcojr
            - gh:TheRealFalcon
        a+        # On a system with SELinux enabled, add youruser and set the
        # SELinux user to 'staff_u'. When omitted on SELinux, the system will
        # select the configured default SELinux user.
        users:
        - default
        - name: youruser
          selinux_user: staff_u
        am        # To redirect a legacy username to the <default> user for a
        # distribution, ssh_redirect_user will accept an SSH connection and
        # emit a message telling the client to ssh as the <default> user.
        # SSH clients will get the message:
        users:
        - default
        - name: nosshlogins
          ssh_redirect_user: true
        aW        # Override any ``default_user`` config in /etc/cloud/cloud.cfg with
        # supplemental config options.
        # This config will make the default user to mynewdefault and change
        # the user to not have sudo rights.
        ssh_import_id: [chad.smith]
        user:
          name: mynewdefault
          sudo: null
        )�id�name�title�description�distros�examples�	frequency�activate_by_schema_keys�meta)�no_create_home�system)�ssh_authorized_keys�
ssh_import_id�ssh_redirect_userr�cfg�cloudr�args�returnNc���tj||j��\}}tj|��\}}|���pg}	|���D] \}}
|j�||
���!|���D]�\}��fd�tD��}�fd�tD��}
|r@|
r>td|�dd�
|
���dd�
|���������dd��}|r]d	�vsd
�vrtd|z���|dvrtd|�d
|�d����|�t�
d||��n
|�d<|	�d<|jj|fi�����dS)Nc�>��g|]}��|���|��S���get��.0�key�configs  ��B/usr/lib/python3/dist-packages/cloudinit/config/cc_users_groups.py�
<listcomp>zhandle.<locals>.<listcomp>�s(���=�=�=�3�V�Z�Z��_�_�=�3�=�=�=�c�>��g|]}��|���|��Sr"r#r%s  �r)r*zhandle.<locals>.<listcomp>�s(���A�A�A�S����C���A�S�A�A�Ar+zNot creating user z	. Key(s) z, z cannot be provided with rFrrzdNot creating user %s. ssh_redirect_user cannot be provided with ssh_import_id or ssh_authorized_keys)T�defaultz&. Invalid value of ssh_redirect_user: z*. Expected values: true, default or false.zzIgnoring ssh_redirect_user: %s for %s. No default_user defined. Perhaps missing cloud configuration users:  [default, ..].�cloud_public_ssh_keys)r
�normalize_users_groups�distro�extract_default�get_public_ssh_keys�items�create_group�NO_HOME�	NEED_HOME�
ValueError�join�pop�LOG�warning�create_user)rrrrr�users�groups�default_user�_user_config�
cloud_keys�members�user�no_home�	need_homerr(s               @r)�handlerF�s5����4�S�%�,�G�G�O�U�F�#*�#:�5�#A�#A� �\�<��*�*�,�,�2��J�!�<�<�>�>�1�1���w�
��!�!�$��0�0�0�0��+�+�-�-�%1�%1���v�=�=�=�=�'�=�=�=��A�A�A�A�I�A�A�A�	��	�y�	��A�T�A�A�D�I�I�i�4H�4H�A�A�,0�I�I�g�,>�,>�A�A���
�
#�J�J�':�E�B�B���	=�$��.�.�/�V�2K�2K� �J������
!�(9�9�9� �j�%)�D�D�*;�*;�*;�=����
�#����&�&��
����/;��*�+�2<��.�/� ��� ��0�0��0�0�0�0�K%1�%1r+)�__doc__�loggingr�textwrapr�	cloudinitr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemarr	�cloudinit.distrosr
�cloudinit.settingsr�MODULE_DESCRIPTIONr�__annotations__�	getLogger�__name__r:r5r6�str�listrFr"r+r)�<module>rVs���/�.�.�������������$�$�$�$�$�$�!�!�!�!�!�!�
$�#�#�#�#�#�<�<�<�<�<�<�<�<�%�%�%�%�%�%�+�+�+�+�+�+�/��d��
)�%��w���
�	
�	
�	��
�	
�	
�	��
�	
�	
�$	��
�
	
�
	
�	��	
�	
�	
�	��	
�	
�	
�yH�R�!�aQ�Q��j�Q�Q�Q�f�,�t�
�
���g���!�!��'��I�	�/1�

�/1��/1�#(�/1�/5�/1�=A�/1�	�/1�/1�/1�/1�/1�/1r+