/
proc
/
self
/
root
/
lib
/
python3
/
dist-packages
/
certbot_apache
/
_internal
/
__pycache__
/
Upload File
HOME
� E��c� � �� � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddl m Z ddlmZ dd l mZ dd lmZ ddlmZ ddlmZ dd lmZ erddlmZ ej e� � Z G d� dej � � ZdS )z3A class that performs HTTP-01 challenges for Apache� N)�List)�Set)� TYPE_CHECKING)�VirtualHost)�get_aug_path)�!KeyAuthorizationChallengeResponse)�errors)�"KeyAuthorizationAnnotatedChallenge)� filesystem)�os)�common)�ApacheConfiguratorc �� � � e Zd ZdZdZdZd� fd�Zdee fd �Z dd �Z dd�Zdedee fd �Zdee fd�Zdee fd�Zdee fd�Zdedefd�Zde ddfd�Z� xZS )�ApacheHttp01zFClass that performs HTTP-01 challenges within the Apache configurator.zo RewriteEngine on RewriteRule ^/\.well-known/acme-challenge/([A-Za-z0-9-_=]+)$ {0}/$1 [END] z� <Directory {0}> Require all granted </Directory> <Location /.well-known/acme-challenge> Require all granted </Location> �configuratorr �returnNc �� �� t � � � |� � | t j � | j � d� � d� � | _ t j � | j � d� � d� � | _ t j � | j j j d� � | _ t � � | _ d S )Nzchallenge-locationzle_http_01_challenge_pre.confzle_http_01_challenge_post.conf�http_challenges)�super�__init__r �path�joinr �conf�challenge_conf_pre�challenge_conf_post�config�work_dir� challenge_dir�set�moded_vhosts)�selfr � __class__s ��B/usr/lib/python3/dist-packages/certbot_apache/_internal/http_01.pyr zApacheHttp01.__init__( s� �� � ������&�&�&��/�"$�'�,�,���"�"�#7�8�8�+�#-� #-��� $&�7�<�<���"�"�#7�8�8�,�$.� $.�� � �W�\�\���$�-��� ��� /2�e�e����� c �h � | j sg S | j � dd� � | j � t | j j j � � � � | � � � | � � � }| � � � | j � dd� � |S )zPerform all HTTP-01 challenges.zChanges before challenge setupTzHTTP Challenge) �achallsr �save� ensure_listen�strr �http01_port�prepare_http01_modules�_set_up_challenges�_mod_config)r! � responsess r# �performzApacheHttp01.perform6 s� � ��|� ��I� ����?��F�F�F���'�'��D�,=�,D�,P�(Q�(Q�R�R�R��#�#�%�%�%��+�+�-�-� �����������/��6�6�6��r$ c � � | j � d� � r;ddg}|D ]6}|dz | j j j vr| j � |d�� � �5dS dS )z>Make sure that we have the needed modules available for http01zhandle-modules�rewrite� authz_core�_moduleT)�tempN)r r �parser�modules� enable_mod)r! �needed_modules�mods r# r+ z#ApacheHttp01.prepare_http01_modulesI s� � � ��!�!�"2�3�3� A�'��6�N�%� A� A����?�$�*;�*B�*J�J�J��%�0�0��4�0�@�@�@�� A� A� A� Ar$ c � � � g }t | j j j � � � | j D ]}|| � |j � � z }� d}|D ]$}t � fd�|j D � � � � rd}�%|r|| � � � z }n|| � � � z }|D ]}| � |� � �| j j � d| j � � | j j � d| j � � | j � | j � � }| j � | j � � }t( � d|� � t- | j d� � 5 }|� |� � d d d � � n# 1 swxY w Y t( � d|� � t- | j d� � 5 }|� |� � d d d � � d S # 1 swxY w Y d S )NFc 3 �p �K � | ]0}|� � � p|� � � �k V � �1d S �N��is_wildcard�get_port)�.0�a� http_ports �r# � <genexpr>z+ApacheHttp01._mod_config.<locals>.<genexpr>^ s= �� � � �U�U�A�1�=�=�?�?�?�a�j�j�l�l�i�&?�U�U�U�U�U�Ur$ Tz(writing a pre config file with text: %s�wz)writing a post config file with text: %s)r) r r r* r&