Uname : Linux premium36.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Soft : LiteSpeed
Ip : 198.54.115.237
Port : 443
~
/
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
site-packages
/
imav
/
wordpress
/
__pycache__
[ HOME ]
Exec
Submit
File Name : proxy_auth.cpython-311.pyc
� 3Ri� � �b � d Z ddlZddlZddlZddlZddlZddlZddlmZmZ ddl m Z ddlmZ ddl mZmZ ddlmZ ddlmZ ej e� � Z ed � � � ZdZdZd Z 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)�get_data_dir)�!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 / sq � �!��w��'�'�� �=���� � � � ��������� ���� � �"�"�X�-�0E�0M�M�s �# �2�2c �� � t t � � } t � d� � t j d� � }| j � ddd�� � | � d�� � t | |dt t � � d� � � t d dt g� � d S # t $ r&}t � d|� � Y d }~d S 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�restartz&Got error while rotating the secret %sN)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_secretr6 ; s � ���'�'�K�B����(� � � � �)�"�-�-���� � �e�T�D� �I�I�I����u��%�%�%������*�+�+�� � � � � �;� �+=�>�?�?�?�?�?��� B� B� B����=�q�A�A�A�A�A�A�A�A�A�����B���s �BB6 �6 C&� C!�!C&� �returnc �^ � t t d� � 5 } | � � � � � � cddd� � S # 1 swxY w Y dS # t $ r" t � dt � � � t $ r!}t � d|� � � d}~ww xY w)r �rbNzJWT secret file not found at %szFailed to read JWT secret: %s)�openr �read�stripr r'