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__/rpm_key.cpython-311.opt-1.pyc
�

���c�!���ddlmZmZmZeZdZdZdZddl	Z	ddl
ZddlZddl
mZddlmZddlmZd	�ZGd
�de��Zd�Zed
kre��dSdS)�)�absolute_import�division�print_functiona
---
module: rpm_key
author:
  - Hector Acosta (@hacosta) <hector.acosta@gazzang.com>
short_description: Adds or removes a gpg key from the rpm db
description:
  - Adds or removes (rpm --import) a gpg key to your rpm database.
version_added: "1.3"
options:
    key:
      description:
        - Key that will be modified. Can be a url, a file on the managed node, or a keyid if the key
          already exists in the database.
      type: str
      required: true
    state:
      description:
        - If the key will be imported or removed from the rpm db.
      type: str
      default: present
      choices: [ absent, present ]
    validate_certs:
      description:
        - If C(false) and the C(key) is a url starting with https, SSL certificates will not be validated.
        - This should only be used on personally controlled sites using self-signed certificates.
      type: bool
      default: 'yes'
    fingerprint:
      description:
        - The long-form fingerprint of the key being imported.
        - This will be used to verify the specified key.
      type: str
      version_added: 2.9
extends_documentation_fragment:
    - action_common_attributes
attributes:
    check_mode:
        support: full
    diff_mode:
        support: none
    platform:
        platforms: rhel
a
- name: Import a key from a url
  ansible.builtin.rpm_key:
    state: present
    key: http://apt.sw.be/RPM-GPG-KEY.dag.txt

- name: Import a key from a file
  ansible.builtin.rpm_key:
    state: present
    key: /path/to/key.gpg

- name: Ensure a key is not present in the db
  ansible.builtin.rpm_key:
    state: absent
    key: DEADB33F

- name: Verify the key, using a fingerprint, before import
  ansible.builtin.rpm_key:
    key: /path/to/RPM-GPG-KEY.dag.txt
    fingerprint: EBC6 E12C 62B1 C734 026B  2122 A20E 5214 6B8D 79E6
