%PDF- %PDF-
Mini Shell

Mini Shell

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

�

M/�ep>���dZddlZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z!ddl"m#Z#ddl"m Z ddl$m%Z%ejLe'�Z(dZ)ddgZ*Gd�de#jVejX�Z,Gd�d ejZ�Z.Gd!�d"ejZ�Z/d#e0d$e0fd%�Z1y)&zWebroot plugin.�N)�Any)�Callable)�DefaultDict)�Dict)�Iterable)�List)�Optional)�Sequence)�Set)�Type)�Union)�
challenges)�crypto_util)�errors)�
interfaces)�cli)�AnnotatedChallenge)�
filesystem)�os)�ops)�util)�common)�	safe_opena!<?xml version="1.0" encoding="UTF-8" ?>
<!--Generated by Certbot-->
<configuration>
  <system.webServer>
      <staticContent>
          <remove fileExtension="."/>
          <mimeMap fileExtension="." mimeType="text/plain" />
      </staticContent>
  </system.webServer>
</configuration>
�@20c5ca1bd58fa8ad5f07a2f1be8b7cbb707c20fcb607a8fc8db9393952846a97�@8d31383d3a079d2098a9d0c0921f4ab87e708b9868dc3f314d54094c2fe70336c���eZdZdZdZdZdefd�Zede	dddfd	��Z
d
eedefd�Z
dedeeej"fd
�Zdededdf�fd�Zd d�Zdeedeej,fd�Zdeeddfd�Zdedeedeefd�Zdedeedeefd�Zd!dededeefd�Zd d�Zdededefd�Zdedej,fd�Z deeddfd�Z!�xZ"S)"�
AuthenticatorzWebroot Authenticator.z�Saves the necessary validation files to a .well-known/acme-challenge/ directory within the nominated webroot path. A seperate HTTP server must be running and serving files from the webroot path. HTTP challenge only (wildcards not supported).z�Authenticator plugin that performs http-01 challenge by saving
necessary validation resources to appropriate paths on the file
system. It expects that there is some other HTTP server configured
to serve all files under specified web root ({0}).�returnc�V�|jj|jd��S)N�path)�	MORE_INFO�format�conf��selfs �C/usr/lib/python3/dist-packages/certbot/_internal/plugins/webroot.py�	more_infozAuthenticator.more_infoFs ���~�~�$�$�T�Y�Y�v�%6�7�7��add).NNc�F�|ddgtd��|ditd��y)Nr z-wapublic_html / webroot path. This can be specified multiple times to handle different domains; each domain will have the webroot path that preceded it.  For instance: `-w /var/www/example -d example.com -d www.example.com -w /var/www/thing -d thing.net -d m.thing.net` (default: Ask))�default�action�help�mapa�JSON dictionary mapping domains to webroot paths; this implies -d for each entry. You may need to escape this from your shell. E.g.: --webroot-map '{"eg1.is,m.eg1.is":"/www/eg1/", "eg2.is":"/www/eg2"}' This option is merged with, but takes precedence over, -w / -d entries. At present, if you put webroot-map in a config file, it needs to be on a single line, like: webroot-map = {"example.com":"/var/www"}.)�_WebrootPathAction�_WebrootMapAction)�clsr)s  r&�add_parser_argumentsz"Authenticator.add_parser_argumentsIs0���F�D�"�-?�N�	O�	�E�2�&7�/�	0r(�failed_achallsc��y)Nz�The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.�)r%r3s  r&�	auth_hintzAuthenticator.auth_hint[s��%r(�domainc�$�tjgS�N)r�HTTP01)r%r7s  r&�get_chall_prefzAuthenticator.get_chall_prefas���!�!�"�"r(�args�kwargsc�|��t�|�|i|��i|_tjt
�|_g|_yr9)�super�__init__�
full_roots�collections�defaultdict�set�	performed�
_created_dirs�r%r<r=�	__class__s   �r&r@zAuthenticator.__init__es7���
���$�)�&�)�*,���DO�D[�D[�\_�D`���(*��r(c��yr9r5r$s r&�preparezAuthenticator.preparels��r(�achallsc��|j|�|j�|D�cgc]}|j|���c}Scc}wr9)�
_set_webroots�_create_challenge_dirs�_perform_single)r%rK�achalls   r&�performzAuthenticator.performos;�����7�#��#�#�%�;B�C���$�$�V�,�C�C��Cs�Ac�f�|jd�r]|jd�d}tjd|�|D]-}|jd�j|j|��/ytt
|jd�j���}|D]~}|j|jd�vs�!|j|j|�}	|j|�|jd|�||jd�|j<��y#t$rY�>wxYw)Nr ���z4Using the webroot path %s for all unmatched domains.r.r)r#�logger�info�
setdefaultr7�listrD�values�_prompt_for_webroot�remove�
ValueError�insert)r%rK�webroot_pathrP�known_webroots�new_webroots      r&rMzAuthenticator._set_webrootsvs���9�9�V���9�9�V�,�R�0�L��K�K�N�$�
&�!�
I���	�	�%� �+�+�F�M�M�<�H�
I�"�#�d�i�i��&6�&=�&=�&?�"@�A�N�!�
B���=�=��	�	�%�(8�8�"&�":�":�6�=�=�;I�#K�K��&�-�-�k�:�#�)�)�!�[�9�6A�D�I�I�e�$�V�]�]�3�
B��&����s� D$�$	D0�/D0r^c��d}|�=|r&|j||�}|�$|j|�}n|j|d�}|��=|S)NT)�_prompt_with_webroot_list�_prompt_for_new_webroot)r%r7r^�webroots    r&rYz!Authenticator._prompt_for_webroot�sX�����o���8�8���P���?�"�:�:�6�B�G��6�6�v�t�D���o��r(c��d|jd�z}	tjdj|�dg|z|d��\}}|tjk(rtjd��|dk(rdS||d	z
S)
Nz--r TzSelect the webroot for {0}:zEnter a new webroot)�cli_flag�force_interactive�IEvery requested domain must have a webroot when using the webroot plugin.r�)�option_name�display_util�menur"�CANCELr�PluginError)r%r7r^�	path_flag�code�indexs      r&raz'Authenticator._prompt_with_webroot_list�s����4�+�+�F�3�3�	��&�+�+�-�4�4�V�<�&�'�.�8�"�d�<�K�D�%��|�*�*�*��(�(�=�>�>�!�A�:�4�D�>�%�!�)�+D�Dr(�
allowraisec���tjtdj|�d��\}}|tj
k(r|syt
jd��t|�S)NzInput the webroot for {0}:T)rfrg)r�validated_directory�_validate_webrootr"rjrlrrm)r%r7rqrorcs     r&rbz%Authenticator._prompt_for_new_webroot�se���/�/��(�/�/��7�"�$�
��g��<�&�&�&����$�$�9�:�
:�!��)�)r(c
���|jd�}|stjd��|j�D�]"\}}tj
j
|tj
jtjj��|j|<tjd|j|�tjd�5t!t#j$|j|�ddt&��D]o}tj
j)|�r�#	tj*|d�|j,j/|�	tj0||ddd�	��q	ddd�tj:r��ctj
j
|j|d
�}tj
j=|�r%tj?d|j|����tj?d|j|�tA|dd��5}|jCtD�ddd���%y#t2t4f$r6}tj7d
�tjd|�Yd}~��!d}~wwxYw#t2$r*}tjdj9||���d}~wwxYw#1swY��^xYw#1swY���xYw)Nr.z�Missing parts of webroot configuration; please set either --webroot-path and --domains, or --webroot-map. Run with  --help webroot for examples.z-Creating root challenges validation dir at %s�rS)�keyi�T)�	copy_user�
copy_groupz3Unable to change owner and uid of webroot directory�
Error was: %sz=Couldn't create root for {0} http-01 challenge responses: {1}�
web.configzPA web.config file has not been created in %s because another one already exists.zGCreating a web.config file in %s to allow IIS to serve challenge files.�w���mode�chmod)#r#rrm�itemsrr �join�normcaserr:�
URI_ROOT_PATHrArT�debugr�
temp_umask�sortedr�get_prefixes�len�isdir�mkdirrF�append�copy_ownership_and_apply_mode�OSError�AttributeError�warningr"�
POSIX_MODE�existsrUr�write�_WEB_CONFIG_CONTENT)r%�path_map�namer �prefix�	exception�web_config_path�
web_configs        r&rNz$Authenticator._create_challenge_dirs�s����9�9�U�#����$�$�0�1�
1�#�.�.�*�.	:�J�D�$�$&�G�G�L�L��r�w�w�7G�7G��!�!�/�/�81�%2�D�O�O�D�!��L�L�H�����.�
0��&�&�u�-�
P�%�T�%6�%6�t���t�7L�%M�c�r�%R�X[�\�P�F��w�w�}�}�V�,�!�P�
#�(�(���7��*�*�1�1�&�9�E�&�D�D� $�f�e�t�PT�V��P�
P�8�(�(�"$�'�'�,�,�t���t�/D�l�"S���7�7�>�>�/�2��K�K�!I�JN�/�/�Z^�J_�a�����8�9=����9N�P���S��F�:�*��$�$�%8�9�:�:�[.	:��6!(��8�E�"�N�N�+`�a�"�L�L��)�D�D��E��#�P�$�0�0�7�7=�v�d�I�7N�P�P��P��+
P�
P��H:�:�sa�AK�31J(�%I �?K�>K+� J%	�/+J 	�J(� J%	�%J(�(	K	�1%K	�K	�K�K(	�+K5	�	root_pathrPc�t�tjj||jj	d��S)N�token)rr r��chall�encode)r%r�rPs   r&�_get_validation_pathz"Authenticator._get_validation_path�s&���w�w�|�|�I�v�|�|�':�':�7�'C�D�Dr(c���|j�\}}|j|j}|j||�}tjd|�t
jd�5t|dd��5}|j|j��ddd�ddd�|j|j|�|S#1swY�1xYw#1swY�5xYw)Nz#Attempting to save validation to %srv�wbr}r~)
�response_and_validationrAr7r�rTr�rr�rr�r�rEr))r%rP�response�
validationr��validation_path�validation_files       r&rOzAuthenticator._perform_single�s���%�=�=�?���*��O�O�F�M�M�2�	��3�3�I�v�F�����:�O�L��
"�
"�5�
)�	;��?��U�C�
;���%�%�j�&7�&7�&9�:�
;�	;�	
���y�!�%�%�f�-���	
;�
;��	;�	;�s$�*C�9 C	�C�	C	�C�Cc��|D�]8}|jj|jd�}|��-|j||�}tjd|�t
j|�|j|j|�tjr��tjj|d�}tjj|�s��tj|�}|t vr-tj#d|�t
j|���#tj#d|���;g}|j$r=|j$j'�}	t
j(|�|j$r�=||_tjd�y#t*$rH}	|j-d|�tj#d|�tjd|	�Yd}	~	�vd}	~	wwxYw)	NzRemoving %sr{z4Cleaning web.config file generated by Certbot in %s.zQNot cleaning up the web.config file in %s because it is not generated by Certbot.rz3Challenge directory %s was not empty, didn't removerzzAll challenges cleaned up)rA�getr7r�rTr�rrZrErr�r r�r�r�	sha256sum�_WEB_CONFIG_SHA256SUMSrUrF�pop�rmdirr�r\)
r%rKrPr�r�r�r��not_removedr �excs
          r&�cleanupzAuthenticator.cleanups����	^�F����+�+�F�M�M�4�@�I��$�"&�";�";�I�v�"N�����]�O�<��	�	�/�*����y�)�0�0��8�!�,�,�&(�g�g�l�l�9�l�&K�O��w�w�~�~�o�6�$/�$9�$9�/�$J�	�$�(>�>�"�K�K�(^�(1�3��I�I�o�6�"�K�K�)R�S\�^�#	^�("$��� � ��%�%�)�)�+�D�
3������� � �)������0�1���
3��"�"�1�d�+����Q�SW�X����_�c�2�2��
3�s�(F'�'	G8�0>G3�3G8)rN)F)#�__name__�
__module__�__qualname__�__doc__�descriptionr!�strr'�classmethodrr2rrr6rrr�	Challenger;rr@rJ�ChallengeResponserQrMr	rYra�boolrbrNr�rOr��
__classcell__�rHs@r&rr8s���� �@�K�
6�I�8�3�8��0�x�	�':�0�t�0��0�"&��-?�(@�&�S�&�#�S�#�X�d�:�;O�;O�6P�-Q�#�+�c�+�S�+�T�+�
�D�t�$6�7�D�D��A]�A]�<^�D�B�X�.@�%A�B�d�B�,
�#�
�t�C�y�
�X�VY�]�
�
E��
E�26�s�)�
E�@H��
�
E�*�c�*�t�*�PX�Y\�P]�*�5:�nE�c�E�;M�E�RU�E�
�&8�
�Z�=Y�=Y�
�2�t�$6�7�2�D�2r(rc�p�eZdZdZ	d	dej
dejdeee	e
dfdeeddf
d�Zy)
r0z%Action class for parsing webroot_map.N�parser�	namespace�webroot_map�
option_stringrc���|�ytjt|��j�D]H\}�t	���|j
j
�fd�tj||�D���Jy)Nc3�&�K�|]}|�f���
y�wr9r5)�.0�dr]s  �r&�	<genexpr>z-_WebrootMapAction.__call__.<locals>.<genexpr>,s�����)P�&'��L�!�)P�s�)	�json�loadsr�r�rtr��updater�add_domains)r%r�r�r�r��domainsr]s      @r&�__call__z_WebrootMapAction.__call__%st������%)�Z�Z��K�0@�%A�%G�%G�%I�	P�!�G�\�,�\�:�L��!�!�(�(�)P�+.�?�?�9�g�+N�)P�
P�	Pr(r9)
r�r�r�r��argparse�ArgumentParser�	Namespacer
r�r
rr	r�r5r(r&r0r0"s[��/�15�P�x�6�6�P�8�CU�CU�P�#�C��#���$<�=�P� (��
�P�9=�Pr(r0c���eZdZdZdededdf�fd�Z	ddejdejd	e	e
eedfd
ee
ddf
d�Z
�xZS)
r/z&Action class for parsing webroot_path.r<r=rNc�2��t�|�|i|��d|_y)NF)r?r@�_domain_before_webrootrGs   �r&r@z_WebrootPathAction.__init__3s���
���$�)�&�)�&+��#r(r�r�r]r�c�^�|�y|jrtjd��|jr=|jd}|jD]}|j
j
||�� n|jrd|_|jjtt|���y)NzPIf you specify multiple webroot paths, one of them must precede all domain flagsrST)
r�rrmr]r�r�rVr�rtr�)r%r�r�r]r��prev_webrootr7s       r&r�z_WebrootPathAction.__call__7s�������&�&��$�$�<�=�
=��!�!�%�1�1�"�5�L�#�+�+�
G���%�%�0�0���F�
G�
�
�
�*.�D�'����%�%�&7��L�8I�&J�Kr(r9)r�r�r�r�rr@r�r�r�r
r�r
r	r�r�r�s@r&r/r/0sv���0�,�c�,�S�,�T�,�15�L�x�6�6�L�8�CU�CU�L�$�S�(�3�-��%=�>�L� (��
�L�9=�Lr(r/r]rc��tjj|�stj|dz��tjj|�S)z�Validates and returns the absolute path of webroot_path.

    :param str webroot_path: path to the webroot directory

    :returns: absolute path of webroot_path
    :rtype: str

    z% does not exist or is not a directory)rr r�rrm�abspath)r]s r&rtrtMs>���7�7�=�=��&�� � ��0W�!W�X�X�
�7�7�?�?�<�(�(r()2r�r�rBr��logging�typingrrrrrrr	r
rrr
�acmer�certbotrrr�certbot._internalr�certbot.achallengesr�certbot.compatrr�certbot.displayrrrj�certbot.pluginsr�certbot.utilr�	getLoggerr�rTr�r��Pluginr�Actionr0r/r�rtr5r(r&�<module>r�s�����������������������!�2�%���0�"� �"�	��	�	�8�	$���� G�F���g2�F�M�M�:�#;�#;�g2�TP����P�L����L�:)�C�)�C�)r(

Zerion Mini Shell 1.0