MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/tuned/plugins/__pycache__/plugin_selinux.cpython-312.pyc
�

�]�i	���ddlZddlZddlmZddl�ddlZddlmZddl	m
Z
ejj�Z
Gd�dej�Zy)	�N�)�base)�*)�
exceptions)�commandsc���eZdZdZed��Z�fd�Zed��Zd�Zd�Z	e
d�d��Zed�d	��Z
�xZS)
�
SelinuxPlugina�
	Plug-in for tuning SELinux options.

	SELinux decisions, such as allowing or denying access, are
	cached. This cache is known as the Access Vector Cache (AVC). When
	using these cached decisions, SELinux policy rules need to be checked
	less, which increases performance. The [option]`avc_cache_threshold`
	option allows adjusting the maximum number of AVC entries.

	NOTE: Prior to changing the default value, evaluate the system
	performance with care. Increasing the value could potentially
	decrease the performance by making AVC slow.

	.Increase the AVC cache threshold for hosts with containers.
	====
	----
	[selinux]
	avc_cache_threshold=8192
	----
	====
	c��d}tjj|�s#d}tjj|�sd}|S)Nz/sys/fs/selinuxz/selinux)�os�path�exists)�selfrs  �A/usr/lib/python3.12/site-packages/tuned/plugins/plugin_selinux.py�_get_selinux_pathzSelinuxPlugin._get_selinux_path"s6��	�$�	������	�
�4�
�'�'�.�.��
��D�	
�+�c���t�|_|j�|_|j�t	j
d��tjj|jdd�|_	tt|�2|i|��y)NzFSELinux is not enabled on your system or incompatible version is used.�avc�cache_threshold)
r�_cmdr�
_selinux_pathr�NotSupportedPluginExceptionrr�join�_cache_threshold_path�superr	�__init__)r�args�kwargs�	__class__s   �rrzSelinuxPlugin.__init__+so����j�$�)��-�-�/�$��	����	�	/�	/�0x�	y�y�!�w�w�|�|�D�,>�,>��GX�Y�$���
�t�%�t�6�v�6rc�
�ddiS)N�avc_cache_threshold�)rs r�_get_config_optionsz!SelinuxPlugin._get_config_options3s���4�
�rc� �d|_d|_y)NTF)�_has_static_tuning�_has_dynamic_tuning�r�instances  r�_instance_initzSelinuxPlugin._instance_init9s�� $�(��!&�(�rc��y)Nr!r&s  r�_instance_cleanupzSelinuxPlugin._instance_cleanup=s��rr c��|�yt|�}|dk\r?|s;|jj|j||rtj
gnd��|Sy)NrF)�no_error)�intr�
write_to_filer�errno�ENOENT)r�valuer'�sim�remove�	thresholds      r�_set_avc_cache_thresholdz&SelinuxPlugin._set_avc_cache_threshold@sT��
�]�
��%�j�)��!�^�

��I�I���D�6�6�	�"(�����e��5�
��
rc��|jj|j�}t|�dkDrt	|�Sy)Nr)r�	read_filer�lenr-)rr'r1s   r�_get_avc_cache_thresholdz&SelinuxPlugin._get_avc_cache_thresholdMs4��
�)�)�
�
�d�8�8�
9�%���Z�!�^�

�e�*��	
r)�__name__�
__module__�__qualname__�__doc__�classmethodrrr"r(r*�command_setr5�command_getr9�
__classcell__)rs@rr	r	ss����,����7�����
'���#�$�
�%�
��#�$��%�rr	)rr/�r�
decorators�
tuned.logs�tuned�
tuned.pluginsr�tuned.utils.commandsr�logs�get�log�Pluginr	r!rr�<module>rLs<��	�����$�)��j�j�n�n���G�D�K�K�Gr