403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.11/site-packages/ansible/modules/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/ansible/modules/__pycache__/apt_key.cpython-311.pyc
�

���c�E���ddlmZmZmZeZdZdZdZddl	Z	ddl
mZddlm
Z
ddlmZdd	lmZdd
lmZdadadZd�Zd�Zd
�Zd�Zdd�Zd�Zd�Zd�Zdd�Zd�Z d�Z!dd�Z"d�Z#d�Z$e%dkre$��dSdS)�)�absolute_import�division�print_functiona�

---
module: apt_key
author:
- Jayson Vantuyl (@jvantuyl)
version_added: "1.0"
short_description: Add or remove an apt key
description:
    - Add or remove an I(apt) key, optionally downloading it.
extends_documentation_fragment: action_common_attributes
attributes:
    check_mode:
        support: full
    diff_mode:
        support: none
    platform:
        platforms: debian
notes:
    - The apt-key command has been deprecated and suggests to 'manage keyring files in trusted.gpg.d instead'. See the Debian wiki for details.
      This module is kept for backwards compatibility for systems that still use apt-key as the main way to manage apt repository keys.
    - As a sanity check, downloaded key id must match the one specified.
    - "Use full fingerprint (40 characters) key ids to avoid key collisions.
      To generate a full-fingerprint imported key: C(apt-key adv --list-public-keys --with-fingerprint --with-colons)."
    - If you specify both the key id and the URL with C(state=present), the task can verify or add the key as needed.
    - Adding a new key requires an apt cache update (e.g. using the M(ansible.builtin.apt) module's update_cache option).
requirements:
    - gpg
options:
    id:
        description:
            - The identifier of the key.
            - Including this allows check mode to correctly report the changed state.
            - If specifying a subkey's id be aware that apt-key does not understand how to remove keys via a subkey id.  Specify the primary key's id instead.
            - This parameter is required when C(state) is set to C(absent).
        type: str
    data:
        description:
            - The keyfile contents to add to the keyring.
        type: str
    file:
        description:
            - The path to a keyfile on the remote server to add to the keyring.
        type: path
    keyring:
        description:
            - The full path to specific keyring file in C(/etc/apt/trusted.gpg.d/).
        type: path
        version_added: "1.3"
    url:
        description:
            - The URL to retrieve key from.
        type: str
    keyserver:
        description:
            - The keyserver to retrieve key from.
        type: str
        version_added: "1.6"
    state:
        description:
            - Ensures that the key is present (added) or absent (revoked).
        type: str
        choices: [ absent, present ]
        default: present
    validate_certs:
        description:
            - If C(false), SSL certificates for the target url will not be validated. This should only be used
              on personally controlled sites using self-signed certificates.
        type: bool
        default: 'yes'
ah
- name: One way to avoid apt_key once it is removed from your distro
  block:
    - name: somerepo |no apt key
      ansible.builtin.get_url:
        url: https://download.example.com/linux/ubuntu/gpg
        dest: /etc/apt/trusted.gpg.d/somerepo.asc

    - name: somerepo | apt source
      ansible.builtin.apt_repository:
        repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/myrepo.asc] https://download.example.com/linux/ubuntu {{ ansible_distribution_release }} stable"
        state: present

- name: Add an apt key by id from a keyserver
  ansible.builtin.apt_key:
    keyserver: keyserver.ubuntu.com
    id: 36A1D7869245C8950F966E92D8576A8BA88D21E9

- name: Add an Apt signing key, uses whichever key is at the URL
  ansible.builtin.apt_key:
    url: https://ftp-master.debian.org/keys/archive-key-6.0.asc
    state: present

- name: Add an Apt signing key, will not download if present
  ansible.builtin.apt_key:
    id: 9FED2BCBDCD29CDF762678CBAED4B06F473041FA
    url: https://ftp-master.debian.org/keys/archive-key-6.0.asc
    state: present

- name: Remove a Apt specific signing key, leading 0x is valid
  ansible.builtin.apt_key:
    id: 0x9FED2BCBDCD29CDF762678CBAED4B06F473041FA
    state: absent

# Use armored file since utf-8 string is expected. Must be of "PGP PUBLIC KEY BLOCK" type.
- name: Add a key from a file on the Ansible server
  ansible.builtin.apt_key:
    data: "{{ lookup('ansible.builtin.file', 'apt.asc') }}"
    state: present

- name: Add an Apt signing key to a specific keyring file
  ansible.builtin.apt_key:
    id: 9FED2BCBDCD29CDF762678CBAED4B06F473041FA
    url: https://ftp-master.debian.org/keys/archive-key-6.0.asc
    keyring: /etc/apt/trusted.gpg.d/debian.gpg

- name: Add Apt signing key on remote server to keyring
  ansible.builtin.apt_key:
    id: 9FED2BCBDCD29CDF762678CBAED4B06F473041FA
    file: /tmp/apt.gpg
    state: present
a�
after:
    description: List of apt key ids or fingerprints after any modification
    returned: on change
    type: list
    sample: ["D8576A8BA88D21E9", "3B4FE6ACC0B21F32", "D94AA3F0EFE21092", "871920D1991BC93C"]
before:
    description: List of apt key ids or fingprints before any modifications
    returned: always
    type: list
    sample: ["3B4FE6ACC0B21F32", "D94AA3F0EFE21092", "871920D1991BC93C"]
fp:
    description: Fingerprint of the key to import
    returned: always
    type: str
    sample: "D8576A8BA88D21E9"
id:
    description: key id from source
    returned: always
    type: str
    sample: "36A1D7869245C8950F966E92D8576A8BA88D21E9"
key_id:
    description: calculated key id, it should be same as 'id', but can be different
    returned: always
    type: str
    sample: "36A1D7869245C8950F966E92D8576A8BA88D21E9"
short_id:
    description: calculated short key id
    returned: always
    type: str
    sample: "A88D21E9"
N)�
format_exc)�	to_native)�
AnsibleModule)�get_best_parsable_locale)�	fetch_urlc��ttd��s+t|��}t|||���t_tjS)N�result)�LANG�LC_ALL�LC_MESSAGES)�hasattr�lang_envr	�dictr)�module�locales  �</usr/lib/python3.11/site-packages/ansible/modules/apt_key.pyrr�s@���8�X�&�&�O�)�&�1�1���F�6�v�N�N�N����?��c�b�|�dd���a|�dd���adS)Nzapt-keyT)�required�gpg)�get_bin_path�apt_key_bin�gpg_bin)rs r�find_needed_binariesr�s8���%�%�i�$�%�?�?�K��!�!�%�$�!�7�7�G�G�Grc�j�dD]%}tj�|��}|rn�&|r|d|zz
}|S)N)�HTTPS_PROXY�https_proxy�
HTTP_PROXY�
http_proxyz" --keyserver-options http-proxy=%s)�os�environ�get)�cmd�envvar�proxys   r�add_http_proxyr)�sU��L�����
���v�&�&���	��E�	�
�<��3�e�;�;���Jrc�D�tt|��d��|���}|�d��r
|dd�}t	|��}|dkr|dkr|dkrtd���|dd�}|}|dkr
|dd�}|||fS)	a�validate the key_id and break it into segments

    :arg key_id: The key_id as supplied by the user.  A valid key_id will be
        8, 16, or more hexadecimal chars with an optional leading ``0x``.
    :returns: The portion of key_id suitable for apt-key del, the portion
        suitable for comparisons with --list-public-keys, and the portion that
        can be used with --recv-key.  If key_id is long enough, these will be
        the last 8 characters of key_id, the last 16 characters, and all of
        key_id.  If key_id is not long enough, some of the values will be the
        same.

    * apt-key del <= 1.10 has a bug with key_id != 8 chars
    * apt-key adv --list-public-keys prints 16 chars
    * apt-key adv --recv-key can take more chars

    ��0X�N�z=key_id must be 8, 16, or 16+ hexadecimal characters in length���i�)�intr�upper�
startswith�len�
ValueError)�key_id�
key_id_len�short_key_id�fingerprints    r�parse_key_idr9�s���$�	�&���2����
�\�\�^�^�F�
��������������V���J��a���J�"�,�,�*��2B�2B��X�Y�Y�Y��"�#�#�;�L��K��B����S�T�T�l����f�,�,rFc��g}t|���d��}|D]�}|�d��s|�d��r�d|vr�	|���}|d}|�d��\}}nN#ttf$r:	|�d��}|d}n#ttf$rYY��wxYwYnwxYw|�|����|r|rt
|��}|S)	N�
�pub�sub�expired��/�:�)r�splitr2�
IndexErrorr4�append�shorten_key_ids)	�output�short_format�found�lines�line�tokens�code�len_type�	real_codes	         r�parse_output_for_keysrP�s7���E��f���#�#�D�)�)�E��$�$���O�O�E�"�"�	$�d�o�o�e�&<�&<�	$�)�SW�BW�BW�
��������a�y��(,�
�
�3���%��9�9���
�+�
�
�
��!�Z�Z��_�_�F� &�q�	�I�I��"�J�/�����H�H������I�	
����
�L�L��#�#�#���'��'���&�&���Ls6�4B
�
C�B=�<C�=C�C�C�C�Cc���|�t�d|�d�}n
dtz}|�|��\}}}|dkr|�d||||���t||��S)N� --keyring z+ adv --list-public-keys --keyid-format=longz-%s adv --list-public-keys --keyid-format=longrzUnable to list public keys��msgr&�rc�stdout�stderr)r�run_command�	fail_jsonrP)r�keyringrHr&rU�out�errs       r�all_keysr]s}����NY�k�k�[b�[b�[b�c���=��K���'�'��,�,�N�R��c�	�Q�w�w����9�s�r�RU�^a��b�b�b� ��l�3�3�3rc�N�g}|D]}|�|dd���� |S)z|
    Takes a list of key ids, and converts them to the 'short' format,
    by reducing them to their last 8 characters.
    r/N)rE)�key_id_list�short�keys   rrFrF"s:��

�E�����
���S����X������Lrc� �	t||d���\}}|ddkr"|�d|�d|d�����|���S#t$r*|�d	|zt	���
��YdSwxYw)NT)�	use_proxy�status��zFailed to download key at z: rT�rTz!error getting key id from url: %s)rT�	traceback)r
rY�read�	Exceptionr)r�url�rsp�infos    r�download_keyrm-s���`��f�c�T�:�:�:�	��T���>�S� � �����s�s�s�D�QV�K�K�!X��Y�Y�Y��x�x�z�z����`�`�`����@�3�F�R\�R^�R^��_�_�_�_�_�_�`���s�AA�0B
�B
c�H�t|��}|�d��dk}d}td|g}|�|t	|��|r|n||���\}}}	|dkr|�d|�dn|z||	���t
|��}
|
r|
d}|S)Nz$-----BEGIN PGP PUBLIC KEY BLOCK-----rz
--with-colons)�environ_update�data�binary_datazUnable to extract key from '%s'zinline data)rTrVrW)r�findrrXrrYrP)r�filenamerp�native_data�
is_armoredrar&rUr[r\�keyss           r�get_key_id_from_filerw:s����D�/�/�K��!�!�"H�I�I�Q�N�J�
�C��O�X�
.�C��'�'��H�V�<L�<L�cm�Tw�T_�T_�sw�KU�GU�'�V�V�N�R��c�	�Q�w�w����>�SW�Sc�-�-�iq�r�{~�HK��	L�	L�	L� ��%�%�D����1�g���Jrc�$�t|d|��S)N�-)rw)rrps  r�get_key_id_from_datarzOs�����T�2�2�2rc���|rt�d|�d|��}nt�d|��}t|��}|�d|��}td��D]2}|�|t	|�����\}}}|dkrni�3|dkr2d|vr.d	|�d
|��}	|�||	t	|�����n0d|�d
|��}	|�||	t	|��|||���dS)NrRz adv --no-tty --keyserver z --recv �)rorr-znot found on keyserverzKey z not found on keyserver )r&rT�forced_environmentzError fetching key z from keyserver: )r&rTr}rUrVrWT)rr)�rangerXrrY)
rrZ�	keyserverr5r&�retryrUr[r\rTs
          r�
import_keyr�Ss7���J�?J�{�{�G�G�G�U^�U^�_���2=�+�+�y�y�I����
�
�C� �C�C���
(�C��q���s�s���+�+�C���@P�@P�+�Q�Q���S�#�
��7�7��E����7�7�/�3�6�6�6�8>���	�	�J�C�����#�(�6�BR�BR��S�S�S�S��@F���	�	�R�C�����#�(�6�BR�BR�WY�be�nq��r�r�r��4rc�n�|�W|rt�d|�d�}n
dtz}|�||d���\}}}|dkr|�d||||���n[|rt�d|�d	|��}nt�d	|��}|�|��\}}}|dkr|�d
|z|||||���dS)NrRz add -z%s add -T)rprqrz$Unable to add a key from binary datarSz add z Unable to add a key from file %s)rTr&rU�keyfilerVrW�rrXrY)rr�rZrpr&rUr[r\s        r�add_keyr�os�����	+�-8�[�[�'�'�'�B�C�C��{�*�C��+�+�C�d��+�M�M���S�#�
��7�7����:�����
�
�
�
���	7�.9�k�k�7�7�7�G�G�L�C�C�!,���g�g�6�C��+�+�C�0�0���S�#�
��7�7����6�'�B������

�
�
�
��4rc��|rt�d|�d|��}nt�d|��}|�|��\}}}|dkr|�d|z|||||���dS)NrRz del rz!Unable to remove a key with id %s)rTr&rUr5rVrWTr�)rr5rZr&rUr[r\s       r�
remove_keyr��s����2�*5�+�+�w�w�w���G���(�[�[�&�&�1���'�'��,�,�N�R��c�	�Q�w�w����3�v�>������
	�	
�	
�	
��4rc�h�tttd���td���td���td���td���tdd���td���tddddg�	���
��dd���}|jd
}|jd}|jd}|jd}|jd}|jd}|jd}d}d}	d}
d}t|��ddi}|sO|r|�d���|rt||��}|rt
||��}n|rt||��}||d
<	t|��\}	}
}|	|d<|
|d<||d<n#t$r|jd(ddi|��YnwxYw|
s|jd(ddi|��t|��dkrd}t|||��x|d <}
g}|dkr�|r|	|
vs|s�|
|
vr�d|d<|js�|rt|||��n^|rt||||��nI|rt|d!||��n4|r#t||��}t|d!||��n|jd(dd"i|��t|||��x|d#<}|r|	|vs|s|
|vr|jd(d|d$zi|��nv|dkrp|s|jd(dd%i|��|
|
vr[d|d<|jsO|	�>t||	|��r-t|||��x|d#<}|
|vr|jd(d|d&zi|��n|jd(dd'i|��|jd(i|��dS))N�str)�type�path�boolT)r��default�present�absent)r�r��choices)�idrjrp�filerZ�validate_certsr�state))rpr�rrj)�
argument_spec�supports_check_mode�mutually_exclusiver�rjrpr�rZr�rFzYapt-key did not return an error, but %s (check that the id is correct and *not* a subkey)�changedz(Missing key_id, required with keyserver.rf�short_id�fpr5rTzInvalid key_idz`Unable to continue as we could not extract a valid fingerprint to compare against existing keys.r.�beforeryz(No key to add ... how did i get here?!?!�afterzfailed to add the keyzkey is required to remove a keyzthe key was not removedzerror removing key_id�)rr�paramsrrYrmrwrzr9r4r3r]�
check_moder�r�r��	exit_json)rr5rjrprsrZr�rrHr7r8�error_no_error�rrv�keys2s               r�mainr��s���
��������%� � � ��5�!�!�!��6�"�"�"��f�%�%�%��V�T�:�:�:���&�&�&��E�9�x��>S�T�T�T�	
�	
�	
�!�B�
�
�
�F� �]�4�
 �F�
�-��
�C��=�� �D��}�V�$�H��m�I�&�G��M�'�"�E��
�k�*�I��L��L��K�p�N��� � � �
�E��A��8��	M����!K��L�L�L��	-����,�,�D��	8�)�&�(�;�;�F�F�
�	8�)�&�$�7�7�F��A�d�G�4�,8��,@�,@�)��k�6�$��*�
���$����(�����4�4�4����3�3�-�3��3�3�3�3�3�4�����F����	F�	F��	F�DE�	F�	F�	F�
�6�{�{�a�����"�&�'�<�@�@�@�A�h�K�$��E��	����	X�\��5�5�|�5�P[�cg�Pg�Pg��A�i�L��$�
X��Z��F�H�g�6�6�6�6��
Z��v�w�	�6�B�B�B�B��Z��F�C��$�7�7�7�7��Z�'���4�4�D��F�C��$�7�7�7�7�$�F�$�Y�Y�)S�Y�WX�Y�Y�Y�&.�f�g�|�%L�%L�L��'�
�U� �X�\��%>�%>��%>�Yd�lq�Yq�Yq�$�F�$�W�W��:Q�)Q�W�UV�W�W�W��	�(�	�	��	I��F��H�H�!B�H�a�H�H�H��$����A�i�L��$�
G� �+�
�6�<�QX�0Y�0Y�+�)1�&�'�<�)P�)P�P�A�g�J��"�e�+�+�(��(�]�]�^�>W�-W�]�[\�]�]�]��$�F�$�F�F�)@�F�A�F�F�F��F����q�����s�*"F
�
F)�(F)�__main__)F)N)&�
__future__rrrr��
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNr#rgr�ansible.module_utils._textr�ansible.module_utils.basicr�"ansible.module_utils.common.localer	�ansible.module_utils.urlsr
rrrrrr)r9rPr]rFrmrwrzr�r�r�r��__name__r�rr�<module>r�s���A�@�@�@�@�@�@�@�@�@��
�E�
�N3��j
��B
�	�	�	�!� � � � � �0�0�0�0�0�0�4�4�4�4�4�4�G�G�G�G�G�G�/�/�/�/�/�/���
��	
�����8�8�8�
�
�
�"-�"-�"-�J����6	4�	4�	4����
`�
`�
`�����*3�3�3����8����B���$l�l�l�^�z����D�F�F�F�F�F��r

Youez - 2016 - github.com/yon3zu
LinuXploit