CasperSecurity

Current Path : /lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_puppet.cpython-310.pyc

o

쑛h�*�
@sBUdZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlZddlm
Z
mZmZmZmZddlmZddlmZdd	lmZdd
lmZmZmZddlmZdZd
gZdZ degedgd�Z!ee"d<e�#e$�Z%Gdd�d�Z&dede'fdd�Z(dd�Z)edddfdefdd�Z*de'd eded!e+d"df
d#d$�Z,dS)%z+Puppet: Install, configure and start puppet�N)�suppress)�StringIO)�List�Union)�helpers�subp�
temp_utils�
url_helper�util)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS�Distro�PackageInstallerError)�PER_INSTANCEzKhttps://raw.githubusercontent.com/puppetlabs/install-puppet/main/install.shz--test)�puppet-agent�puppet�	cc_puppetr)�id�distros�	frequency�activate_by_schema_keys�metac@seZdZdd�ZdS)�PuppetConstantscCs8||_||_tj�|d�|_tj�|jd�|_||_dS)N�certszca.pem)�	conf_path�ssl_dir�os�path�join�ssl_cert_dir�
ssl_cert_path�csr_attributes_path)�self�puppet_conf_file�puppet_ssl_dirr#�r'�</usr/lib/python3/dist-packages/cloudinit/config/cc_puppet.py�__init__*s

zPuppetConstants.__init__N)�__name__�
__module__�__qualname__r)r'r'r'r(r)sr�cloud�actionc	Cs`d}tD]}z|j�||�d��|}Wn
tjyYqw|s.t�d|d�t��dSdS)z8Attempts to perform action on one of the puppet services�z.servicez0Could not '%s' any of the following services: %s�, N)�PUPPET_PACKAGE_NAMES�distro�manage_servicer�ProcessExecutionError�LOG�warningr )r-r.�service_managed�puppet_namer'r'r(�_manage_puppet_services7s ���r9cCst�|dd|g�\}}|��S)z�Get the config value for a given setting using `puppet config print`
    :param puppet_bin: path to puppet binary
    :param setting: setting to query
    �config�print)r�rstrip)�
puppet_bin�setting�out�_r'r'r(�get_config_valueIsrATr2c	Cs�g}|dur
d|g}|dur|d|g7}|r|dg7}tj|dd�j}tj|��dd��!}tj�|d	�}t	j
||d
d�tj|g|dd
�Wd�S1sPwYdS)a�Install puppet-agent from the puppetlabs repositories using the one-shot
    shell script

    :param distro: Instance of Distro
    :param url: URL from where to download the install script
    :param version: version to install, blank defaults to latest
    :param collection: collection to install, blank defaults to latest
    :param cleanup: whether to purge the puppetlabs repo after installation
    Nz-vz-cz	--cleanup�)�url�retriesT)�dir�	needs_exezpuppet-installi�)�modeF��capture)r	�readurl�contentsr�tempdir�get_tmp_exec_pathrrr r
�
write_filer)	r2rC�version�
collection�cleanup�args�content�tmpd�tmpfr'r'r(�install_puppet_aioRs 
�$�rV�name�cfgrR�returnc 	Cs4d|vrt�d|�dS|d}t�|dd�}t�|dd�}t�|dd�}t�|dd�}t�|d	d�}	tj|d
dd�}
tj|d
dd�}tj|dtd�}|dkrVd}
d}d}nd}
d}d}t�|d|�}|sm|rmt�d�nu|r�t�d|rv|nd|�|dkr�|dur�tD]*}tt	��|r�||ggn|g}|j
�|�|}	Wd�n	1s�wYq�|s�t�dd�t��n'|r�||ggn|g}|j
�|�n|dkr�t
|j
||||	�nt�d|�d}
t�|dt|d��}t�|dt|d��}t�|dt|d��}t|||�}d |v�r�t�|j�}t��}d!d"�|��D�}d#�|�}|jt|�|jd$�|d ��D]t\}}|d%k�rit�|jd&�t�|j|
d�t�|j�t�|j|
d�t�|j|�t�|j|
d�n*|��D]%\}}|d'k�r�|�d(t� ��}|�d)|�!��}|�"�}|�#|||��qmt�$|jd*|j�t�|j|�%���q3d|v�r�t�|j&t'j(|ddd+��|�r�t)|d,�|
�rt�d-�|d.g}d/|v�r|d/}t*|t+t,f��r�|�-|�n!t*|t.��r�|�-|�/��nt�d0t0|��|�-t1�n|�-t1�t2j2|dd1�|�rt)|d2�dSdS)3Nrz9Skipping module named %s, no 'puppet' configuration found�installTrOrP�install_type�packagesrQ�execF)�default�
start_service�aio_install_url�aio�rootz/opt/puppetlabs/bin/puppetr�package_namez@Puppet install set to false but version supplied, doing nothing.z'Attempting to install puppet %s from %s�latestz+No installable puppet package in any of: %sr0z Unknown puppet install type '%s'�	conf_filer:r�ssldirr#�csr_attributes�confcSsg|]}|���qSr')�lstrip)�.0�ir'r'r(�
<listcomp>�szhandle.<locals>.<listcomp>�
)�source�ca_certi��certnamez%fz%iz%s.old)�default_flow_style�enablezRunning puppet-agent�agent�	exec_argszOUnknown type %s provided for puppet 'exec_args' expected list, tuple, or stringrH�start)3r5�debugr
�get_cfg_option_bool�get_cfg_option_str�AIO_INSTALL_URLr6r1rrr2�install_packagesr rVrAr�load_text_filerr�DefaultingConfigParser�
splitlines�	read_filer�items�
ensure_dirr�chownbynamer!rNr"�replace�socket�getfqdn�get_instance_id�lower�set�rename�	stringifyr#�yaml�dumpr9�
isinstance�list�tuple�extend�str�split�type�PUPPET_AGENT_DEFAULT_ARGSr) rWrXr-rR�
puppet_cfgrZrOrPr[rQ�run�
start_puppetdr`�puppet_userr=�puppet_packagercr8�
to_installrerr#�p_constantsrK�
puppet_config�
cleaned_lines�cleaned_contents�cfg_name�o�v�cmd�cmd_argsr'r'r(�handlevs
������
�
��"�	�������


�
�
�
�


�
�r�)-�__doc__�loggingrr��
contextlibr�ior�typingrrr��	cloudinitrrrr	r
�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar
�cloudinit.distrosrrr�cloudinit.settingsrryr�r1r�__annotations__�	getLoggerr*r5rr�r9rArVr�r�r'r'r'r(�<module>sD�
�
�"$
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY