🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-06-24 02:09:02 | PHP 8.2.31
📂
/ (Root)
/
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
site-packages
/
defence360agent
/
utils
/
__pycache__
📍 /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/utils/__pycache__
🔄 Refresh
✏️
Editing: sshutil.cpython-311.opt-1.pyc
Read Only
� ���Ѐ�� � � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z d dl mZ d dlm Z d dlmZ e e� � ZdZdZ e d� � Z e d � � Z ej d � � Zdede fd �ZdZdZdZd� Zd!d�Zdefd�Z d"dddefd�Z! ej d� � Z"de#fd�Z$dede#defd�Z%defd�Z&d#d�Z'd#de#fd �Z(dS )$� N)� getLogger)�URLError)�Path)�atomic_rewritezFhttps://repo.imunify360.cloudlinux.com/defense360/assisted-cleanup.pubz!clsupport@sshbox\.cloudlinux\.comz/etc/ssh/sshd_configz/etc/ssh/sshd_config.dz^[a-z_][a-z0-9_-]{0,31}\Z�username�returnc � � t | t � � rt � | � � st d| ��� � �| dk rt d� � S t j | � � j }n%# t $ r}t d| ��� � |�d}~ww xY w|rt j � |� � st d| �d|��� � �t t j � |dd � � � � S ) zMHome dir via pwd.getpwnam, not /home/ concatenation, to block path traversal.zinvalid username: �rootz/root/.ssh/authorized_keyszno such user: Nz non-absolute home directory for �: z.ssh�authorized_keys)� isinstance�str�_USERNAME_RE�match� ValueErrorr �pwd�getpwnam�pw_dir�KeyError�os�path�isabs�join)r �home�es �R/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/utils/sshutil.py�_resolve_authorized_keysr s � ��h��$�$� ?�L�,>�,>�x�,H�,H� ?��j�8�8�=�>�>�>��6����0�1�1�1�B��|�H�%�%�,����� B� B� B��j�x�x�9�:�:��A�����B���� � �r�w�}�}�T�*�*� ��j�8@���$�$�G� � � � �����T�6�+<�=�=�>�>�>s �A2 �2 B�<B�B� �%IMUNIFY_ASSISTED_CLEANUP_KEY_TTL_DAYSzrestrict,ptyc � �6 K � d} t g}t � � � r:|� t t � d� � � � � � t |� � D ]�} |� � � � � � D ]�}|� � � }|� d� � r]|� d� � sH t |� � � d � � } | c c | c S # t t f$ r Y ��w xY w����# t $ r*}t � d|� d|� �� � Y d}~��d}~ww xY wn4# t$ $ r'}t � d |� �� � Y d}~nd}~ww xY w| S # | c cY S xY w) z Detect SSH port from config and its overrides. Searches configs in reverse order to find the last override first. � z*.conf�Port �#� �Failed to read r NzFailed to get SSH port: )�SSH_CONFIG_PATH�SSH_CONFIG_DIR�exists�extend�sorted�glob�reversed� read_text� splitlines�strip� startswith�int�split� IndexErrorr �IOError�logger�warning� Exception)�port�config_files�config_file�liner s r �get_ssh_portr<