404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.14.255.181: ~ $
3

�h>`��@s�ddlmZddlmZddlZddlZddlTddlmZddlm	Z	ddl
Z
ddlmZm
Z
e
je
dd	�e
dd
�dd�Zy
ejaWnek
r�ej
aYnXd
ddddddddddddddddgZedkr�e
je
dd	�e
dd
�d�dd l
madd!lm
Z
ddlTddlTddlTddlTddljZddlTddlZddlTdd"l m!Z!ddl"Z"ddl#Z#d#d$�Z$dZ%d%Z&d&Z'e%td'�e&td(�e'td)�iZ(e%d*e&d+e'd,iZ)e%e&e'd-�Z*Gd.d
�d
e+�Z,Gd/d�de-�Z.Gd0d�de-�Z/Gd1d�de-�Z0iZ1td2�e1d3<td4�e1d5<td6�e1d7<td8�e1d9<td:�e1d;<td<�e1d<<td=�e1d=<td>�e1d><td?�e1d?<td@�e1d@<tdA�e1dA<tdB�e1dB<tdC�e1dC<dDdE�Z2GdFdG�dGe-�Z3GdHd�de-�Z4GdId�de-�Z5GdJd�de-�Z6GdKd�de-�Z7GdLd�de-�Z8GdMd�de-�Z9GdNd�de-�Z:GdOd�de-�Z;GdPd�de-�Z<edk�r�ddl=Z=e=j>dQ�dRZ?e9�Z@e@jAe?dS�e@jBdZCeCjDjEdZFeGeFjH�eGdTeCjD�eGe@�e=jI�e=j>dQ�dk�r�eGdU�neGdVe=j>dQ��e=jJ�dS)W�)�absolute_import)�print_functionN)�*)�range)�
cmp_to_key)�parse_config_setting�
get_configZgeneralZi18n_text_domainZi18n_locale_dirT)�domain�	localedirZfallback�SignatureMatch�SEFilter�SEFaultSignature�SEFaultSignatureInfo�SEFaultSignatureSet�SEFaultSignatureUser�
SEEnvironment�SEDatabaseProperties�SEFaultUserInfo�SEFaultUserSet�SEPlugin�SEEmailRecipient�SEEmailRecipientSet�FILTER_NEVER�
FILTER_ALWAYS�FILTER_AFTER_FIRST�filter_text�__main__)r	r
)�ngettext)r)�TemplatecCs||k||kS)N�)�x�yrr�/usr/lib/python3.6/signature.py�<lambda>Qsr#��zNever Ignorez
Ignore AlwayszIgnore After First Alert�never�always�after_first)r&r'r(c@seZdZdd�ZdS)rcCs||_||_dS)N)�siginfo�score)�selfr)r*rrr"�__init__oszSignatureMatch.__init__N)�__name__�
__module__�__qualname__r,rrrr"rmsc
s�eZdZddd�d�ddiddiddiddiddiddided�ded�ddiddiddid�Z�fd	d
�Zdd�Zd
d�Zdd�Z�Z	S)r�	attributecCsdS)Nz1.0rrrrr"r#vszSEEnvironment.<lambda>)�XMLForm�defaultr1�element)r1�import_typecast)�version�platform�kernel�policy_type�
policy_rpm�local_policy_rpm�enforce�selinux_enabled�selinux_mls_enabled�
policyvers�hostname�unamecstt|�j�|j�dS)N)�superrr,�update)r+)�	__class__rr"r,�szSEEnvironment.__init__cCs�ddl}ddl}t�\|_|_|j�d|_td|j�|_|j|_t	|j
��|_|j�}|dkrjd|_
nd|_
t|j��|_t|j��|_|j�|_dj|j��|_dS)Nr�z/etc/selinux/%s�
PermissiveZ	Enforcing� )r6�selinuxZget_os_environmentr7Zselinux_getpolicytyper8Zget_package_nvr_by_file_pathr9r:�strZsecurity_policyversr>Zsecurity_getenforcer;�boolZis_selinux_enabledr<Zis_selinux_mls_enabledr=�noder?�joinr@)r+r6rGr;rrr"rB�s
zSEEnvironment.updatecCs|j|�S)N)�__eq__)r+�otherrrr"�__ne__�szSEEnvironment.__ne__cCs4x.t|jj��D]}t||�t||�krdSqWdS)NFT)�list�	_xml_info�keys�getattr)r+rM�namerrr"rL�szSEEnvironment.__eq__)
r-r.r/�booleanrPr,rBrNrL�
__classcell__rr)rCr"rts csBeZdZdedd�d�dedd�d�d�Zef�fdd�	Z�ZS)	rr3cCstS)N)rrrrr"r#�szSEFilter.<lambda>)r1r4r2cCsdS)Nrrrrrr"r#�s)�filter_type�countcstt|�j�||_dS)N)rArr,rV)r+rV)rCrr"r,�szSEFilter.__init__)r-r.r/�intrPrr,rUrr)rCr"r�scsdeZdZddidedd�d�dedd�d�dedd�d�d	�Z�fd
d�Zdd
�Zddd�Z�Z	S)rr1r0cCsdS)NFrrrrr"r#�szSEFaultSignatureUser.<lambda>)r1r4r2cCsdS)NFrrrrr"r#�sr3cCst�S)N)rrrrr"r#�s)�usernameZ	seen_flagZdelete_flag�filtercstt|�j�||_dS)N)rArr,rY)r+rY)rCrr"r,�szSEFaultSignatureUser.__init__cCs:||jkrttd|��|dkr*ttd��t|||�dS)Nz!item (%s) is not a defined memberrYz changing the username is illegal)Z_names�ProgramErrorZERR_NOT_MEMBERZERR_ILLEGAL_USER_CHANGE�setattr)r+�item�datarrr"�update_item�s


z SEFaultSignatureUser.update_itemNcCsXtdtj|d�|f�|tks0|tks0|tkrHtd�t|d�|_dStd|��dS)Nz%update_filter: filter_type=%s data=%s�unknownzupdate_filter: !!!)rVTzBad filter_type (%s))	�	log_debug�map_filter_value_to_name�getrrrrrZ�
ValueError)r+rVr^rrr"�
update_filter�sz"SEFaultSignatureUser.update_filter)N)
r-r.r/rTrrPr,r_rerUrr)rCr"r�s	�	directory�dirZ	semaphoreZsemz
shared memoryZshmz
message queueZmsgq�message�msg�fileZsocket�process�process2Z
filesystemrJ�
capability�capability2cCs|ttj��krt|S|S)N)rO�
class_dictrQ)�tclassrrr"�translate_class�srqcs eZdZdZ�fdd�Z�ZS)�AttributeValueDictionaryZunstructuredcstt|�j�dS)N)rArrr,)r+)rCrr"r,�sz!AttributeValueDictionary.__init__)r-r.r/rPr,rUrr)rCr"rr�srrc	sZeZdZddd�d�ddiddd�ded	�ded	�ddided	�d
�Z�fdd�Z�ZS)
r
r0cCsdS)Nz4.0rrrrr"r#�szSEFaultSignature.<lambda>)r1r2r1r3Z	operation)r1rO)r1r4)r5�host�access�scontext�tcontextrp�portcs8tt|�j�x$t|j��D]\}}t|||�qWdS)N)rAr
r,rO�itemsr\)r+�kwds�k�v)rCrr"r,�szSEFaultSignature.__init__)r-r.r/�
AvcContextrXrPr,rUrr)rCr"r
�scs8eZdZddiddd�d�Z�fdd�Zdd	�Z�ZS)
rr1r3�arg)r1rO)�analysis_id�argscstt|�j�||_||_dS)N)rArr,r~r)r+r~r)rCrr"r,
szSEPlugin.__init__cCst|j|jf�S)N)rHr~r)r+rrr"�__str__szSEPlugin.__str__)r-r.r/rPr,r�rUrr)rCr"rscs�eZdZdded�ded�ddiddiddiddd�ddd�ded�ded�ddided�ded�ddiddiddided�de	d�de	d�dedd	�d
�ddidde
d�ddiddiddid�Zd
dddddddddg
Z�fdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdEd&d'�ZdFd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�ZdGd9d:�Zd;d<�Zd=d>�ZdHd?d@�Z dAdB�Z!dIdCdD�Z"�Z#S)Jrr3Zplugin)r1rOr4)r1r4r1Zrpm)r1rOcCsdS)Nrrrrrr"r#)szSEFaultSignatureInfo.<lambda>)r1r4r2�user)�plugin_list�audit_event�source�spath�tpath�src_rpm_list�tgt_rpm_listrurvrprw�sigZif_textZ	then_textZdo_text�environment�first_seen_date�last_seen_date�report_count�local_id�users�levelZfixableZbutton_textr�r�r�r�rurvrprwr�r�c
s|tt|�j�x$t|j��D]\}}t|||�qWd|_g|_d}tj	�dkrTd}yt
|j|d�|j_
WnYnXdS)NrDTrF)�use_dbus)rArr,rOrxr\r�r��os�getuidZget_rpm_nvr_by_scontextrur�r:)r+ryrzr{r�)rCrr"r,7szSEFaultSignatureInfo.__init__cCsZ|j|jkr"|j|_|jd7_x |jD]}t||t||��q*W|jdkrV|j|_dS)NrD)r�r��
merge_includer\rRr�)r+r)rSrrr"�update_mergeHs
z!SEFaultSignatureInfo.update_mergecCs|jjS)N)r�r9)r+rrr"�get_policy_rpmTsz#SEFaultSignatureInfo.get_policy_rpmcCs(d|j|jj|jj|jdj|jj�fS)Nz%s,%s,%s,%s,%s�,)r�ru�typervrprKr�rt)r+rrr"�get_hash_strWsz!SEFaultSignatureInfo.get_hash_strcCstj|j�jd��}|j�S)Nzutf-8)�hashlibZsha256r��encodeZ	hexdigest)r+�hashrrr"�get_hashZszSEFaultSignatureInfo.get_hashcCsBx|jD]}|j|kr|SqWtd|�t|�}|jj|�|S)Nznew SEFaultSignatureUser for %s)r�rYrar�append)r+rYr�rrr"�
get_user_data^s
z"SEFaultSignatureInfo.get_user_datacCs,td|�d}|j|�}|dk	r(|j}|S)Nzfind_filter_by_username %s)rar�rZ)r+rYrZ�	user_datarrr"�find_filter_by_usernamegs
z,SEFaultSignatureInfo.find_filter_by_usernameNcCs|j|�}|j||�dS)N)r�re)r+rYrVr^r�rrr"�update_user_filterps
z'SEFaultSignatureInfo.update_user_filtercCsTd}|j|�}td||f�|dk	rP|dk	r4||_|j|�}td|||f�|S)N�displayz5evaluate_filter_for_user: found %s user's filter = %sz4evaluate_filter_for_user: found filter for %s: %s
%s)r�rarV�evaluate_filter)r+rYrV�action�frrr"�evaluate_filter_for_userts

z-SEFaultSignatureInfo.evaluate_filter_for_usercCsb|j}d}|tkrd}n8|tkr6|jdkr0d}qPd}n|tkrDd}ntd|��|jd7_|S)Nr�r�ignorezunknown filter_type (%s)rD)rVrrrWrrd)r+rZrVr�rrr"r�s
z$SEFaultSignatureInfo.evaluate_filtercCs2t|t�r&t|�dkr dj|�SdSntd�SdS)NrrF�)�
isinstancerO�lenrK�default_text)r+Zrpm_listrrr"�format_rpm_list�s


z$SEFaultSignatureInfo.format_rpm_listcCsd|j|jfS)Nz	%s [ %s ])r�rp)r+rrr"�format_target_object�sz)SEFaultSignatureInfo.format_target_objectcCsTd}|jjd�}|dkr<|jd�dkr<td�|j|jjf}|jjdkrPtd�}dS)NZSYSCALL�success�yesz:%s has a permissive type (%s). This access was not denied.rEz:SELinux is in permissive mode. This access was not denied.)	r�Zget_record_of_typeZ	get_field�_r�rur�r�r;)r+Zpermissive_msgZsyscall_recordrrr"�#description_adjusted_for_permissive�sz8SEFaultSignatureInfo.description_adjusted_for_permissivecCs�i|_|jj|jd<|jj|jd<|j|jd<|j|jd<tjj|j�|jd<t	j
dd|j�|jd<|jr�t	j
d	d
|j�|jd<n
td�|_|j|jd
<tjj|j�|jd<|jr�t	j
d	d
|j�|jd<|jdkr�d|jd<nD|j
dkr�|j|jd<n,|j
dk�rtjj|j�|jd<n
d|jd<|j
dk�r:d|jd<n|j
|jd<|jjdk�r`d|jd<nd	j|jj�|jd<t|j�dk�r�|jd|jd<|j|jd<x4t|jj��D]"\}}|dk�r�t|�|j|<�q�WdS)NZSOURCE_TYPEZTARGET_TYPEZSOURCEZSOURCE_PATHZSOURCE_BASE_PATHz[^a-zA-Z0-9]r�ZMODULE_NAMErF�.ZFIX_SOURCE_PATHzN/AZTARGET_PATHZTARGET_BASE_PATHZFIX_TARGET_PATHZ
TARGET_DIRrgrjrfZTARGET_CLASSZACCESSrZSOURCE_PACKAGEZPORT_NUMBER)�template_substitutionsrur�rvr�r�r��path�basename�re�subr�r�rp�dirnamer�rtrKr�r�rwrOrxr�)r+�key�valuerrr"�%update_derived_template_substitutions�sB




