+
        ē                     Z   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIt^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt Rt ^ RI t / t!]PD                  R8  d   R]!R&   ] PF                  ! ]3RR/]!BRR/B t$]$P@                  t%^t,^t-^t.^t/^t0^t1^t2Rt3Rt4Rt5Rt6Rt7Rt8Rt9Rt:Rt;Rt</ t=R]=R&   R]=R &   R!]=R"&   R!]=R#&   R!]=R$&   R%]=R&&   R']=R(&   R)]=R*&   R+]=R,&   R+]=R-&   R.]=R/&   R.]=R0&   R1]=R2&   R3]=R4&   / t>]%! R54      ]>R6&   ]%! R74      ]>R8&   ]%! R94      ]>R:&   ]%! R;4      ]>R<&   ]%! R=4      ]>R>&   ]%! R?4      ]>R@&   ]%! RA4      ]>RB&   ]%! RC4      ]>RD&   / t?R6]?RE&   R8]?RF&   R:]?RG&   R<]?RH&   R>]?RI&   R@]?RJ&   RB]?RK&   RD]?RL&   Rs@RsARsBRsCRsD. sERsFRsGRsHRsIRsJRsKRsLRsMRsNRsORsPRsQRsRRsSRsTRsURsVRsWRsXRM tYRRN ltZRO t[RP t\RQ t]RR t^RRS lt_RT t`RRU ltaRV tbRW tcRX tdRY teRZ tfR[ tgR\ th. 3R] lti. 3R^ ltjR_ tk]P                  ! 4       3R` ltm]P                  ! 4       3Ra ltn]P                  ! 4       3Rb lto]P                  ! 4       3Rc ltpRd tqRe trRf tsRg ttRh tuRi tvRj twRk txRl tyRm tzRn t{Ro t|Rp t}Rq t~Rr tRs tRt tRu tRv tRw tRx tRy tRz tR{ tR| tR} tR~ tR tR t]3R ltR tR tR tR tR tR tR tR tRR ltRR ltR tR tR tR tR#     ^ RI&t&]']&PP                  R&    EL_  ]) d    ^ RI*t*]+]*PP                  R&     EL}i ; i; i)    N)	BoolQuery)PortconQuery)SELinuxPolicy)ObjClassQuery)RBACRuleQuery)	RoleQuery)TERuleQuery)TypeAttributeQuery)	TypeQuery)	UserQueryzselinux-pythonTunicode	localedirz/usr/share/localefallback_allow
auditallow
neverallow	dontauditsourcetargetpermlistclass
transition
role_allowetc_tz/etctmp_tz/tmpunit_file_tz/usr/lib/systemd/systemz/lib/systemd/systemz/etc/systemd/systemvar_cache_tz
/var/cache	var_lib_tz/var/liblog_tz/var/log	var_run_tz/var/runz/run
var_lock_tz	/run/lockz/var/run/lockvar_spool_tz
/var/spool	content_tz/var/wwwz	all filesazregular filef	directorydzcharacter deviceczblock devicebzsocket fileszsymbolic linklz
named pipep z--z-dz-cz-bz-sz-lz-pc                 z    V P                  R ^4      ^,          p \        V4      V 3#   \         d    ^ T 3u # i ; i)z/policy.)rsplitint
ValueError)policy_path	extensions   & 6/usr/lib/python3.14/site-packages/sepolicy/__init__.pypolicy_sortkeyr6      sF    "":q1!4I9~{** +~s   ( ::c                      V \         P                  ! 4       ,           p\        P                  ! R V,          4      pVP                  \        R7       VR,          #     M; i\        \        R4      4      h)z%s.*keyzNo SELinux Policy installed)selinuxselinux_binary_policy_pathglobsortr6   r2   r   )rootpathpoliciess   &  r5   get_installed_policyrB      s_    g88::99Vd]+.)|
Q45
66s   AA Ac                    \         P                   ! \        P                  ! 4       : V : R24      pV'       g   R# VP                  \        R7       VR,          # )z?Get the path to the policy file located in the given store namez/policy/policy.*Nr8   r:   )r=   r;   selinux_pathr>   r6   )storerA   s   & r5   get_store_policyrF      sA    yy!..0%9 :HMMnM%B<    c                     R s R sR sR sR sR sR sR sR s \        V 4      s
R #    \        \        R4      T ,          4      h; i)NzFailed to read %s policy file)all_domainsall_attributesbools	all_typesrole_allowsusersroles
file_types
port_typesr   _polr2   r   policy_files   &r5   policyrU      s_     KNEIKEEJJK[)K:;kIJJs   ! >c                 F    \        V 4      pV'       g   R # \        V4       R # N)rF   rU   )rE   rT   s   & r5   load_store_policyrX      s    "5)K
;rG   c                  0    \        4       p \        V 4       R # rW   )rB   rU   rS   s    r5   init_policyrZ      s    &(K
;rG   c                    \         '       g   \        4        V \        8X  dv   \        \         4      pWn        \        VP                  4       4      pV'       d7   \        V4      ^8  d'   RVn        Wn        \        VP                  4       4      pR V 4       # V \        8X  d5   \        \         4      pV'       d   Wn        R VP                  4        4       # V \        8X  d5   \        \         4      pV'       d   Wn        R VP                  4        4       # V \        8X  d   \        \         4      pV'       dh   VP                  R4       Uu. uF  p\!        V4      NK  	  pp\        V4      ^8X  d   WRn        M'\        V4      ^8X  d   V^ ,          V^ ,          3Vn        \         P$                  '       d   R VP                  4        4       # R VP                  4        4       # V \&        8X  db   \)        \         4      pV'       d   Wn        \         P$                  '       d   R VP                  4        4       # R	 VP                  4        4       # V \*        8X  d5   \-        \         4      pV'       d   Wn        R
 VP                  4        4       # V \.        8X  d5   \1        \         4      pV'       d   Wn        R VP                  4        4       # \3        R4      hu upi )   Nc              3     "   T Fu  pR \        \        \        VP                  4       4      4      R\        V4      R\	        VP
                  4      R\        \        \        VP                  4       4      4      /x  Kw  	  R# 5i)aliasesname
permissive
attributesN)listmapstrr^   boolispermissivera   .0xs   & r5   	<genexpr>info.<locals>.<genexpr>   sb      
 a	 tCQYY[12CF$q~~.$s378	

 s   A=A?c              3      "   T F`  pR \        V4      R\        \        \         VP                  4       4      4      R\        \        \         VP	                  4       4      4      /x  Kb  	  R# 5i)r_   rO   typesN)rd   rb   rc   expandrm   rg   s   & r5   rj   rk      sT        a CFT#c188:./T#c1779-.
 s   A(A*c              3      "   T F9  pR \        V4      R\        \        \         VP                  4       4      4      /x  K;  	  R# 5i)r_   rm   N)rd   rb   rc   rn   rg   s   & r5   rj   rk      s=        a CFT#c188:./
 s   AA-c              3   $  "   T F  pR VP                   P                  R\        VP                  4      R\        VP                  P
                  4      R\        VP                  P                  4      RVP                   P                  /x  K  	  R# 5i)highprotocolrangetypelowN)portsrr   rd   rs   contextrange_type_rv   rg   s   & r5   rj   rk      sj      $ #! C

OQYY--.AIIOO,qww{{ #s   BBc           	   3      "   T Fg  pR VP                   P                  R\        VP                  4      R\        VP                  P
                  4      RVP                   P                  /x  Ki  	  R# 5i)rr   rs   ru   rv   N)rw   rr   rd   rs   rx   rz   rv   rg   s   & r5   rj   rk     sV       
 a	 AGGLLAJJC		(177;;	

 s   A/A1c              3      "   T F_  pR \        VP                  4      R\        V4      R\        \        \         VP                  4      4      R\        VP
                  4      /x  Ka  	  R# 5i)rt   r_   rO   levelN)rd   	mls_rangerb   rc   rO   	mls_levelrg   s   & r5   rj   rk     sW      $
 #!	 Q[[)Ac#qww/0Q[[)	
 #s   A'A)c           
   3      "   T F5  pR \        V4      R\        \        \         VP                  4      4      /x  K7  	  R# 5i)r_   rO   N)rd   rb   rc   rO   rg   s   & r5   rj   rk     s;        a CFT#c177+,
 s   =?c              3   T   "   T F  pR \        V4      RVP                  /x  K   	  R# 5i)r_   stateN)rd   r   rg   s   & r5   rj   rk     s/        a CFQWW
 s   &(c              3   f   "   T F'  pR \        V4      R\        VP                  4      /x  K)  	  R# 5i)r_   r   N)rd   rb   permsrg   s   & r5   rj   rk   )  s3        a CFQWW
 s   /1zInvalid type)rR   rZ   TYPEr   r_   rb   resultslenaliasROLEr   	ATTRIBUTEr
   PORTr   splitr1   rw   mlsUSERr   BOOLEANr   TCLASSr   r2   )setyper_   qr   irw   s   &&    r5   infor      sP   4~dOqyy{#CL1$AFG199;'G
  	 
4dOF  99;	  	  
9	t$F  99;  	 
 
4%)ZZ_5_SV_E55zQUq 8U1X.888$ yy{$ $ 
 99;  	  
4dOF888$
 yy{$ $  99;  	 
 
7	dOF  99;  	 
 
6	$F  99;  	  ((w 6s   
Kc           
         R \        V P                  4      R\        V P                  4      R\        V P                  4      R\        V P                  4      /p / pV P
                  P                   F  pVP                  V\        V4      &   K  	  V P
                  P                  ! R/ VB V P                  8H  pWAR&    \        \        \         V P                  4      4      VR&    \        V P                  4      VR&    V P
                  P                   Uu. uF  p\        V4      VP                  3NK  	  upVR&    \        V P
                  4      VR	&    V P                  VR
&   V#   \         d    Rp Li ; i  \         d     Li ; i  \         d     Li ; iu upi   \         d     Lri ; i  \         d     Lji ; i  \         d     T# i ; i)ru   r   r   r   Tenabledr   	transtypebooleansconditionalfilename )rd   ruletyper   r   tclassr   r   r   evaluateconditional_blockAttributeErrorrb   rc   r   defaultr   )ruler(   	boolstatebooleanr   r*   s   &     r5   _setools_rule_to_dictr   2  s   DMM"#dkk"#dkk"T[[!		A		''00G&-mmIc'l# 1 ""++8i8D<R<RR
 iLSdjj12*T\\*+484D4D4M4MN4Mq#a&!''*4MN*t//0-* H?    
   O 
  
  Hs   A E& =&E9 $F
 =F   F5F  <F1 G &E65E69FF
FFF   F.-F.1F?>F?GGc           	         \         '       g   \        4        V'       g   / p\        \        \        \
        \        \        \        .4      pV  F*  pW29  g   K  \        R RP                  V4      ,          4      h	  Rp\        V9   d   \        V\        ,          4      pRp\        V9   d   \        V\        ,          4      pRp\        V9   d&   \        V\        ,          4      P                  R4      p. p. p\        V 9   d   VP!                  \        4       \
        V 9   d   VP!                  \
        4       \        V 9   d   VP!                  \        4       \        V 9   d   VP!                  \        4       \#        V4      ^ 8  da   \%        \         VVVVR7      p	\&        V9   d   V\&        ,          V	n        YyP+                  4        U
u. uF  p
\-        V
4      NK  	  up
,          p\        V 9   de   . ROp\%        \         VVVVR7      p	\&        V9   d   V\&        ,          V	n        YyP+                  4        U
u. uF  p
\-        V
4      NK  	  up
,          p\        V 9   dj   R.p\/        \         VVVVR7      p	V	P+                  4        F>  pVP!                  R\        VP0                  4      R\        VP2                  4      /4       K@  	  V# u up
i u up
i )	zType has to be in %s N,)r   r   r   r   r   r   r   )type_transitiontype_changetype_member)rR   rZ   setALLOW
AUDITALLOW
NEVERALLOW	DONTAUDIT
TRANSITION
ROLE_ALLOWr2   joinSOURCErd   TARGETCLASSr   appendr   r	   PERMSr   r   r   r   r   r   )rm   seinfovalid_typesr   r   r   r   torettertypesr   ri   rtypesratypesrs   &&            r5   searchr   d  s8   4uj*iZXYK$3chh{6KKLL  FVF^$FVF^$FVE]#))#.EH~U
#U
#E	"
8}q!)%%%	' F?UmAGIIK@Kq'*K@@UB!'%%%	' F?UmAGIIK@Kq'*K@@U)$#*!'!'!'	) ALL(CM"CM3 4  L7 A As   	K8Kc           	      .  a aaaa	 / p. pS .o	S.o S	\        \        V 3R  l\        4       4      4      ^ ,          R,          ,          o	 S\        \        T3R l\        4       4      4      ^ ,          R,          ,          o\        R \        TTT	3R l\	        4       4      4      p T FJ  pTP                  RTR,          RTR,          TR,          3/4       YE9  g   K7  TP                  T4       / pKL  	  T#     L; i    L; i  \         d    Tu # i ; i)c                    < V R ,          S8H  # r_   r   )ri   srcs   &r5   <lambda>"get_conditionals.<locals>.<lambda>  s    !F)s*:rG   ra   c                    < V R ,          S8H  # r   r   )ri   dests   &r5   r   r     s    1V9+<rG   c                     V # rW   r   )ys   &r5   r   r     s    1rG   c                    < V R ,          S9   ;'       dG    V R,          S9   ;'       d3    \        S4      P                  V \        ,          4      ;'       d    RV 9   # )r   r   r   )r   issubsetr   )ri   	dest_listpermsrc_lists   &r5   r   r     s^    (x' # #(y(# #D	""1U8,# # "#rG   r   r   r   )rb   filterget_all_types_inforc   get_all_allow_rulesupdater   KeyError)
r   r   r   r   tdicttlistallowsr   r   r   s
   ff&f    @@r5   get_conditionalsr     s   EEuHID :<N<PQRSTUVbccT&!<>P>RSTUVWXdee	 f &#
 $%' (FALL(AhK=AQSTU^S_@`ab!U#	  L-  s/   6C6 6C= $4D D 6C:=DDDc           
          R pV  F  pVR,          ^,          '       g   K  Rp M	  \        R4      VRP                  \        \        R V 4      4      4      3,          # )Fr   Tz-- Allowed %s [ %s ]z || c                 P    R V R,          ^ ,          V R,          ^,          3,          # )z%s=%dr   r   ri   s   &r5   r   .get_conditionals_format_text.<locals>.<lambda>  s8    wZ[\iZjklZmopq~o  AB  pC  ZD  PDrG   )r   r   r   rc   )condr   ri   s   &  r5   get_conditionals_format_textr     ss    G]AG  #$S  FD  FJ  BK  >L  2M  (N  N  NrG   c                 P    \        \        \        V 4      4      ^ ,          R,          # )r   rm   )rb   r   r   )	attributes   &r5   get_types_from_attributer     s    Y	*+A.w77rG   c                 @   . p/ p\        4        F6  pVP                  \        V 4      4      '       g   K%  VP                  V4       K8  	  \	        4       pV F/  p WC,          R ,          \
        WC,          R,          ,          3W#&   K1  	  V#   \         d	    . Y#&    KG  i ; iregexftype)get_all_file_types
startswithgen_short_namer   
get_fcdictfile_type_strr   )r   flistmpathsr&   fcdicts   &    r5   get_file_typesr     s    EF!<<v.//LLO " \F	7+]69W;M-NOFI 
 M  	FI	s   +B

