Revonzy Mini Shell
Revonzy Mini Shell
a
q�qe � @ s| d dl Z d dlmZ d dlmZmZmZ ddlmZm Z ddl
mZ ddlm
Z
dd lmZ d
ZdZdZG d
d� de
�ZdS )� N)�defaultdict)�Dict�List�Set� )� AnyTERule�Type)�TERuleQuery� )�
CheckerModule)�ConfigSetDescriptor�exempt_write_domain�exempt_exec_domain�exempt_filec s� e Zd ZdZdZeeeef�Z e
dddd�Ze
dddd�Ze
dddd�Z
dd�� fd d
�Zeeee f d�dd�Zed�d
d�Z� ZS )�ReadOnlyExecutablesz@Checker module for asserting all executable files are read-only.Zro_execsZlookup_type_or_attrFT)�strict�expandN)�returnc sD t � �|||� t�t�| _|�t�| _|�t �| _
|�t�| _d S )N)
�super�__init__�loggingZ getLogger�__name__�log�get�EXEMPT_WRITEr
�EXEMPT_FILEr �EXEMPT_EXECr )�self�policyZ checknameZconfig�� __class__� �</usr/lib64/python3.9/site-packages/setools/checker/roexec.pyr ! s
zReadOnlyExecutables.__init__c C s� | j �d� | j �d�| j�� t| jdddd�}tt�}|�� D ]t}t|j �
� �| j }t|j�
� �| j }|rv|s�| j �d�|�� qB|D ]&}| j �d�||�� || �
|� q�qB|S ) Nz)Collecting list of executable file types.zIgnore exec domains: {!r}�Zallow��file)ZexecuteZexecute_no_trans�ZruletypeZtclassZpermszIgnoring execute rule: {}z"Determined {} is executable by: {})r �debug�formatr r r r �set�results�sourcer �targetr �add)r �queryZ collected�ruleZsources�targets�tr! r! r"