z:SEFaultSignatureInfo.update_derived_template_substitutionscCst|dj|dj�S)Nr)�cmp�priority)r+r r!rrr"�
priority_sort�sz"SEFaultSignatureInfo.priority_sortcCs�|jdkr:ttd�td�t|jj��|jdj|jj�fS|jdkrtttd�td	�t|jj��|jdj|jj�fS|jdkr�ttd�td
�t|jj��|jdj|jj�t	|j�|j
jfSttd�td�t|jj��|jdj|jj�t	|j�|jfS)Nrkrlz?SELinux is preventing %s from using the %s access on a process.zCSELinux is preventing %s from using the '%s' accesses on a process.z, rmrnz6SELinux is preventing %s from using the %s capability.z:SELinux is preventing %s from using the '%s' capabilities.�(null)�Unknownz=SELinux is preventing %s from %s access on the %s labeled %s.zASELinux is preventing %s from '%s' accesses on the %s labeled %s.z5SELinux is preventing %s from %s access on the %s %s.z9SELinux is preventing %s from '%s' accesses on the %s %s.)rkrl)rmrn)r�r�)rp�P_r�r�r�rtr�rKr�rqrvr�)r+rrr"�summary�s
0
0
>zSEFaultSignatureInfo.summaryFc
st��_g}d}|r>x��jD]}||j7}|j|d
f�qWn\xZ�jD]P}xJ�jD]@}|j|jkrR||j7}|jt|j��|j|t|j�f�PqRWqFW|j	t
�j�d�ddddg}d	j�fd
d�|D��}x.|D]&}||kr�x|D]\}}	d|_
q�WPq�W||fS)Nr�allow_ypbind�1)r�Zmozilla_read_contentZ"mozilla_plugin_can_network_connectZmozilla_plugin_use_bluejeansZ$unconfined_mozilla_plugin_transitionrFcs g|]\}}|j�jj|��qSr)�get_do_textr��records)�.0�p�a)r+rr"�
<listcomp>�sz4SEFaultSignatureInfo.get_plugins.<locals>.<listcomp>F)r�r�)Zload_plugins�pluginsr�r�r�r~Z	init_args�tupler�sortrr�rKZ
report_bug)
r+�allr��total_priorityr�ZsolutionZnoreport_booleansZdo_texts�br�r)r+r"�get_plugins�s0




z SEFaultSignatureInfo.get_pluginscCst|�j|j�S)N)rZsafe_substituter�)r+�txtrrr"�
substituteszSEFaultSignatureInfo.substitutecs�fdd�|D�S)Ncsg|]}�j|��qSr)r�)r�r�)r+rr"r�	sz9SEFaultSignatureInfo.substitute_array.<locals>.<listcomp>r)r+rr)r+r"�substitute_arraysz%SEFaultSignatureInfo.substitute_arrayc
s�|j}td�}|ttd�|jj��7}|ttd�|jj��7}|ttd�|j��7}|ttd�t|j��7}|ttd�t|j	��7}|ttd�t|j
��7}|r�|ttd�d	�7}n|ttd�t|jj��7}|ttd
�t|j
|j���7}|ttd�t|j
|j���7}|ttd�t|j��7}|ttd
�t|j��7}|ttd�t|j��7}|ttd�t|j��7}|ttd�t|j��7}|�r�|ttd�d	�7}n|ttd�t|j��7}|�r�|jj�}d	|d<|ttd�tdj|���7}n|ttd�t|j��7}|ttd�t|j��7}d}|ttd�|jj|��7}|ttd�|jj|��7}|ttd�t|j��7}|dtd�7}d}xj|jjD]^��jdk�r�|d�j �d7}n6|d�j�j!f7}|dj�fdd ��j"D��d7}�q�W|d!|j#�7}y~d"}t$j%j&|��rvd#}t'|gt(t(d$�}	||	j)|�d%7}t$j%j*d&��rn|d'7}t'|d(gt(t(d$�}	||	j)|�d%7}||7}WnYnX||d7}|S))NzAdditional Information:
zSource ContextzTarget ContextzTarget ObjectsZSourcezSource PathZPortZHostz	(removed)zSource RPM PackageszTarget RPM PackageszSELinux Policy RPMzLocal Policy RPMzSelinux EnabledzPolicy TypezEnforcing Modez	Host NamerDZPlatformrFzAlert Countz%Y-%m-%d %H:%M:%S %Zz
First Seenz	Last SeenzLocal ID�
zRaw Audit Messagesr�ZAVCz
type=%s msg=%s: csg|]}d|�j|f�qS)z%s=%s)Zfields)r�rz)�audit_recordrr"r�8sz7SEFaultSignatureInfo.format_details.<locals>.<listcomp>z
Hash: z/usr/bin/audit2allowz

audit2allow)�stdin�stdoutrz /var/lib/sepolgen/interface_infoz
audit2allow -Rz-R)+r�r�Zformat_2_column_name_valueru�formatrvr�r�r�r�rwr�rsr�r�r�r9r:r<r8r;r?r@�splitrKr�r�r�r�r�r��record_typeZto_textZevent_idZ
fields_ordr�r�r�Zexist�Popen�PIPEZcommunicate�exists)
r+�replace�env�textr@Zdate_formatZavcbufZaudit2allowZnewbufr�r)r�r"�format_detailssl
(z#SEFaultSignatureInfo.format_detailsc
Os2t}t}zdd�add�a|||�S|a|aXdS)zdefine.*untranslated\(.*\ncSs|dkr|S|S)NrDr)r r!�zrrr"r#Xsz3SEFaultSignatureInfo.untranslated.<locals>.<lambda>cSs|S)Nr)r rrr"r#YsN)r�r�)r+�funcr�kwargsZsaved_translateP_Zsaved_translate_rrr"�untranslatedNs
z!SEFaultSignatureInfo.untranslatedcCs>|j�|j�}|j|�\}}�x|D�]\}}td�|jt|j�t|�ddf}||7}x"tt|�d�D]}	|td�7}qpW|td�7}|j	|j
|jj|��}
|td�|
7}|j	|j
|jj|��}
|td�|
dj�|
d	d�7}|j	|j|jj|��}
|td
�|
dj�|
d	d�7}q&W|td�7}|S)Nz0