BBc                    V '       g   V #  \        \        \        V 4      4      R,          #   \        \        3 d    T u # i ; i)zReturn the real name of a type

* If 'name' refers to a type alias, return the corresponding type name.
* Otherwise return the original name (even if the type does not exist).
r_   )nextr   r   RuntimeErrorStopIterationr   s   &r5   get_real_type_namer     sA     Dt$%f---( s   , AAc           	         \        4       p. p/ p\        \        .R V RRR.RR/4      pVe   \        V4      ^ 8X  d   V# \	        4       pRR.pV F  pVR,          V9   d   K  R	V9   d   VR	,          '       g   K+  VR,          P                  R
4      '       dK   VR,          V9  d   KY  VR,          V9  d+   VR,          V 8w  d   VP                  VR,          4       K  K  K  \        VR,          4       F  pW9  g   K  VP                  V4       K  	  K  	  V F/  p	 WY,          R,          \        WY,          R,          ,          3W9&   K1  	  V#   \         d	    . Y9&    KG  i ; i)r   r   openwriter   file	proc_typesysctl_typer   r   _tr   r   )
r   r   r   r   r   endswithr   r   r   r   )
r   rP   
all_writesr   r   r   ra   r   tr&   s
   &         r5   get_writable_filesr     sY   #%JJFug&*vw>OQXZ`abH3x=A-\F}-JX;*$>Y<<X;%%{*,{*,X;&(%%ak2 ) - .ak:&%%a( ; " 	7+]69W;M-NOFI 
 M  	FI	s   +EE! E!c                   a \         P                  P                  V 4      '       d   V .#  \        P                  ! R V ,          4      pT pTP                  R4      '       d   TRR R,           p\         P                  P                  T4      o SR,          R8w  d
   SR,          o \        P                  ! R T ,          4      p\        T3R l\         P                  ! S4      4       Uu. uF  q1P                  T4      '       g   K  TNK  	  up#    \        RT 4       . u # ; i  \         d    \        R4        Li ; iu upi    . u # ; i)	z%s$zbad reg:z(/.*)?N/ztry failed got an IndexErrorc                    < SV ,           # rW   r   )ri   r@   s   &r5   r   find_file.<locals>.<lambda>5  s	    rG   ir:   )osr@   existsrecompileprintr   dirname
IndexErrorrc   listdirmatch)regpatr-   ri   r@   s   &   @r5   	find_filer    s   	ww~~cujj#& 	Azz(crFSL77??1D.8s?CKDjj#&12::d3CDUDa		RSDUU#j#	  .,-.
 V	sB   D D# %AE (D?D?E D #D<;D<?E E
c                     \        V 4      pVP                  4        FK  pVP                  R 4      '       g   K  W19  g   K$  W#,           F  p\        V4       F	  pVu u u # 	  K  	  KM  	  R# )_exec_tN)get_entrypointskeysr   r  )domainexclude_listexecutable_filesexer@   r&   s   &&    r5   find_all_filesr  :  s\    &v.$$&<<	""s'>(--"4AH ) . '
 rG   c                     \        4       p V P                  R 4      '       d3   W9  d-   W ,          R,           F  p\        V4       F  pVu u # 	  K  	  R#   \         d     R# i ; i)r  r   N)r   r   r  r   )r  r  r   r@   r&   s   &&   r5   find_entrypoint_pathr  D  se    \F<<	""s'>G,,"4AH ) -
   s   AA A A&%A&c                     \        VR 4      ;_uu_ 4       pV FS  pVP                  4       pV'       g   K  V^ ,          P                  R4      '       d   K=  RV^,          RV/W^ ,          &   KU  	  RRR4       V #   + '       g   i     T # ; i  \         d,   pTP                  \        P
                  8w  d   h  Rp?T # Rp?ii ; i)r   #equivmodifyN)r   r   r   OSErrorerrnoENOENT)edictfc_pathr  fder&   s   &&&   r5   read_file_equivr%  P  s    '32GGI1QqT__S11#*AaD(F"CEA$K    L   L  77ell" #Ls?   B A:A:A:0B :B	B B C B??Cc                 h    \         '       d   \         # / s \        \         V R ,           RR7      s \         # )z.subsTr  )file_equiv_modifiedr%  r"  s   &r5   get_file_equiv_modifiedr*  ]  s0    "")*=w?PY]^rG   c                 z    \         '       d   \         # \        V 4      s \        \         V R ,           RR7      s \         # )z
.subs_distFr'  )
file_equivr*  r%  r)  s   &r5   get_file_equivr-  f  s0    z(1J W|-CERJrG   c                 @   \         '       d   \         # . s  \        V R ,           R4      ;_uu_ 4       pVP                  4       pRRR4       X Fk  pTP                  4       p\        T4      ^ 8X  d   K%   \        T4      ^8  d   \        T^,          ,          pMRp\         P                  T^ ,          T34       Km  	  \         #   + '       g   i     L; i  \         d-   pTP                  \        P
                  8w  d   h . u Rp?# Rp?ii ; i  \         d     K  i ; i).localr   Nr%   )local_filesr   	readlinesr  r  r   r   r   trans_file_type_strr   r   )r"  r#  fcr$  r   recr   s   &      r5   get_local_file_pathsr5  o  s    {K'H$c**bB + ggis8q=	3x!|+CF3A/  ' +* 77ell"	  		sM   C CC 2ADC	C C D!D DDDDc                 R   \         '       d   \         # \        V R 4      pVP                  4       pVP                  4        \        V R,           R 4      pW!P                  4       ,          pVP                  4        / s  \        V R,           R 4      ;_uu_ 4       pW!P                  4       ,          pRRR4       T F  pTP                  4       p \        T4      ^8  d   \        T^,          ,          pMRpTR,          P                  R4      ^,          pT\         9   d-   \         T,          R,          P                  T^ ,          4       K  RT^ ,          .RT/\         T&   K  	  RR./\         R	&   RR
./\         R&   RR./\         R&   RR./\         R&   RR./\         R&   RR./\         R&   RR./\         R&   RR./\         R&   RR./\         R&   \         #   + '       g   i     EL/; i  \         d,   pTP
                  \
        P                  8w  d   h  Rp?ELcRp?ii ; i    EKo  ; i)r   z	.homedirsr/  Nr%   :r   r   zall log fileslogfilezall user tmp filesuser_tmp_typezall user home filesuser_home_typezall virtual image filesvirt_image_typezBall files on file systems which do not support extended attributes	noxattrfsz)all sandbox content in tmpfs file systemssandbox_tmpfs_typez&all user content in tmpfs file systemsuser_tmpfs_typezall files on the system	file_typezAuse this label for random content that will be shared using sambasamba_share_tr:   )r   r   r1  closer  r  r   r   r   r2  r   )r"  r#  r3  r$  r   r4  r   r   s   &       r5   r   r     s   v	gs	B	BHHJ	g#S	)B,,.BHHJF'H$c**b,,. B + ggi	3x!|+CF3Bc"1%AF{q	'"))#a&1$s1vh?q	   !?"34F9&)=(>?F? '*?)@AF!(+D*E FF"%i$jkF;$+.Y-Z#[F !(+S*T UF"%>$?@F;&)l(mnF?M? +** 77ell" #"	sI   ;G' G-G' A;H H G$	G' $G' 'H2 HH H&c                      \        \        .R R/4       Uu. uF  qR,          V 8X  g   K  VNK  	  up# u upi   \        \        3 d     R# i ; i)r   processr   Nr   r   	TypeErrorr   r   ri   s   & r5   get_transitions_intorG    sU    !:,)0DEbEa;[aIaEbbb~&    9 449 9 AAc                 ^     \        \        .R V RR/4      #   \        \        3 d     R# i ; ir   r   rC  NrD  )r   s   &r5   get_transitionsrK    s9    zlXvw	$JKK~& s    ,,c                      \        \        .R V /4       Uu. uF  qR,          R8w  g   K  VNK  	  up# u upi   \        \        3 d     R# i ; irJ  rD  rF  s   & r5   get_file_transitionsrM    sU    !:,60BC_CazU^G^C___~& rH  c                     . p\        \        .R V /4      pV F6  pRV9   g   K   VR,           F  pW9   g   K  VP                  V4       K  	  K8  	  V#     KA  ; i)r   r   )r   r   r   )r   r   boollistr   r-   r*   s   &&    r5   get_boolean_rulesrP    sb    Hug&12H?:A| * '  Os   AAAc                      \        R 4      # )
entry_type)r   r   rG   r5   get_all_entrypointsrS    s    #L11rG   c                     \        \        \        .V R .R.R7      pVP                  4        Uu. uF*  q"P                  V 8X  g   K  \        VP                  4      NK,  	  up# u upi )r   
entrypoint)r   r   r   r   )r	   rR   r   r   r   rd   r   )r   r   ri   s   &  r5   get_entrypoint_typesrV    sS    D#W!"8'.		*A
 $%99;E;a((f2DMCM;EEEs   A!A!c                   a \         P                  ! V 4      ^,          P                  R4      ^,          o \        \	        V3R l\        \        .RRRR/4      4      4      pV^ ,          R,          #   \        \        \        3 d     R# i ; i)	r\   r7  c                    < V R ,          S8H  # )r   r   )ri   rU  s   &r5   r   $get_init_transtype.<locals>.<lambda>  s    AhK:,ErG   r   init_tr   rC  r   N)
r;   
getfileconr   rb   r   r   r   rE  r   r	  )r@   entrypointsrU  s   & @r5   get_init_transtyper]    s    ##D)!,2237:J6"Evzl]egoqx  {D  ]E  HF  G  H1~k**~z2 s   ;A2 2BBc                     \        \        R .RR.R7      p. pVP                  4        F2  p VP                  V 8X  d   VP	                  VP
                  4       K2  K4  	  V#   \         d     KF  i ; ir   rZ  rC  )r   r   r   )r	   rR   r   r   r   r   r   )r   r   r\  r   s   &   r5   get_init_entrypointr`    sw    D/0#%;	(A KYY[	yyI%""188, &    		s   ,A  A/.A/c                  F   \        \        R .RR.R7      p / pV P                  4        Fc  p \        VP                  4      pW19   d-   W,          P                  \        VP                  4      4       KK  \        VP                  4      .W&   Ke  	  V#   \         d     Kw  i ; ir_  )r	   rR   r   rd   r   r   r   r   )r   r\  r   r   s       r5   get_init_entrypoints_strrb    s    D/0#%;	(A KYY[	AIII'&--c!((m<*-ahh-&    		s   AB3BB B c                      \        R  \        \        .RRRV RR/4      4      p\        V4      ^ ,          #   \        \
        3 d     R# i ; i)c                     V R ,          # )r   r   r   s   &r5   r   ,get_init_entrypoint_target.<locals>.<lambda>  s    AkNrG   r   rZ  r   r   rC  N)rc   r   r   rb   rE  r	  )rU  r\  s   & r5   get_init_entrypoint_targetrf    sg    2FJ<(T\^fhrt{  ~G  JH  5I  JK ##z" s   36 A
Ac                     \        4       p/ p\        V 4       F/  p W,          R ,          \        W,          R,          ,          3W#&   K1  	  V#   \         d	    . Y#&    KG  i ; ir   )r   rV  r   r   )r   r   r   r&   s   &   r5   r  r     s`    \FF!&)	7+]69W;M-NOFI *
 M  	FI	s   +AA A c                     \        \        4      ^ 8  d   \        # \        4        \        P                  ! 4       p  \        V 4      p\        P                  ! 4       pVP                  V4       \        VP                  P                  4       4      sVP                  4        \        P!                  4        \        #    \        P                  P                  RT ,          4       \        P                  ! ^4        LZ; i)r   z#could not open interface info [%s]
)r   methodsgen_interfacesdefaultsinterface_infor   
interfacesInterfaceSet	from_filerb   r  rA  sysstderrr   exitr>   )fnr#  ifss      r5   get_methodsru  +  s    
7|a		 	 	"B	"X%%'bs~~**,-


 LLNN

?"DEs   A$B9 9>C9c                  r    \         f&   \        \        4       U u. uF  q R,          NK  	  up s \         # u up i )Nr_   )rL   r   r   r   s    r5   get_all_typesrw  @  s/    (,T
3
1vYY
3	 4s   4c                  N    \         f   \        \        \        4      4      s \         # rW   )all_types_inforb   r   r   r   rG   r5   r   r   F  s    d4j)rG   c                  ~    \         f1   \        \        \        \        R4      4      ^ ,          R,          4      s \         # )N
userdomainrm   )
user_typesrb   r   r   r   rG   r5   get_user_typesr}  L  s.    $tI|<=a@IJ
rG   c                  j   \         '       d   \         # / s \        \        \        .R 7      p V P	                  4        Fp  p\        VP                  4      p\        VP                  4      pVR8X  g   VR8X  d   K=  V\         9   d   \         V,          P                  V4       Kf  V.\         V&   Kr  	  \         # ))r   system_r)	rM   r   rR   r   r   rd   r   r   r   )r   r   r   tgts       r5   get_all_role_allowsr  S  s    {KdeW-AYY[!((m!((m*z 1+##C( #uK  rG   c                  T   ^ RI p . p\        \        4       4      pV F  pV P                  ! RR,          V4      p\	        V4      ^ 8  g   K/  \	        V P                  ! RR,          V^ ,          4      4      ^ 8X  g   K`  V^ ,          V9  g   Kp  VP                  V^ ,          4       K  	  V# )r   Nz(.*)%sz_exec_t$z_initrc$)r  sortedrw  findallr   r   )r  rI   rm   r   ms        r5   get_all_entrypoint_domainsr  g  s    K=?#EJJx*,a0q6A:2::h3QqT:;q@QqTQ\E\""1Q4(	 
 rG   c                      ^ RI Hp  \        P
                  ! 4       p\        P                  ! 4       p \        P                  ! V4      P                  \        P                  ! V4      P                  8:  d   R#  \        P                  ! 4       ^ 8w  d   \        \        R4      4      h\        V ! R4      ^,          4       R#   \         d
    ^ RIHp   Li ; i  \         d     Lli ; i)r   )getstatusoutputNzEYou must regenerate interface info by running /usr/bin/sepolgen-ifgenz/usr/bin/sepolgen-ifgen)commandsr  ImportError
