HEX
Server: Apache
System: Linux hp3-stn-1011028.hostingp3.local 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: csh958633 (951153)
PHP: 8.3.30
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: //lib64/python2.7/site-packages/setroubleshoot/audit_data.pyc
�
��^c@s�ddddddddgZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZdd
lTdd	l	j
Z
dd	lZdd
lTdd
l
Tdd
lTdd
lTdZe�Zd�Zd
�Zejd�Zd�Zejd�Zd�Zdd	lZd�Zdefd��YZdefd��YZdefd��YZddd��YZ defd��YZ!ddd��YZ"d	S(tderive_record_formattparse_audit_record_textt
AvcContexttAVCtAuditEventIDt
AuditEventtAuditRecordtAuditRecordReaderi����N(t*icCs.t|�\}}}}t|||�}|S(N(RR(ttexttparse_succeededtrecord_typetevent_idt	body_texttaudit_record((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytaudit_record_from_text7scCs9tjd|�rtjStjd|�r2tjStjS(Ns/audispd_events$s/audit_events$(tretsearchRtTEXT_FORMATt
BINARY_FORMAT(tsocket_path((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR>s
sL(node=(\S+)\s+)?(type=(\S+)\s+)?(msg=)?audit\(((\d+)\.(\d+):(\d+))\):\s*(.*)c
Cs	t}d}d}d}d}tj|�}|dk	r�t}|jd�r`|jd�}n|jd�r�|jd�}n|jd�r�t|jd��}t|jd��}t|jd��}	t|||	|�}n|jd�}n||||fS(Niiiiii	i
(tFalsetNonetaudit_input_reRtTruetgrouptintR(
tinputR
thostRRR
tmatchtsecondstmillitserial((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyRWs&s%audit\(((\d+)\.(\d+):(\d+))\):\s*(.*)cCs�t}d}d}tj|�}|dk	r�t}|jd�r�t|jd��}t|jd��}t|jd��}t|||�}n|jd�}n|||fS(Niiiii(RRtaudit_binary_input_reRRRRR(RR
RR
RRRR ((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytparse_audit_binary_texttscCsE|rAg|D]}|tjkr
|^q
}||krAtSntS(N(tstringt	printableRR(tstxt
filtered_path((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR$�s
(cBsseZiidd6d6idd6d6idd6d6idd6d6Zd�Zd�Zd�Zd	�Zd
�ZRS(t	attributetXMLFormtusertrolettypetmlscCs�tt|�j�t|�tkr�|jd�}t|�dkr�|d|_|d|_|d|_t|�dkr�dj	|d�|_
q�d|_
q�ndS(Nt:iiiits0(tsuperRt__init__R,t
StringTypetsplittlenR*R+tjoinR-(tselftdatatfields((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR1�s


cCs d|j|j|j|jfS(Ns%s:%s:%s:%s(R*R+R,R-(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt__str__�scCstjt|��\}}|S(N(tselinuxtselinux_raw_to_trans_contexttstr(R6trcttrans((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytformat�scCs|j|�S(N(t__eq__(R6tother((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt__ne__�scCsFx?t|jj��D](}t||�t||�krtSqWtS(N(tlistt	_xml_infotkeystgetattrRR(R6RAtname((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR@�s(t__name__t
__module__RDR1R9R?RBR@(((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�s	
			cBs�eZiidd6ed6d6idd6ed6d6idd6ed6d6idd6d6Zdd�Zd�Zd	�Zd
�Ze	d��Z
d�Zd
�ZRS(R(R)timport_typecastRRR RcCsJtt|�j�||_||_||_|dk	rF||_ndS(N(R0RR1RRR RR(R6RRR R((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR1�s			cCs\|j|jkrtS|j|jkr,tS|j|jkrBtS|j|jkrXtStS(N(RRRRR R(R6RA((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR@�scCs�|j|jkr:td|jj|j|jf��nt|j|j�}|dkr_|St|j|j�}|dkr�|St|j|j�}|dkr�|SdS(Ns?cannot compare two %s objects whose host values differ (%s!=%s)i(Rt
ValueErrort	__class__RHtcmpRRR (R6RAtresult((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt__cmp__�s"cCsddl}|j|�S(Ni����(tcopy(R6RP((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyRP�scCst|j�|jdS(Ng@�@(tfloattsecR(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt<lambda>�scCsd|j|j|jfS(Nsaudit(%d.%d:%d)(RRR (R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR9�scCs=|jdkrtS|jdkr&tS|jdkr9tStS(N(RRRRR R(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytis_valid�sN(
RHRIRRDRR1R@RORPtpropertyttimeR9RT(((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�s				cBs eZiidd6d6idd6ed6d6idd6d6idd6ed6d6ZdZd	Zeje�Z	e
jd
�Ze
jd�Z
e
jd�Zddd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(R(R)RtelementRJRR
tline_numberitiiiis([^ 	]+)\s*=\s*([^ 	]+)s$avc:\s+([^\s]+)\s+{([^}]+)}\s+for\s+s^a\d+$cCsNtt|�j�||_||_||_||_||_|j�dS(N(	R0RR1RRR
R8RXt_init_postprocess(R6RRR
R8RX((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR1s					cCs�t|dd�dkr+|j|j�n|jd
kr�d|jkr�tjj|j�}|r�|j	d�}||jd<|j	d�}|j
�|jd	<q�q�ndS(NR8RtUSER_AVCt1400t1107tseresultiitseperms(sAVCR[R\R](RFRtset_fields_from_textR
RR8Rtavc_reRRR3(R6RR^R_((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyRZ
s
cCs
|j�S(N(tto_host_text(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR9scCs1d|_|jjdkr-t�|j_ndS(N(RRXRRtget_hostname(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytaudispd_rectifys	cCs=|jj�stS|jdkr&tS|jdkr9tStS(N(RRTRRRtmessageR(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyRT scCsddddddddd	d
ddd
dddg}xg|D]_}||jkr=|jdkrs|dkrsq=n|j|}t|�}||j|<q=q=W|jdkrxat|jj��D]G\}}|jj|�r�|j|}t|�}||j|<q�q�WndS(NtaccttcmdtcommtcwdR7tdirtexetfileRtkeytmsgRGtnewtocommoldtpathtwatchRtsaddrtEXECVE(R8Rtaudit_msg_decodeRCtitemstexec_arg_reR(R6tencoded_fieldstfieldtvaluet
decoded_value((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt
decode_fields&s 

"
cCsIy:tjddkr#|jd�Stj|�jd�SWn|SXdS(Niithexsutf-8(tsystversion_infotdecodet	bytearraytfromhex(R6Rq((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt
translate_hex:s
cCsvg|_i|_x]tjj|�D]I}|jd�}|jd�}|jd�}y�|dkr�tjt	|d��}tj
|�}n|dkr�|jd�jd�s�|j|�}q�n|dkryt
jtt	|��}WqqXn|d
kr<tjt	|�tj��}|r<|}q<nWntk
rPnX||j|<|jj|�q%WdS(Niit"tarchiRGRqRhRgRkRitexittsyscall(snamespathscommscmdsexescwd(t
fields_ordR8Rtkey_value_pair_retfinditerRtstriptaudittaudit_elf_to_machineRtaudit_machine_to_namet
startswithR�terrnot	errorcodetabstaudit_syscall_to_nametaudit_detect_machineRKtappend(R6R
RRmRztitsyscall_name((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR`Is4		

cCs|jj|�S(N(R8tget(R6RG((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt	get_fieldkscCs1t|�}tjtjtjtj|j|�S(N(R4tstructtpackRtbinary_header_formattbinary_versiontbinary_header_sizeR(R6Rnt
msg_length((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytget_binary_headernscCs�|jdkrdS|jdkrJd|j|jdj|j�f}nd|j|jf}|djg|jD]}d||j|f^qs�d7}|S(NtRs#type=%s msg=%s: avc: denied { %s } t stype=%s msg=%s: s%s=%ss
(R8RRRR5taccessR�(R6tbuftk((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytfields_to_textss(>cCsd|j|j|jfS(Nstype=%s msg=%s: %s
(RRR
(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytto_text{scCsC|jjdk	r5d|jj|j|j|jfS|j�SdS(Nsnode=%s type=%s msg=%s: %s
(RRRRR
R�(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyRb~s cCs'd|j|jf}|j|�|S(Ns%s: %s(RR
R�(R6trecord((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt	to_binary�sN(RHRIRRRDR�R�R�tcalcsizeR�RtcompileR�RaRwRR1RZR9RdRTR|R�R`R�R�R�R�RbR�(((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�s2
							"					cBs/eZdZdZd�Zd�Zd�ZRS(iicCs}||_d|_d|_|j|jkr<|j|_n=|j|jkr]|j|_ntd||j	j
f��dS(NR�is unknown record format (%s) in %s(t
record_formatt
_input_bufferRXRt	feed_texttfeedRtfeed_binaryRKRLRH(R6R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR1�s			ccst|�dkrdS|j|7_x�tr�t|j�tjkrJdStjtj|jdtj!�\}}}}tj|}t|j�|kr�dS|jtj|!}t|�\}}	}
|j||_|r(t	j
|�|	|
ddfVq(q(WdS(Ni(R4R�RRR�R�tunpackR�R"R�taudit_msg_type_to_nameR(R6tnew_dataR�R�RR�t	total_lenR	R
RR
((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR��s"	"
$c	cs�t|�dkrdS|j|7_d}|jjd|�}x�|dkr�|jd7_|d7}|j||!}t|�\}}}}|r�|||d|jfVn|}|jjd|�}qCW|j||_dS(Nis
i(R4R�tfindRXRR(	R6R�tstarttendtlineR
RRR
((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR��s 
(RHRIRRR1R�R�(((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�s
		!cBs�eZiidd6dd6ed6d6idd6ed6d6Zd�Zd�Zd	�Zd
d�Zd�Z	e
d
��Zd�Zd�Z
dd�Zd�Zd�Zd�Zd�Zd�ZRS(RWR)RRCRJtrecordsRcCs;tt|�j�d|_g|_i|_d|_dS(N(R0RR1RRR�trecord_typest	timestamp(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR1�s
			cCsIt|dd�dkr$i|_nx|jD]}|j|�q.WdS(NR�(RFRR�R�tprocess_record(R6R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyRZ�sc
Cs~|j}|j�d|j|j�|j�djg|D]}t|�^q;�djg|jD]}d|^qc�fS(Ns2%s: is_avc=%s, is_granted=%s: line_numbers=[%s]
%st,s
s    %s(tline_numberstsortRtis_avct
is_grantedR5R<R�(R6R�R&R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR9�s	
%s
cCs)|jg|jD]}t|�^q�S(N(R5R�R<(R6t	separatorR�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR?�scCs
t|j�S(N(R4R�(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytnum_records�scCs&g|jD]}|jr
|j^q
S(N(R�RX(R6R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyRS�scCs!|jj|�|j|�dS(N(R�R�R�(R6R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt
add_record�scCs�|jdkrG|jj�|_t|jj�|jjd|_n1|j|jksxtd|j|jf��n|jj	|j
g�}|j|�dS(Ng@�@sBcannot add audit record to audit event, event_id mismatch %s != %s(RRRPRQRRR�RKR�t
setdefaultRR�(R6R�trecord_list((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR��s&cCs|g}|dkr|j}n|j|�}xH|D]@}|jj|�}|dkr^q4n|j||jf�q4W|S(sNReturn list of (value, record_type) tuples.
        In other words return the value matching name for every record_type.
        If record_type is not specified then all records are searched.
        Note: it is possible to have more than one record of a given type
        thus it is always possible to have multiple values returned.N(RR�tget_records_of_typeR8R�R�R,(R6RGRRvR�R�Rz((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�s
cCs/d}|jj|�}|r+|d}n|S(Ni(RR�R�(R6R,R�R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytget_record_of_types

cCs|jj|g�S(N(R�R�(R6R,((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�$scCs:x3ddddgD]}|j|�}|r|SqWdS(NRR[R\R](R�(R6RR�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytget_avc_record'scCs|j�dk	S(N(R�R(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�-scCs`|j�}|dkrtS|jd}|dkr9tS|dkrItStjjd|�tS(NR^tdeniedtgranteds!unknown value for seresult ('%s')(R�RRR8Rtlogtavctwarn(R6t
avc_recordR^((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�0s
N(RHRIRRRDR1RZR9R?R�RUR�R�R�RR�R�R�R�R�R�(((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR�s"										cBsteZdgZddgZdddddgZddddddgZddddddgZdddd	gZd
dddddd	gZdd
dddddddddd	gZ	ddddd
dgZ
ddddd
ddddg	Zddddd
dddgZdd
dddddddd	d
dddddgZ
ddddgZdd
gZdgZdgZddd
dddgZddd
ddddgZddd
ddddgZdd
ddddddd	d
ddddddgZdgZdgZdddddgZdddddgZddddddgZdddddddgZddgZdd
dddddd	ddddgZejd�Z ejd�Z!e"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d �Z,d!�Z-d"�Z.d#�Z/d$�Z0d%�Z1d&�Z2d'�Z3d(�Z4d)�Z5d*�Z6RS(+RFtexecutetopentreadtlocktioctlR�tlinktunlinktrenametcreatetsetattrtwriteRtadd_nametremove_nametreparenttrmdirtmounttremounttunmounts^(\w+):\[([^\]]*)\]s^(/proc/)(\d+)(.*)cCs�||_||_i|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_g|_
g|_d|_d|_d|_d|_d|_g|_|j�dS(N(taudit_eventtquery_environmentttemplate_substitutionsRttpathtspathtsourcet
source_pkgR�tscontextttcontextttclasstporttsrc_rpmsttgt_rpmsRtpidtkmodR�twhytboolst derive_avc_info_from_audit_event(R6R�R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR1es*																				cCs
|j�S(N(t
format_avc(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR9~scCs_d}|d|j7}|d|j7}|d|j7}|d|j7}|d|j7}|S(NR�sscontext=%s stcontext=%s s
access=%s s
tclass=%s s	tpath=%s (R�R�R�R�R�(R6R	((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR��scCs;|jdkrtSx!|jD]}||krtSqWtS(sMReturns true if the AVC contains _any_ of the permissions in the access list.N(R�RRR(R6taccess_listta((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pythas_any_access_in�scCs;|jdkrtSx!|jD]}||krtSqWtS(smReturns true if _every_ access in the AVC matches at
        least one of the permissions in the access list.N(R�RRR(R6R�R�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytall_accesses_are_in�sc
Cs8t�t�}|j�t�}|j�g}ttgi|jjt6|j	t
6|jt6�}|spgSgg|D]}|drz|^qzD]}|t
^q�}|}x;|D]3}	|	|kr�|jtt|	�dd�q�q�Wx9|D]1}	|	|kr�|	|kr&|j|	�q&q�q�W|j�|S(Ntenabledittypes(tget_all_file_typestget_all_port_typesR�tget_all_attributesRtALLOWR�R,tSOURCER�tCLASSR�tPERMStTARGETtextendtinfot	ATTRIBUTER�(
R6t	all_typestall_attributest
allowed_typestallow_rulestyR&twtypesR�tt((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytallowed_target_types�s&
	
3:
%

cCsP|jdg�rLy-|jr>t|j�t@tjkr>tSWqLqLXntS(NR�(R�ta1Rt	O_ACCMODEtostO_RDONLYRR(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytopen_with_write�s%cCs�y=tt|j�d}|jdg�}|j|d�Wntk
r^}|jg}nXx5|D]-}x$|D]}tj||�rstSqsWqfWt	S(NitaliasesRG(
RtTYPER,R�R�tRuntimeErrorRRRR(R6tcontextt	type_listt_infotctypest
IndexErrorR,R((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt__typeMatch�s

cCs&|jdkrtS|j|j|�S(sReturns true if the type in the source context of the
        avc regular expression matches any of the types in the type list.N(R�RRt_AVC__typeMatch(R6R((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytmatches_source_types�scCs&|jdkrtS|j|j|�S(sReturns true if the type in the target context of the
        avc regular expression matches any of the types in the type list.N(R�RRR(R6R((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytmatches_target_types�scCs |jdkrtS|j|kS(N(R�RR(R6ttclass_list((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt
has_tclass_in�scCs|j�|j�dS(N(tderive_environmental_infot%update_derived_template_substitutions(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytupdate�s
cCs |jdkrtS|jtkS(N(R�RRtstandard_directories(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytpath_is_not_standard_directory�sc	CsRd}|jjd�}|jjd�}|jjd�}|dkr�|jjd�}xr|D]g}|jd�}|r�|dkr�qan|jd�}|ra|ra|dkra|j|�raPqaqaWn|dkr^|jjd�}|dk	r^|jjd�}|dkr$d	|}q[|d
krR|dkrE|}qXd	|}q[|}q^n|dk	rx|dkr�|r�g}yd}	|jjd
�}
tjjd|
�r�tj	d|
�j
}	nt|�}tdd�}x�|j
�jd�D]�}
|
j�}t|�r�|dddkr�yb|	dksZtj|d�j
|	kr�ttj	|d�j�|kr�|j|d �nWq�tk
r�q�q�Xq�q�W|j�t|�dkr�|dd}n�t|�dkr�x�|D]�}
|
dd|
ks|
d|
kr-|
d}Pq�y:|	dkrftj	|
d�j
|	krf|
d}PnWq�tk
rzq�Xq�WnWqutk
r�d}qutk
r�d}quXqx|jd�tkrx|rxddl}ddd|g}yx|j|d|j�}t|�}xM|jd�D]<}y,ttj	|�j�|krX|}PnWq'q'Xq'WWququXqxn|dk	r�|jd�r�|jjd|�}q�|jj|�}|r�|j}q�n||_ |j dkrN|jdkrd|_ qN|jd ks#|jd!kr<t!d"�|j"|_ qNt!d#�|_ ndS($s�Derive the target path.

        If path information is available the avc record will have a path field
        and no name field because the path field is more specific and supercedes
        name. The name field is typically the directory entry.

        For some special files the kernel embeds instance information
        into the file name. For example 'pipe:[1234]' or 'socket:[1234]'
        where the number inside the brackets is the inode number. The proc
        pseudo file system has the process pid embedded in the name, for
        example '/proc/1234/mem'. These numbers are ephemeral and do not
        contribute meaningful information for our reports. Plus we may use
        the path information to decide if an alert is identical to a
        previous alert, we coalesce them if they are. The presence of an
        instance specific number in the path confuses this comparison.
        For these reasons we strip any instance information out of the
        path,

        Example input and output:

        pipe:[1234]    --> pipe
        socket:[1234]  --> socket
        /proc/1234/fd  --> /proc/<pid>/fd
        ./foo          --> ./foo
        /etc/sysconfig --> /etc/sysconfig
        RGRqtinotPATHtobjtypetPARENTR�Rls%sRjt/itdevs/dev/s/proc/mountstrs
iis/dev/%sisunknown mountpointi����Ntlocates-bs\%ststderrs	\1<pid>\3t
filesystemR�t
udp_sockett
tcp_socketsport %stUnknown(#RR�R�R�R�tendswithRRqtexiststlstattst_rdevRR�R�R3R4tstattst_inoR�tOSErrortcloset	TypeErrorR�Rt
subprocesstcheck_outputtSTDOUTtproc_pid_instance_retsubtpipe_instance_path_reRR�R�t_R�(R6RqRGtinodestrtavc_path_recordstavc_path_recordRR�tmatchestdev_rdevR+R&tfdR�R&R<tcommandtoutputRlR((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt
_set_tpath�s�
'
	
 J


$
(




	cCsd|_d|_d|_d|_t|_g|_d}}}}|jj	�|_
|jjd�}|j
jd�|_
t|jt�s�t|j
jd��|_nt|jt�s�t|j
jd��|_n|j
jd�|_|j
jd�dkr&|j
jd�|_n|j
jd�|_|j�|j
jd�|_|j
jd	�|_|r�|jd
�}|jd�}|jd�|_|jd
�dk|_|jd�|_n|dkr�|j
jd�}n|dkr|j
jd
�}n||_|r/||_n|rD|j|_n|js\|j|_n|jsw|jj|_n|jjd�}|r�|jd�}nd}|jjd�}xh|D]`}	|	jd�}
tjj|
�s�|r|jj|
�q�|jjtjj||
��q�Wg|_g|_ |jj!j"|_"t#j$t%|j�t%|j�t%|j�|j
�\|_&}|j&t#j'kr�t(t)d�|j
��n|j&t#j*kr�t(t)d�|j
��n|j&t#j+kr
t(t)d���n|j&t#j,kr8t(t)d�|j
��n|j&t#j-krft(t)d�|j
��n|j&t#j-kr�t(t)d�|j
��n|j&t#j.kr�t(t)d�|j
��n|j&t#j/kr�t(t)d���n|j&t#j0kr||_1ndS(NtSYSCALLR_R�R�R�tdesttsrcR�R�RkRhR�tsuccesstyesRtCWDRiR'RGs3%s 
**** Invalid AVC allowed in current policy ***
se%s 
**** Invalid AVC dontaudited in current policy.  'semodule -B' will turn on dontaudit rules. ***
sMust call policy_init firsts-%s 
**** Invalid AVC bad target context. ***
s-%s 
**** Invalid AVC bad source context. ***
s(%s 
**** Invalid AVC bad type class ***
s(%s 
**** Invalid AVC bad permission ***
s&Error during access vector computation(2RR�R�R�RRROt
syscall_pathsR�R�R�R�R�R�t
isinstanceR�RR�R�R�RKR�R�R�R,R�RRqtisabsR�R5R�R�RRt	audit2whytanalyzeR<R�R�RKRBt	DONTAUDITtNOPOLICYtBADTCONtBADSCONtBADPERMt
BADCOMPUTEtBOOLEANR�(R6RkRhR�R�tsyscall_recordt
cwd_recordRitpath_recordstpath_recordRqR�((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR��s�						
			
#		?cCs�|jr}|jrFt|j�|_|jrF|jj|j�qFn|jr}t|j�}|rz|jj|�qzq}ndS(N(R�R�tget_rpm_nvr_by_file_pathR�R�R�R�R�(R6trpm((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR!�s				cCs|jdkr||_ndS(N(R�R(R6Rq((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytset_alt_path�scKs=x6t|j��D]"\}}|r||j|<qqWdS(N(RCRvR�(R6tkwdsRmRz((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytset_template_substitutions�scCs�t|jj�|jd<t|jj�|jd<t|j�|jd<t|j�|jd<|jr�tjddt|j��|jd<nt|j	�|jd<|j	r�tjddt|j	��|jd	<n|j	dkr�d|jd
<ni|jdkrt|j	�|jd
<nA|jdkrQttj
j|j	��|jd
<n
d|jd
<t|j�|jd
<|jdkr�d|jd<ntdj|j��|jd<t|j�|jd<t|j�|jd<dS(NtSOURCE_TYPEtTARGET_TYPER�tSOURCE_PATHR�t.tFIX_SOURCE_PATHtTARGET_PATHtFIX_TARGET_PATHt
TARGET_DIRRjRltTARGET_CLASStACCESStSOURCE_PACKAGEtPORT_NUMBER(tescape_htmlR�R,R�R�R�R�RR@R�RR�RRqtdirnameR�R5R�R�(R6((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR"�s,	(	(%
cCsRxKt|jj��D]4\}}|dkrtt|��|j|<qqWdS(N(RCR�RvRRstdefault_text(R6RmRz((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pytvalidate_template_substitutionss"(7RHRItstat_file_permstx_file_permstr_file_permst
rx_file_permst
ra_file_permstlink_file_permstcreate_lnk_permstcreate_file_permstr_dir_permstrw_dir_permstra_dir_permstcreate_dir_permstmount_fs_permstsearch_dir_permstgetattr_dir_permstsetattr_dir_permstlist_dir_permstadd_entry_dir_permstdel_entry_dir_permstmanage_dir_permstgetattr_file_permstsetattr_file_permstread_file_permstappend_file_permstwrite_file_permst
rw_file_permstdelete_file_permstmanage_file_permsRR�RAR?RR1R9R�R�R�R
RRRRR R#R%RKR�R!RdRfR"Rv(((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyR>sl	!						
	
			
							�	c	
			 (((#t__all__R�R�RR�RR:tbase64R�tselinux.audit2whyRUR~tsetroubleshoot.utiltsetroubleshoot.html_utiltsetroubleshoot.xml_serializetsepolicyRtget_standard_directoriesR$RRR�RRR!R"R#R$tXmlSerializeRRRRRR(((s?/usr/lib64/python2.7/site-packages/setroubleshoot/audit_data.pyt<module>sH	




						(8�Lg