*****  Plugin %s (%.4s confidence) suggests   �dg�?�Prr�z
Then rrDz
Do
z

)r�r�r�r�r~�floatr�rr�r�Zget_if_textr�r�Z
get_then_text�lowerr�)r+r�r�r�r�r�r�r�title�ir�rrr"�format_text_s"($(z SEFaultSignatureInfo.format_text)N)N)F)F)FF)$r-r.r/rZ
AuditEventr|rXr
rZ	TimeStamprrPr�r,r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rUrr)rCr"rsd

		

		/

"
CcsReZdZddd�d�ddidedd�d�dd	d
�d�Z�fdd
�Zdd�Z�ZS)rr0cCsdS)Nz1.0rrrrr"r#zszSEFaultUserInfo.<lambda>)r1r2r1r3cCsdS)NFrrrrr"r#|s)r1r4r2�
email_address)r1rO)r5rYZemail_alert�email_address_listcstt|�j�||_dS)N)rArr,rY)r+rY)rCrr"r,�szSEFaultUserInfo.__init__cCs||jkr|jj|�dS)N)r�r�)r+r�rrr"�add_email_address�s
z!SEFaultUserInfo.add_email_address)r-r.r/rTrPr,r�rUrr)rCr"rxscsHeZdZddd�d�dded�d�Z�fd	d
�Zdd�Zd
d�Z�ZS)rr0cCsdS)Nz1.0rrrrr"r#�szSEFaultUserSet.<lambda>)r1r2r3r�)r1rOr4)r5�	user_listcstt|�j�dS)N)rArr,)r+)rCrr"r,�szSEFaultUserSet.__init__cCs"x|jD]}||jkr|SqWdS)N)r�rY)r+rYr�rrr"�get_user�s
zSEFaultUserSet.get_usercCs*|j|�dk	rdSt|�}|jj|�|S)N)r�rr�r�)r+rYr�rrr"�add_user�s
zSEFaultUserSet.add_user)	r-r.r/rrPr,r�r�rUrr)rCr"r�s
cs�eZdZddd�d�dedd�d�dded	�d
�Z�fdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zde
jfdd�Z�ZS)rr0cCsdttfS)Nz%d.%d)ZDATABASE_MAJOR_VERSIONZDATABASE_MINOR_VERSIONrrrr"r#�szSEFaultSignatureSet.<lambda>)r1r2r3cCst�S)N)rrrrr"r#�s)r1r4r2r))r1rOr4)r5r��signature_listcstt|�j�dS)N)rArr,)r+)rCrr"r,�szSEFaultSignatureSet.__init__ccsx|jD]
}|VqWdS)N)r�)r+r)rrr"�siginfos�szSEFaultSignatureSet.siginfoscCs|jj|�|S)N)r�r�)r+r)rrr"�add_siginfo�szSEFaultSignatureSet.add_siginfocCs|jj|�dS)N)r��remove)r+r)rrr"�remove_siginfo�sz"SEFaultSignatureSet.remove_siginfocCs
g|_dS)N)r�)r+rrr"�clear�szSEFaultSignatureSet.clearcCsttj��S)N)rH�uuidZuuid4)r+rrr"�generate_local_id�sz%SEFaultSignatureSet.generate_local_idcCs.|dkrdSx|jD]}|j|kr|SqWdS)N)r�r�)r+r�r)rrr"�lookup_local_id�s
z#SEFaultSignatureSet.lookup_local_id�exactc
Cs�t|j��}d}|dkrd}n(t|t�r:t|�}d|}ntd|��g}x�|jD]�}	d}
|	j}x>|D]6}t||�t||�kr�|r�d}
q�|
|7}
qf|rfd}
PqfW|r�|
dkr�|j	t
|	|
��qR|
|krR|j	t
|	|
��qRW|jtdd��d	�|S)
NFr�Tg�?zunknown criteria = %sgcSst|j|j�S)N)r�r*)r�r�rrr"r#�sz6SEFaultSignatureSet.match_signatures.<locals>.<lambda>)r�)
rOrQr�r�r�rdr�r�rRr�rr�r)
r+ZpatZcriteriaZxml_infoZ
match_targetsr�Znum_match_targetsZscore_per_match_targetZmatchesr)r*r�rSrrr"�match_signatures�s6



z$SEFaultSignatureSet.match_signatures)r-r.r/rrrPr,r�r�r�r�r�r�r
r�rUrr)rCr"r�s
cs6eZdZddiddiddid�Zd�fdd�	Z�ZS)rr1r3)rS�
friendly_name�filepathNcs<tt|�j�|dk	r||_|dk	r*||_|dk	r8||_dS)N)rArr,rSrr)r+rSrr)rCrr"r,�szSEDatabaseProperties.__init__)NNN)r-r.r/rPr,rUrr)rCr"r�scs@eZdZddidedd�d�d�Zd�fdd	�	Zd
d�Z�ZS)
rr1r3cCstS)N)rrrrr"r#�szSEEmailRecipient.<lambda>)r1r4r2)�addressrVNcs&tt|�j�||_|dk	r"||_dS)N)rArr,rrV)r+rrV)rCrr"r,�szSEEmailRecipient.__init__cCsd|jtj|jd�fS)Nz%s:%sr`)rrbrcrV)r+rrr"r�szSEEmailRecipient.__str__)N)r-r.r/rXrPr,r�rUrr)rCr"r�scsneZdZddd�d�dded�d�Zd�fd
d�	Zdd
�Zdd�Zefdd�Z	dd�Z
dd�Zdd�Z�Z
S)rr0cCsdS)Nr�rrrrr"r#szSEEmailRecipientSet.<lambda>)r1r2r3�	recipient)r1rOr4)r5�recipient_listNcs tt|�j�|dk	r||_dS)N)rArr,r)r+r)rCrr"r,szSEEmailRecipientSet.__init__cCsdjdd�|jD��S)Nr�cSsg|]}t|��qSr)rH)r�r rrr"r�sz/SEEmailRecipientSet.__str__.<locals>.<listcomp>)rKr)r+rrr"r�szSEEmailRecipientSet.__str__cCs*|j�}x|jD]}||jkr|SqWdS)N)�striprr)r+rrrrr"�find_addresss