subprocessrk  rl  headersr  statst_mtimer  getuidr2   r   r  )r  ifiler  s      r5   rj  rj  s  s    /, ##%E G777$$(?(?? @
 
yy{abcdd	/3
4Q
78  /./  s#   C AC CCC&%C&c                     \         '       d   \         \        3# / s/ s \        \        4       EF  p V R ,          V R,          8X  d   \	        V R ,          4      pM)\	        V R ,          4      : R\	        V R,          4      : 2pV R,          V R,          3\         9   d.   \         V R,          V R,          3,          P                  V4       MV.\         V R,          V R,          3&   RV 9   d4   V R,          V R,          3\        V R ,          V R,          V R,          3&   K  V R,          \        V R ,          V R,          V R,          3&   EK  	  \         \        3# )rv   rr   rp   ru   rs   rt   )portrecsportrecsbynumr   r   rd   r   )r   ports     r5   gen_port_dictr    s    x-((MH$ZU8qy qx=D!!E(mS6^<DfIq}%1ai:/077=486Hai:/0a<CDV9aPWjBYM1U8QvY*>?CDV9M1U8QvY*>?   m$$rG   c                      \         '       g1   \        \        \        \        R 4      4      ^ ,          R,          4      s \         # )r  rm   )rI   rb   r   r   r   rG   r5   get_all_domainsr    s-    ;4Y 9:1=gFGrG   c                      \         '       d   \         # \        '       g   \        4        \        \        4      p V P	                  4        Uu. uF   p\        V4      R 8w  g   K  \        V4      NK"  	  ups \         # u upi )object_r)rO   rR   rZ   r   r   rd   r   ri   s     r5   get_all_rolesr    sW    u 4$AYY[A[CFj,@VSV[AEL Bs   
A9!A9c                      \         '       gf   \        \        \        4      4      s \        P
                  '       d8   \          F-  p R P                  V R,          P                  R4      4      V R&   K/  	  \         # )r.   rt   r   )selinux_user_listrb   r   r   rR   r   r   r   r   s    r5   get_selinux_usersr    sQ     d,888&WWQwZ%5%5c%:;'
 'rG   c                     \         '       d   \         # \        \        P                  ! 4       R 4      p V P	                  4       pV P                  4        . s VP                  R4       F  pVP                  4       p\        V4      ^ 8X  g   VP                  R4      '       d   K<  VP                  R4      p\         P                  RV^ ,          RV^,          RRP                  VR,          4      /4       K  	  \         # )r   
r  r7  r_   seuserr   :   NN)login_mappingsr   r;   selinux_usersconf_pathreadrA  r   stripr   r   r   r   )r#  bufr*   ri   s       r5   get_login_mappingsr    s    ~	g,,.	4B
'')CHHJNYYt_GGIq6Q;!,,s++GGCLvqtXqtUCHHQrUOTU  rG   c                  >    \        \        R  \        4       4      4      # )c                     V R ,          # r   r   r   s   &r5   r   get_all_users.<locals>.<lambda>  s    &	rG   )r  rc   r  r   rG   r5   get_all_usersr    s    #)+<+>?@@rG   c                      \         '       d   \         # \        \        \        \        R 4      4      ^ ,          R,          4      s \         # )r?  rm   )rP   rb   r  r   r   r   rG   r5   r   r     3    zfT)[9:1=gFGJrG   c                      \         '       d   \         # \        \        \        \        R 4      4      ^ ,          R,          4      s \         # )	port_typerm   )rQ   rb   r  r   r   r   rG   r5   get_all_port_typesr    r  rG   c                  V    \         '       g   \        \        \        4      4      s \         # rW   )rK   rb   r   r   r   rG   r5   get_all_boolsr    s    5T']#LrG   c                 \    R P                  V R\        V4      )  P                  R4      4      # )r   Nr   )r   r   r   )r&   trims   &&r5   prettyprintr    s(    88AkD	zN((-..rG   c                     V # rW   r   )r&   s   &r5   markupr    s    HrG   c                 L   R V! V 4      ,          pV P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R	4      '       d   VR
\        V R4      ,          ,           # V P                  R4      '       d   VR
\        V R4      ,          ,           # V P                  R4      '       g   V P                  R4      '       d
   VR,           # V P                  R4      '       d
   VR,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VRV R\        R4      )  ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R4      '       d   VR\        V R4      ,          ,           # V P                  R 4      '       d   VR\        V R 4      ,          ,           # V P                  R!4      '       d   VR"\        V R!4      ,          ,           # V P                  R#4      '       d   VR$\        V R#4      ,          ,           # V P                  R%4      '       d   VR&\        V R%4      ,          ,           # V P                  R'4      '       d   VR(\        V R'4      ,          ,           # V P                  R)4      '       d   VR*\        V R)4      ,          ,           # V P                  R+4      '       d   VR$\        V R+4      ,          ,           # V P                  R,4      '       d   VR-\        V R,4      ,          ,           # V P                  R.4      '       d   VR/\        V R.4      ,          ,           # V P                  R04      '       d   VR1\        V R04      ,          ,           # V P                  R24      '       d   VR3\        V R24      ,          ,           # V P                  R44      '       d   VR1\        V R44      ,          ,           # V P                  R54      '       d   VR1\        V R54      ,          ,           # V P                  R64      '       d   VR1\        V R64      ,          ,           # V P                  R54      '       d   VR7\        V R54      ,          ,           # V P                  R84      '       d   VR9\        V R84      ,          ,           # V P                  R:4      '       d   VR;\        V R:4      ,          ,           # V P                  R<4      '       d   VR=\        V R<4      ,          ,           # V P                  R>4      '       d   VR?\        V R>4      ,          ,           # V P                  R@4      '       d
   VRA,           # V P                  RB4      '       d   VRC\        V RB4      ,          ,           # VRD\        V RE4      ,          ,           # )Fz+Set files with the %s type, if you want to 
