%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/certbot/_internal/plugins/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/certbot/_internal/plugins/__pycache__/manual.cpython-312.pyc

�

M/�e�.��d�dZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l
mZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZej>e �Z!Gd�dejDejF�Z#y)zManual authenticator plugin�N)�Any)�Callable)�Dict)�Iterable)�List)�Tuple)�Type)�
challenges)�achallenges)�errors)�
interfaces)�reverter)�util)�hooks)�
cli_constants)�misc)�os)�ops)�commonc����eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ededd
f�fd�Z
ededdd
fd��Zd#d�Zd#d�Zdefd�Zdeej.defd�Zdedeeej6fd�Zdeej.deej<fd�Zdej.deej.dd
fd�Z 	d$dej.de!dd
fd�Z"deej.dd
fd�Z#d ed!ede$eeffd"�Z%�xZ&S)%�
Authenticatorz�Manual authenticator

    This plugin allows the user to perform the domain validation
    challenge(s) themselves. This either be done manually by the user or
    through shell scripts provided to Certbot.

    z2Manual configuration or run your own shell scriptsTa�Authenticate through manual configuration or custom shell scripts. When using shell scripts, an authenticator script must be provided. The environment variables available to this script depend on the type of challenge. $CERTBOT_DOMAIN will always contain the domain being authenticated. For HTTP-01 and DNS-01, $CERTBOT_VALIDATION is the validation string, and $CERTBOT_TOKEN is the filename of the resource requested when performing an HTTP-01 challenge. An additional cleanup script can also be provided and can use the additional variable $CERTBOT_AUTH_OUTPUT which contains the stdout output from the auth script. For both authenticator and cleanup script, on HTTP-01 and DNS-01 challenges, $CERTBOT_REMAINING_CHALLENGES will be equal to the number of challenges that remain after the current one, and $CERTBOT_ALL_DOMAINS contains a comma-separated list of all domains that are challenged for the current certificate.zcPlease deploy a DNS TXT record under the name:

{domain}.

with the following value:

{validation}
a�
Before continuing, verify the TXT record has been deployed. Depending on the DNS
provider, this may take some time, from a few seconds to multiple minutes. You can
check if it has finished deploying with aid of online tools, such as the Google
Admin Toolbox: https://toolbox.googleapps.com/apps/dig/#TXT/{domain}.
Look for one or more bolded line(s) below the line ';ANSWER'. It should show the
value(s) you've just added.
zuCreate a file containing just this data:

{validation}

And make it available on your web server at this URL:

{uri}
z�
(This must be set up in addition to the previous challenges; do not remove,
replace, or undo the previous challenge tasks yet.)
z�
(This must be set up in addition to the previous challenges; do not remove,
replace, or undo the previous challenge tasks yet. Note that you might be
asked to create multiple distinct TXT records with the same name. This is
permitted by DNS standards.)
�args�kwargs�returnNc����t�|�|i|��tj|j�|_|jj�i|_d|_d|_y)NF)	�super�__init__r�Reverter�config�recovery_routine�env�subsequent_dns_challenge�subsequent_any_challenge)�selfrr�	__class__s   ��B/usr/lib/python3/dist-packages/certbot/_internal/plugins/manual.pyrzAuthenticator.__init__asR���
���$�)�&�)� �)�)�$�+�+�6��
��
�
�&�&�(�IK���(-��%�(-��%��add).Nc�Z�|dd��|dd��tj|dd�y)N�	auth-hookz8Path or command to execute for the authentication script)�help�cleanup-hookz1Path or command to execute for the cleanup scriptzpublic-ip-logging-okr)r�add_deprecated_argument)�clsr(s  r&�add_parser_argumentsz"Authenticator.add_parser_argumentsis1���K�K�	M��N�D�	F��$�$�S�*@�!�Dr'c���|jjrD|jd�s3tjdj|j
d����|j�y)Nr*zdAn authentication script must be provided with --{0} when using the manual plugin non-interactively.)r�noninteractive_mode�confr�PluginError�format�option_name�_validate_hooks�r$s r&�preparezAuthenticator.prepareqsX���;�;�*�*�4�9�9�[�3I��$�$�=�=C�V��$�$�[�1�>3�4�
4�	
���r'c���|jjrPdD]J}|j|�}|��|j|�dt	d�}tj||��Lyy)N)r*r,z-hook)r�validate_hooksr2r5�lenr�
validate_hook)r$�name�hook�hook_prefixs    r&r6zAuthenticator._validate_hooksysc���;�;�%�%�5�
;���y�y�����#�"&�"2�"2�4�"8��3�w�<�-�"H�K��'�'��k�:�	
;�&r'c��	y)Nz�This plugin allows the user to customize setup for domain validation challenges either through shell scripts provided by the user or by performing the setup manually.�r7s r&�	more_infozAuthenticator.more_info�s��
<�	=r'�failed_achallsc���dttjdtf�fd�}|tj�}tjdtj
dtjdi}djt|j�D��cgc]\}}||�s�|��c}}��}|jd�r+d	jtj||rd
��Sd��Sd
j||rd��Sd��Scc}}w)Nr.rc�.���t�fd��D��S)Nc3�J�K�|]}t|j�����y�w�N)�
isinstance�chall)�.0�achallr.s  �r&�	<genexpr>z=Authenticator.auth_hint.<locals>.has_chall.<locals>.<genexpr>�s�����R��z�&�,�,��4�R�s� #)�any)r.rCs`�r&�	has_challz*Authenticator.auth_hint.<locals>.has_chall�s����R�>�R�R�Rr'zDNS TXT recordszchallenge fileszTLS-ALPN certificatesz and r*z�The Certificate Authority failed to verify the {resources} created by the --manual-auth-hook. Ensure that this hook is functioning correctly{dns_hint}. Refer to "{certbot} --help manual" and the Certbot User Guide.zD and that it waits a sufficient duration of time for DNS propagation�)�certbot�	resources�dns_hintz�The Certificate Authority failed to verify the manually created {resources}. Ensure that you created these in the correct location{dns_hint}.z?, or try waiting longer for DNS propagation on the next attempt)rQrR)r	r
�	Challenge�bool�DNS01�HTTP01�	TLSALPN01�join�sorted�itemsr2r4r�cli_command)r$rCrN�has_dns�resource_names�k�vrQs `      r&�	auth_hintzAuthenticator.auth_hint�s,���	S�4�
� 4� 4�5�	S�$�	S��J�,�,�-�����/����0�� � �"9�
��
�L�L��~�7K�7K�7M�(^�t�q�!�QZ�[\�Q]��(^�!_�`�	��9�9�[�!�Q���)�5�5�'�!�_�	��	
�')���	
�S���'�"�Z���	
�(*�	��	
��!)_s�D	�!D	�domainc�B�tjtjgSrG)r
rVrU)r$ras  r&�get_chall_prefzAuthenticator.get_chall_pref�s���!�!�:�#3�#3�4�4r'�achallsc�n�g}d}t|�D],\}}t|jtj�s�+|}�.t|�D]h\}}|jd�r|j
||�n|j|||k(�|j|j|j���j|S)Nrr*)�	enumeraterHrIr
rUr2�_perform_achall_with_script�_perform_achall_manually�append�response�account_key)r$rd�	responses�last_dns_achall�irKs      r&�performzAuthenticator.perform�s����	���"�7�+�	$�I�A�v��&�,�,�
�(8�(8�9�"#��	$�#�7�+�	B�I�A�v��y�y��%��0�0���A��-�-�f�a�?�6J�K����V�_�_�V�-?�-?�@�A�	B��r'rKc	�X�|j|j|j�djd�|D��t	t|�|j
|�z
dz
�d�}t|jtj�r|jjd�|d<n tjjdd�tjj|�|j!d|j�\}}|j#�|d<||j$|<y)	N�,c3�4K�|]}|j���y�wrG�ra)rJ�
one_achalls  r&rLz<Authenticator._perform_achall_with_script.<locals>.<genexpr>�s����+X�*�J�,=�,=�+X�s��)�CERTBOT_DOMAIN�CERTBOT_VALIDATION�CERTBOT_ALL_DOMAINS�CERTBOT_REMAINING_CHALLENGES�token�
CERTBOT_TOKENr*�CERTBOT_AUTH_OUTPUT)ra�
validationrkrX�strr;�indexrHrIr
rV�encoder�environ�pop�update�
_execute_hook�stripr!)r$rKrdr!�_�outs      r&rgz)Authenticator._perform_achall_with_script�s���%�m�m�"(�"3�"3�F�4F�4F�"G�#&�8�8�+X�PW�+X�#X�,/��G��w�}�}�V�?T�0T�WX�0X�,Y�	
���f�l�l�J�$5�$5�6�#)�<�<�#6�#6�w�#?�C�� ��J�J�N�N�?�D�1�
�
�
���#���#�#�K����?���3�%(�Y�Y�[��!�"������r'rmc���|j|j�}t|jtj
�rq|jj||jjd�|jj|jj|j�|��}n\t|jtj�sJ�|jj|j|j�|��}t|jtj�ry|j r||j"z
}n|j$r||j&z
}d|_|rT||j(j|j|j���z
}n|j$r||j&z
}t+j,|dd��d|_y)Nrz)rK�
encoded_token�port�urir})rar}TrsF)�wrap�force_interactive)r}rkrHrIr
rV�_HTTP_INSTRUCTIONSr4r�r�http01_portr�rarU�_DNS_INSTRUCTIONS�validation_domain_namer"�&_SUBSEQUENT_DNS_CHALLENGE_INSTRUCTIONSr#�"_SUBSEQUENT_CHALLENGE_INSTRUCTIONS�_DNS_VERIFY_INSTRUCTIONS�display_util�notification)r$rKrmr}�msgs     r&rhz&Authenticator._perform_achall_manually�s����&�&�v�'9�'9�:�
��f�l�l�J�$5�$5�6��)�)�0�0��V�\�\�-@�-@��-I��[�[�,�,��L�L�$�$�V�]�]�3�
�1�L�C�
�f�l�l�J�,<�,<�=�=�=��(�(�/�/��4�4�V�]�]�C�%�0�'�C��f�l�l�J�$4�$4�5��,�,��t�B�B�B���.�.��t�>�>�>��,0�D�)���t�4�4�;�;�!�8�8����G�<�I�I��
�
*�
*��4�:�:�:�C��!�!�#�E�T�J�(,��%r'c�\�|jd�r�|D]|}|jj|�}d|vr tjjdd�tjj|�|j
d|j��~|jj�y)Nr,r{)
r2r!r�rr�r�r�rarr )r$rdrKr!s    r&�cleanupzAuthenticator.cleanup�s����9�9�^�$�!�
B���h�h�l�l�6�*��"�#�-��J�J�N�N�?�D�9��
�
�!�!�#�&��"�"�>�6�=�=�A�
B�	
�
�
�&�&�(r'�	hook_name�
achall_domainc���tj|j|�|j|�t	j
���\}}}t
jd|�d|��|||�||fS)N)r!zHook '--manual-z' for )r�execute_command_statusr5r2r�env_no_snap_for_external_calls�display_ops�report_executed_command)r$r�r��
returncode�errr�s      r&r�zAuthenticator._execute_hook�sq��#�:�:����Y�'����9�)=��3�3�5� 
��
�C��
	�+�+��i�[��}�o�>�
�C�QT�	V��C�x�r')rN)F)'�__name__�
__module__�__qualname__�__doc__�description�hidden�long_descriptionr�r�r�r�r�rr�classmethodrr/r8r6r~rBrr�AnnotatedChallenger`r	r
rSrcr�ChallengeResponserorgrTrhr�rr��
__classcell__)r%s@r&rrs�����G�K�
�F�	O��*�� ����*�&�.�*�.�c�.�S�.�T�.��E�x�	�':�E�t�E��E��;�=�3�=�#���1O�1O�(P�#�UX�#�J5�S�5�X�d�:�;O�;O�6P�-Q�5�
�t�K�$B�$B�C�
��*�6�6�7�
��+�2P�2P��-1�+�2P�2P�-Q��VZ��$:?�-�{�/M�/M�-�26�-�CG�-�@)�x��(F�(F�G�)�D�)�	�s�	�3�	�5��c��?�	r'r)$r��logging�typingrrrrrrr	�acmer
rPrrr
rr�certbot._internalr�certbot._internal.clir�certbot.compatrr�certbot.displayrr�r��certbot.pluginsr�	getLoggerr��logger�PluginrrAr'r&�<module>r�ss��!���������������#�/���.�0�"�	��	�	�8�	$��g�F�M�M�:�#;�#;�gr'

Zerion Mini Shell 1.0