z SEEmailRecipientSet.find_addresscCsP|j�}t|�s$ttd|d��dS|j|�}|dk	r:dS|jjt||��dS)Nzaddress='%s')�detail)rZvalid_email_addressr[�ERR_INVALID_EMAIL_ADDRrrr�r)r+rrVrrrr"�add_addresss
zSEEmailRecipientSet.add_addresscCs
g|_dS)N)r)r+rrr"�clear_recipient_list)sz(SEEmailRecipientSet.clear_recipient_listcCs�ddl}|jd�}|jd�}|jd�}ddddddddd�}yt|�}Wn8tk
r�}zttd||jfd	��WYdd}~XnX|j��x|j�D�]}	|j	d
|	�}	|	j
�}	|	r�|j|	�}
|
r�|
jd�}|
jd�}d}
|�rNxl|j
|�D]^}
|
jd�}|
jd
�}|dk�r:tj|j�d�}
|
dk�rJtd||f�q�td||f�q�Wy|j||
�Wq�tk
�r�}z"|jtk�r�t|j�n|�WYdd}~Xq�Xq�W|j�dS)Nrz#.*z(\S+)(\s+(.+))?z(\w+)\s*=\s*(\S+)TF)Zenabled�truer�ZonZdisabledZfalse�noZoffz%s, %s)rr�rD��rVz(unknown email filter (%s) for address %sz(unknown email option (%s) for address %s)r��compile�open�IOErrorr[�
ERR_FILE_OPEN�strerrorr
�	readlinesr�r�search�group�finditer�map_filter_name_to_valuercr�rar	�errnor�close)r+rr�Z
comment_reZentry_reZkey_value_reZmap_booleanr��e�line�matchrZoptionsrVZoptionr�rrr"�parse_recipient_file,sT