_var_run_tz8store the %s files under the /run or /var/run directory._pid_tz,store the %s files under the /run directory.
_var_lib_tz0store the %s files under the /var/lib directory._var_tz,store the %s files under the /var directory._var_spool_tz2store the %s files under the /var/spool directory._spool_t_cache_t_var_cache_tz/store the files under the /var/cache directory.	_keytab_tz)treat the files as kerberos keytab files._lock_tzEtreat the files as %s lock data, stored under the /var/lock directory_log_tzKtreat the data as %s log data, usually stored under the /var/log directory.	_config_tzRtreat the files as %s configuration data, usually stored under the /etc directory._conf_tr  z,transition an executable to the %s_t domain.N_cgi_content_tz"treat the files as %s cgi content._rw_content_tz)treat the files as %s read/write content._rw_t_write_t_db_tz'treat the files as %s database content._ra_content_tz*treat the files as %s read/append content._cert_tz'treat the files as %s certificate data._key_tztreat the files as %s key data.	_secret_tz"treat the files as %s secret data._ra_t_ro_tz(treat the files as %s read/only content.
_modules_tztreat the files as %s modules.
_content_tztreat the files as %s content._state_tz!treat the files as %s state data._files_t_file_t_data_tztreat the data as %s content._tmp_tz1store %s temporary files in the /tmp directories._etc_tz'store %s files in the /etc directories._home_tz+store %s files in the users home directory._tmpfs_tz&store %s files on a tmpfs file system._unit_file_tz#treat files as a systemd unit file._htaccess_tz#treat the file as a %s access file.ztreat the files as %s data.r   )r   r  r   )r&   r  txts   && r5   get_descriptionr    s   
7&)
CCzz,OR]^_amRnnnnzz(CkRSU]F^^^^zz,G+VWYeJffffzz(CkRSUaFbbbbzz.!!IKXY[eLffffzz*IKXY[eLffffzz*N!;!;FFFzz+@@@zz)\_jklnw_xxxxzz(bepqrt|e}}}}zz+ilwxy  |G  mH  H  H  	Hzz)ilwxy  |E  mF  F  F  	Fzz)CaHX#i.FYYYYzz"##9KK[<\\\\zz/""@;qRaCbbbbzz'@;qRYCZZZZzz*@;qR\C]]]]zz'>QPWAXXXXzz/""AKPQSbDcccczz)>QPYAZZZZzz(6Q9QQQQzz+9K;<WWWWzz'AKPQSZD[[[[zz'?+aQXBYYYYzz,5A|8TTTTzz,5A|8TTTTzz*8;q*;UUUUzz*5Az8RRRRzz)5Ay8QQQQzz)5Ay8QQQQzz)4{1i7PPPPzz(H;WXZbKcccczz(>QPXAYYYYzz)B[QRT]E^^^^zz*=Az@ZZZZzz.!!:::zz-  :[M=ZZZZ.Q1EEEErG   c            
      ~    \         '       g-   \        \        \        R  \	        \
        4      4      4      4      s \         # )c                     V R ,          # r   r   r   s   &r5   r   $get_all_attributes.<locals>.<lambda>S  s    1V9rG   )rJ   rb   r  rc   r   r   r   rG   r5   get_all_attributesr  P  s(    >fS)<d9o%NOPrG   c                 @    V F  pW \         ,          9  g   K   R # 	  R# )FT)r   )dictr   r   s   && r5   _dict_has_permsr  W  s    E{"  rG   c                     \        4       pV P                  R 4      '       d   \        V 4      p V RR pMT pVR ,           V9  d   \        RV,          4      hVR,          R8X  d   VRR R,           pW#3# VR,           pW#3# )r   Nzdomain %s_t does not existr(   r   r:   )r  r   r   r2   )r   rI   
domainname
short_names   &   r5   r   r   ^  s    !#Kt#F+CR[

D+5
BCC"~_s*
 ##  #%
##rG   c                  F    \         '       g   \        \        .4      s \         # rW   )all_allow_rulesr   r   r   rG   r5   r   r   n  s    ? %/rG   c                      \         '       gG   \        \        R R\        \        .R7      p V P                  4        Uu. uF  p\        V4      NK  	  ups \         # u upi )z.*T)r   boolean_regexr   )all_bool_rulesr	   rR   r   r   r   r   r  s     r5   get_all_bool_rulesr  t  sK    >d$*/);=<=IIKHKq/2KH Is   Ac                  X    \         '       g   \        \        \        .4      4      s \         # rW   )all_transitionsrb   r   r   r   rG   r5   get_all_transitionsr  |  s    ?vzl34rG   c                   a  . p. p\        S 4      w  r4\        R  \        V 3R l\        4       4      4       EF  pV F  p\	        V\
        4      '       g   K   \        P                  ! V^ ,          4      pV^ ,          P                  V4      '       g   V^ ,          P                  V4      '       dF   V^ ,          V3V9  d4   V^ ,          V'       * 3V9  d   VP                  V^ ,          V34       K  K  K  V^ ,          V3V9  g   K  V^ ,          V'       * 3V9  g   K  VP                  V^ ,          V34       K  	  EK
  	  W!3#   \         d    T^,          p Li ; i)c                     V R ,          # )r   r   r   s   &r5   r   get_bools.<locals>.<lambda>  s    1Z=rG   c                 6   < R V 9   ;'       d    V R,          S8H  # )r   r   r   )ri   r   s   &r5   r   r    s    :?;d;dqQY{^dOd;drG   )r   rc   r   r  
