?????????? ????????? - ??????????????? - /opt/imunify360/venv/lib/python3.11/site-packages/imav/wordpress/__pycache__/proxy_auth.cpython-311.opt-1.pyc
???????
� �D֪Q� �^ � d Z ddlZddlZddlZddlZddlZddlmZmZ ddlm Z ddl mZ ddlZddl mZmZ ddlmZmZmZ ej e� � Z ed� � � Zd ZdZdZ ed �� � Zd� Zd� Z e d� � defd�� � Zde de de fd�Z!de de"ddfd�Z#dej$ ddfd�Z%dS )u This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see <https://www.imunify360.com/legal/eula> � N)�datetime� timedelta)� lru_cache)�Path)�atomic_rewrite� check_run)�ensure_site_data_directory�format_php_with_embedded_json�!write_plugin_data_file_atomically�H )�hoursz#/etc/imunify-agent-proxy/jwt-secretz'/etc/imunify-agent-proxy/jwt-secret.oldzimunify-agent-proxy� )�daysc �� � t j t � � } | j }n# t $ r d}Y nw xY wt j � � � � � |z t j k S )Ng ) �os�stat�JWT_SECRET_PATH�st_mtime�FileNotFoundErrorr �now� timestamp�SECRET_EXPIRATION_TTL�seconds)r r s �N/opt/imunify360/venv/lib/python3.11/site-packages/imav/wordpress/proxy_auth.py�is_secret_expiredr 1 sq � �!��w��'�'�� �=���� � � � ��������� ���� � �"�"�X�-�0E�0M�M�s �# �2�2c � �� K � t t � � } t � d� � t j d� � }| j � ddd�� � | � d�� � t | |dt t � � d� � � t d dt g� � � d{V �� dS # t $ r&}t � d |� � Y d}~dS d}~ww xY w)�.Load JWT secret from the configured file path.zRotating proxy auth secret� i� T)�mode�parents�exist_oki� )r ���)�uid�backup�permissions� systemctl�restartNz&Got error while rotating the secret %s)r r �logger�info�secrets�token_bytes�parent�mkdir�touchr �str�JWT_SECRET_PATH_OLDr �PROXY_SERVICE_NAME� Exception�error)�secret_path�stub_secret�es r � rotate_secretr7 = s" � � � ���'�'�K�B����(� � � � �)�"�-�-���� � �e�T�D� �I�I�I����u��%�%�%������*�+�+�� � � � � ��i�1C�D�E�E�E�E�E�E�E�E�E�E�E��� B� B� B����=�q�A�A�A�A�A�A�A�A�A�����B���s �B$B>