Şuanki Dizin: /lib64/python3.9/site-packages/setools/checker/__pycache__/ |
Şuanki Dosya : //lib64/python3.9/site-packages/setools/checker/__pycache__/assertrbac.cpython-39.pyc |
a q�qe��@s�ddlZddlmZmZddlmZddlmZddlm Z ddl mZdd lm Z mZd ZdZdZd ZdZdZGdd�de�ZdS)�N)�List�Union�)�InvalidCheckValue)�AnyRBACRule)� RBACRuleQuery�)� CheckerModule)�ConfigDescriptor�ConfigSetDescriptor�source�target� exempt_source� exempt_target� expect_source� expect_targetcs�eZdZdZdZeeeee e ef�Ze d�Ze d�Zedddd�Zedddd�Zedddd�Zedddd�Zdd��fd d �Zed�dd�Z�ZS) � AssertRBACz?Checker module for asserting a RBAC allow rule exists (or not).Zassert_rbacZlookup_roleFT)�strict�expandN)�returncs�t��|||�t�t�|_|�t�|_|�t �|_ |�t�|_|�t �|_|�t�|_|�t�|_t|j|j f�s|td��|j|j@}|r�|j�d�d�dd�|D����|j|j@}|r�|j�d�d�dd�|D����dS)Nz5At least one of source or target options must be set.z.Overlap in expect_source and exempt_source: {}z, css|]}|jVqdS�N��name��.0�i�r�@/usr/lib64/python3.9/site-packages/setools/checker/assertrbac.py� <genexpr>;�z&AssertRBAC.__init__.<locals>.<genexpr>z.Overlap in expect_target and exempt_target: {}css|]}|jVqdSrrrrrrr@r)�super�__init__�loggingZ getLogger�__name__�log�get� SOURCE_OPTr� TARGET_OPTr �EXEMPT_SRC_OPTr�EXEMPT_TGT_OPTr�EXPECT_SRC_OPTr�EXPECT_TGT_OPTr�anyr�info�format�join)�self�policyZ checknameZconfigZsource_exempt_expect_overlapZtarget_exempt_expect_overlap�� __class__rrr!(s,� � �zAssertRBAC.__init__c Cs@t|j|jf�sJd��|j�d�t|j|j|jdd�}t|j�}t|j �}g}t |���D]x}t|j���}t|j���}||8}||8}||j|j r�||j |jr�|�t|��|�|�q^|�t|��q^|D]"}d�|�} |�| �|�| �q�|D]$}d�|�} |�| �|�| ��q|j�d�|��|S)Nz)AssertRBAC no options set, this is a bug.z#Checking RBAC allow rule assertion.)Zallow)rr Zruletypez)Expected rule with source "{}" not found.z)Expected rule with target "{}" not found.z {} failure(s))r,rr r$r-rr1�setrr�sorted�resultsrrrZlog_fail�str�appendZlog_okr.�debug) r0�queryZunseen_sourcesZunseen_targetsZfailuresZruleZsrcsZtgts�itemZfailurerrr�runBs>� � zAssertRBAC.run)r#� __module__�__qualname__�__doc__Z check_type� frozensetr&r'r(r)r*r+Zcheck_configr rr rrrrrr!rr<� __classcell__rrr2rrs �r)r"�typingrr� exceptionrZ policyreprZ rbacrulequeryrZ checkermoduler Zdescriptorsr rr&r'r(r)r*r+rrrrr�<module>s
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4