�#N)�
AnsibleModule)�	fetch_url)�	to_nativec	�~�d}ttj|t|d���tj����S)zVerifies if string is a pubkeyzP.*?(-----BEGIN PGP PUBLIC KEY BLOCK-----.*?-----END PGP PUBLIC KEY BLOCK-----).*�surrogate_or_strict)�errors)�bool�re�matchr	�DOTALL)�string�	pgp_regexs  �</usr/lib/python3.11/site-packages/ansible/modules/rpm_key.py�	is_pubkeyr[s5��b�I�����I�f�=R�$S�$S�$S�UW�U^�_�_�`�`�`�c�J�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�RpmKeyc�R�d}d}||_|j�dd��|_|jd}|jd}|jd}|r(|�dd�����}|j�d	��|_|js!|j�d
d���|_d|vr-|�|��}|�|��}d}nm|�	|��r|}nUtj�|��r|}|�|��}n|j�
d
|z���|�|��}|dkr�|�|��r|�d���dS|s|j�
d���|r=|�|��}||kr"|j�
d|�d|�d����|�|��|r|j�|��|�d���dS|�|��r-|�|��|�d���dS|�d���dS)NF�rpmT�state�key�fingerprint� ��gpg�gpg2)�requiredz://zNot a valid key %s��msg�present)�changedz0When importing a key, a valid file must be givenzThe specified fingerprint, 'z'', does not match the key fingerprint '�')�module�get_bin_pathr�params�replace�upperr�	fetch_key�getkeyid�is_keyid�os�path�isfile�	fail_json�normalize_keyid�is_key_imported�	exit_json�getfingerprint�
import_key�cleanup�drop_key)	�selfr'�keyfile�should_cleanup_keyfilerrr�keyid�has_fingerprints	         r�__init__zRpmKey.__init__cs�����!&������;�+�+�E�4�8�8����
�g�&���m�E�"���m�M�2���	?�%�-�-�c�2�6�6�<�<�>�>�K��;�+�+�E�2�2����x�	G��{�/�/���/�F�F�D�H��C�<�<��n�n�S�)�)�G��M�M�'�*�*�E�%)�"�"�
�]�]�3�
�
�	B��E�E�
�W�^�^�C�
 �
 �	B��G��M�M�'�*�*�E�E��K�!�!�&:�S�&@�!�A�A�A��$�$�U�+�+���I����#�#�E�*�*�
/�� � �� �/�/�/�/�/��b��K�)�)�.`�)�a�a�a���&*�&9�&9�'�&B�&B�O�"�o�5�5���-�-�-�ny�ny�ny�|K�|K�|K�!L�.��������(�(�(�)�1��K�'�'��0�0�0�� � �� �.�.�.�.�.��#�#�E�*�*�
0��
�
�e�$�$�$�� � �� �.�.�.�.�.�� � �� �/�/�/�/�/rc��t|j|��\}}|ddkr'|j�d|�d|d�����|���}t	|��s|j�d|z���tj��\}}|j�|��tj	|d��}|�
|��|���|S)	z;Downloads a key from url, returns a valid path to a gpg key�status��zfailed to fetch key at z , error was: r#r"zNot a public key: %szw+b)rr'r2�readr�tempfile�mkstemp�add_cleanup_filer/�fdopen�write�close)r:�url�rsp�infor�tmpfd�tmpname�tmpfiles        rr,zRpmKey.fetch_key�s����d�k�3�/�/�	��T���>�S� � ��K�!�!�!�UX�UX�UX�Z^�_d�Ze�Ze�&f�!�g�g�g��h�h�j�j����~�~�	D��K�!�!�&<�s�&B�!�C�C�C�!�)�+�+���w���$�$�W�-�-�-��)�E�5�)�)���
�
�c�����
�
�����rc���|������}|�d��r
|dd�S|�d��r
|dd�S|S)zhEnsure a keyid doesn't have a leading 0x, has leading or trailing whitespace, and make sure is uppercase�0x�N�0X)�stripr+�
startswith)r:r=�rets   rr3zRpmKey.normalize_keyid�sb���k�k�m�m�!�!�#�#���>�>�$���	��q�r�r�7�N�
�^�^�D�
!�
!�	��q�r�r�7�N��Jrc�<�|�|jdddd|g��\}}|���D]H}|���}|�d��r|�d��dcS�I|j�d�	��dS)
N�--no-tty�--batch�
--with-colons�--fixed-list-modezpub:�:��Unexpected gpg outputr"��execute_commandr�
splitlinesrTrU�splitr'r2�r:r;�stdout�stderr�lines     rr-zRpmKey.getkeyid�s����-�-�t�x��Y�P_�at�v}�.~�������%�%�'�'�	*�	*�D��:�:�<�<�D����v�&�&�
*��z�z�#���q�)�)�)�)�
*�	
����"9��:�:�:�:�:rc	�>�|�|jddddd|g��\}}|���D]H}|���}|�d��r|�d��dcS�I|j�d	�
��dS)NrXrYrZr[z--with-fingerprintzfpr:r\�	r^r"r_rcs     rr6zRpmKey.getfingerprint�s����-�-��H�j�)�_��!5�w�/
�������%�%�'�'�	*�	*�D��:�:�<�<�D����v�&�&�	
*��z�z�#���q�)�)�)�)�	
*�	
����"9��:�:�:�:�:rc�D�tjd|tj���S)z5Verifies if a key, as provided by the user is a keyidz(0x)?[0-9a-f]{8})�flags)rr�
IGNORECASE)r:�keystrs  rr.zRpmKey.is_keyid�s���x�*�F�"�-�H�H�H�Hrc��|j�|d���\}}}|dkr|j�|���||fS)NT)�use_unsafe_shellrr")r'�run_commandr2)r:�cmd�rcrdres     rr`zRpmKey.execute_command�sO��!�[�4�4�S�4�4�P�P���F�F�
��7�7��K�!�!�f�!�-�-�-��v�~�rc�$�|jdz}|j�|��\}}}|dkrdS|d|jzdzz
}|�|��\}}|���D]"}||�d��dvrdS�#dS)	Nz -q  gpg-pubkeyrFz --qf "%{description}" | z3 --no-tty --batch --with-colons --fixed-list-mode -r\r]T)rr'rorr`rarb)r:r=rprqrdrerfs       rr4zRpmKey.is_key_imported�s����h�*�*��!�[�4�4�S�9�9���F�F�
��7�7��5��*�T�X�5�8m�m�m���-�-�c�2�2�����%�%�'�'�	�	�D���
�
�3����*�*�*��t�t�+��urc�\�|jjs|�|jd|g��dSdS)Nz--import)r'�
check_moder`r)r:r;s  rr7zRpmKey.import_key�s?���{�%�	B�� � �$�(�J��!@�A�A�A�A�A�	B�	Brc	��|jjs=|�|jddd|dd����zg��dSdS)Nz--erasez--allmatchesz
gpg-pubkey-%si����)r'rtr`r�lower)r:r=s  rr9zRpmKey.drop_key�s_���{�%�	n�� � �$�(�I�~��Y^�_a�_b�_b�Yc�Yi�Yi�Yk�Yk�Gk�!l�m�m�m�m�m�	n�	nrN)
�__name__�
__module__�__qualname__r?r,r3r-r6r.r`r4r7r9�rrrras�������30�30�30�j��� ���;�;�;�;�;�;�(I�I�I����
�
�
�B�B�B�n�n�n�n�nrrc���tttddddg���tddd���td���td	d�
�����d���}t|��dS)
N�strr$�absent)�type�default�choicesTF)r~r!�no_log)r~r
)r~r)rrr�validate_certs)�
argument_spec�supports_check_mode)r�dictr)r's r�mainr��s���
���E�9�x��>S�T�T�T��%�$�u�=�=�=��%�(�(�(��V�T�:�:�:�	
�
�
�!����F��6�N�N�N�N�Nr�__main__)�
__future__rrrr~�
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNr�os.pathr/rD�ansible.module_utils.basicr�ansible.module_utils.urlsr�ansible.module_utils._textr	r�objectrr�rwrzrr�<module>r�s��A�@�@�@�@�@�@�@�@�@��
�+�
�Z��,
��	�	�	�	���������5�4�4�4�4�4�/�/�/�/�/�/�0�0�0�0�0�0�a�a�a�Jn�Jn�Jn�Jn�Jn�V�Jn�Jn�Jn�Z����z����D�F�F�F�F�F��r

Youez - 2016 - github.com/yon3zu
LinuXploit