(






z(SEEmailRecipientSet.parse_recipient_filecCs�yt|d�}Wn8tk
rF}zttd||jfd��WYdd}~XnXx,|jD]"}t|j}|jd|j	|f�qPW|j
�dS)N�wz%s, %s)rz%-40s filter_type=%s
)rrr[rrrrbrV�writerr)r+rr�rrrVrrr"�write_recipient_fileds(
z(SEEmailRecipientSet.write_recipient_file)N)r-r.r/rrPr,r�rrr	r
rr!rUrr)rCr"r	s8rDzaudit_listener_database.xml�sigszsiginfo.audit_event=%sz	Memory OKzMemory leak %d bytes)KZ
__future__rrZsixZsyslog�
subprocessZ	six.movesr�	functoolsr�gettextZsetroubleshoot.configrrZtranslationZugettextr��AttributeError�__all__r-Zinstallrr�Zsetroubleshoot.errcodeZsetroubleshoot.utilZsetroubleshoot.xml_serializeZsetroubleshoot.html_utilZsetroubleshoot.uuidr�Zsetroubleshoot.audit_datar��types�stringrr�r�r�rrrrrbr�objectrZXmlSerializerrrrorqrrr
rrrrrrrrZlibxml2ZdebugMemoryZxml_filer"Z
read_xml_filer�r)r�r��record�printr�Z
cleanupParserZ
dumpMemoryrrrr"�<module>s�

4!gHk






Filemanager

Name Type Size Permission Actions
Plugin.cpython-36.opt-1.pyc File 5.11 KB 0644
Plugin.cpython-36.pyc File 5.11 KB 0644
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
access_control.cpython-36.opt-1.pyc File 3.89 KB 0644
access_control.cpython-36.pyc File 3.89 KB 0644
analyze.cpython-36.opt-1.pyc File 22.17 KB 0644
analyze.cpython-36.pyc File 22.17 KB 0644
audit_data.cpython-36.opt-1.pyc File 27.42 KB 0644
audit_data.cpython-36.pyc File 27.42 KB 0644
avc_audit.cpython-36.opt-1.pyc File 12.36 KB 0644
avc_audit.cpython-36.pyc File 12.36 KB 0644
config.cpython-36.opt-1.pyc File 11.49 KB 0644
config.cpython-36.pyc File 11.49 KB 0644
email_alert.cpython-36.opt-1.pyc File 1.77 KB 0644
email_alert.cpython-36.pyc File 1.77 KB 0644
errcode.cpython-36.opt-1.pyc File 2.63 KB 0644
errcode.cpython-36.pyc File 2.63 KB 0644
html_util.cpython-36.opt-1.pyc File 5.25 KB 0644
html_util.cpython-36.pyc File 5.25 KB 0644
rpc.cpython-36.opt-1.pyc File 28.32 KB 0644
rpc.cpython-36.pyc File 28.32 KB 0644
rpc_interfaces.cpython-36.opt-1.pyc File 4.75 KB 0644
rpc_interfaces.cpython-36.pyc File 4.75 KB 0644
server.cpython-36.opt-1.pyc File 25.04 KB 0644
server.cpython-36.pyc File 25.04 KB 0644
serverconnection.cpython-36.opt-1.pyc File 5.24 KB 0644
serverconnection.cpython-36.pyc File 5.24 KB 0644
signature.cpython-36.opt-1.pyc File 28.08 KB 0644
signature.cpython-36.pyc File 28.08 KB 0644
util.cpython-36.opt-1.pyc File 25.73 KB 0644
util.cpython-36.pyc File 25.73 KB 0644
uuid.cpython-36.opt-1.pyc File 16.13 KB 0644
uuid.cpython-36.pyc File 16.13 KB 0644
xml_serialize.cpython-36.opt-1.pyc File 9.89 KB 0644
xml_serialize.cpython-36.pyc File 9.89 KB 0644