isinstancetupler;   security_get_boolean_activer  r   r   )r   rK   domainboolsr  r  r   r*   r   s   f       r5   	get_boolsr    s2   EK+F3J(&1dfxfz*{|Aa''!==adC tz**adooj.I.IaD'?+51Q4W:MU`:`&&!g7 ;a5 aD'?%/QqTw;4Gu4TLL!A$1  }   A$s   EEEc                  ^    \         '       g   \        P                  ! 4       ^,          s \         # )r\   )r   r;   security_get_boolean_namesr   rG   r5   get_all_booleansr    s    8557:OrG   c                      \         P                  ! V 4      pVP                  4       pVP                  4        V#   \         d0    \        T 4      pTP                  4       pTP                  4         T# i ; irW   )gzipr   r  rA  IOError)r@   r#  r  s   &  r5   
policy_xmlr    sb    YYt_ggi


 J	  $Zggi

J	s   6: 6A43A4c                    \         '       d   \         # ^ RIp/ s  VP                  P                  P	                  \        V 4      4      pVP                  R4       EF  pVP                  R4       EFH  pVP                  R4       F  pVP                  R4      P                  R4      P                  P                  R4      p\        P                  ! RRV4      pVP                  R	4      VP                  R
4      V3\         VP                  R	4      &   K  	  VP                  R4       F  pVP                  R4      P                  R4      P                  P                  R4      p\        P                  ! RRV4      pVP                  R	4      VP                  R
4      V3\         VP                  R	4      &   K  	  EKK  	  VP                  R4       F~  pVP                  R4      P                  R4      P                  P                  R4      p\        P                  ! RRV4      pRVP                  R
4      V3\         VP                  R	4      &   K  	  EK  	  VP                  R4       F~  pVP                  R4      P                  R4      P                  P                  R4      p\        P                  ! RRV4      pRVP                  R
4      V3\         VP                  R	4      &   K  	  \         #   \         d	     \         # i ; i)r   Nlayermoduletunabledescr-   r  r   r_   dftvalre   global)booleans_dictxml.etree.ElementTreeetreeElementTree
fromstringr  r  findtextr  r  subgetr  )r@   xmltreer,   r  r*   r  r   s   &       r5   gen_bool_dictr    sU   } Myy$$//
40@Ag&AYYx(9-A66&>..s388>>tDD66$T2D45EE&M155?TX3YM!%%-0 . 6*A66&>..s388>>tDD66$T2D45EE&M155?TX3YM!%%-0 + ) \\&)vvf~**3/44::4@vvdC.08!%%/4/PaeeFm, * ' i(A66&>&&s+0066t<D66$T*D,4aeeHot+LM!%%-( )   s   KK, ,K?>K?c                 h    \        4       pW9   d   \        W,          ^ ,          4      # \        R4      # )r   unknown)r  r   )r   r  s   & r5   boolean_categoryr    s,    !OM'*++|rG   c                     \        4       pW9   d   \        W,          ^,          4      # V P                  R4      p\        R4      P                  V^ ,          RP	                  VR,          4      R7      # )r  r   zAllow {subject} to {rest}r   :r\   NN)subjectrest)r  r   r   formatr   )r   r  r  s   &  r5   boolean_descr    s`    !OM'*++}}S!,-44T!W388TXY[T\K]4^^rG   c                      ^ RI p Rp ^ RIpVP                  RR7      pV#   \        \        \
        \        T P                  3 d    Rp T# i ; i)r   Nr.   T)prettyMisc)r  distror_   ModuleNotFoundErrorr  r  UnicodeErrorCalledProcessError)r  system_releaser"  s      r5   get_os_versionr'    sW    N D1   '<A^A^_   s     (AAc                  R    R s R sR sR sR sR sR sR sR sR s	R s	R s
R sR sR sR sR sR sR sR # rW   )rJ   rI   rL   r   r  rK   r   rP   r0  ri  r  r  rQ   rM   rO   r|  r  r  r   rG   r5   reinitr)    sd    ( NKIHMEFJKGGHMJKEJNrG   )   )r   rW   )z#/usr/share/selinux/devel/policy.xml)r  r;   r=   sepolgen.defaultsrk  sepolgen.interfacesrm  rp  r  r  r  setools.boolqueryr   setools.portconqueryr   setools.policyrepr   setools.objclassqueryr   setools.rbacrulequeryr   setools.rolequeryr   setools.terulequeryr	   setools.typeattrqueryr
   setools.typequeryr   setools.userqueryr   PROGNAMEgettextkwargsversion_infotranslationr   r   builtinsrd   __dict__r  __builtin__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   DEFAULT_DIRSr   r2  rR   r(  r,  r0  r   ri  rL   ry  r|  rM   r  r  rI   rO   r  r  rP   rQ   rK   rJ   r   r  r  r  r  r6   rB   rF   rU   rX   rZ   r   r   r   r   r   r   r   r   r   r  r  r  r%  selinux_file_context_pathr*  r-  r5  r   rG  rK  rM  rP  rS  rV  r]  r`  rb  rf  r  ru  rw  r   r}  r  r  rj  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r   r   r  r  r  r  r  r  r  r  r'  r)  r   rG   r5   <module>rA     s  
    $ ( 
 	 	  ' - + / / ' + 4 ' ',F
$ yH 	#1	#	# "	#A 	
		A 		
	


			

 V V *7& '&3" #&3" #*\ &Z "Z &Z "V ([  ,_ *\ &Z {^c ~&c {^c )*c ~&c }%c 'c |_c   B  D  D  D  D  D  D  D    
	
	
 

7K4j)Z/dHVBN8!H6 )+  ,. 	
 %,$E$E$G  #<<>  ")!B!B!D 8 88: +\2F$*(	9$%4$A/ % ZFz$  *	>_	&C&,,!$# ,$+S!,s+   (AK/ /L*2LL'"L*&L''L*