| Current File : //opt/imunify360/venv/lib/python3.11/site-packages/im360/subsys/__pycache__/ossec.cpython-311.pyc |
�
�*(i" � �z � d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m
Z
mZ ddlm
Z
ddlmZmZ ddlmZ ddlmZ d d
lmZmZ ej e� � Z ej d� � Zedz Zd
ZdZej dedej! diZ"ej ej# eej# ej! ej# iZ$g d�Z%dZ&dZ' ej( � � Z) G d� de*� � Z+ ed �� � d� � � Z,d� Z-de.de/de/fd�Z0d/de1ddfd �Z2dee. fd!�Z3d"� Z4de/fd#�Z5d0d$�Z6d0d%�Z7d&eddfd'�Z8d1d)e/de
e fd*�Z9d0d+�Z:d0d,�Z;d-e/ddfd.�Z<dS )2a� Module for managing OSSEC configuration.
We care about following aspects of OSSEC configuration:
* its relation to Imunify PAM module;
* rules configuration.
To cooperate with PAM module, OSSEC ships two configuration files:
ossec-no-pam.conf and ossec-pam.conf. A symlink ossec.conf is created during
OSSEC packages installation that points to ossec-no-pam.conf. On switching
PAM module on this symlink is changed to point to ossec-pam.conf. Then OSSEC
services are restarted.
When PAM is disabled, similar operations are performed: symlink switched to
ossec-no-pam.conf and services are restarted.
Rules are downloaded from Imunify360 files server. After downloading is
complete a hook is called which should update rules in OSSEC configuration
directory and restart OSSEC service. Rules are copied into
/var/ossec/etc/VERSIONS/<version> directory. Then symlinks are created
from /var/ossec/etc/dirname.d -> VERSIONS/<version>/dirname.
� N)� lru_cache)�List�Optional)�svcctl)�
CheckRunError� check_run)�LooseVersion)�files� )�
PamService�PamServiceStatusValuez/var/ossec/etc�VERSIONSz
ossec.conf�dovecotzrules_pam.d/320_pam_switch.xmlz&rules_pam.d/320_pam_switch_dovecot.xmlzrules_pam.d/320_pam_ftp.xml)�decoders�rules� rules_pam�VERSION� c � � e Zd ZdS )�OssecRulesErrorN)�__name__�
__module__�__qualname__� � �G/opt/imunify360/venv/lib/python3.11/site-packages/im360/subsys/ossec.pyr r >