KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/lib64/python2.4/site-packages/sepolgen/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.4/site-packages/sepolgen/policygen.pyo
mò
d&KRc@s«dZdkZdkZdkZdkZdkZdkZdkZdZdZ	dZ
dfd„ƒYZde	d„Z
d„Zd	„Zd
fd„ƒYZd„ZdS(
s>
classes and algorithms for the generation of SELinux policy.
NiiitPolicyGeneratorcBsqtZdZed„Zeed„Zed„Zed„Z	d„Z
dd„Zd„Zd	„Z
d
„ZRS(s¤Generate a reference policy module from access vectors.

    PolicyGenerator generates a new reference policy module
    or updates an existing module based on requested access
    in the form of access vectors.

    It generates allow rules and optionally module require
    statements and reference policy interfaces. By default
    only allow rules are generated. The methods .set_gen_refpol
    and .set_gen_requires turns on interface generation and
    requires generation respectively.

    PolicyGenerator can also optionally add comments explaining
    why a particular access was allowed based on the audit
    messages that generated the access. The access vectors
    passed in must have the .audit_msgs field set correctly
    and .explain set to SHORT|LONG_EXPLANATION to enable this
    feature.

    The module created by PolicyGenerator can be passed to
    output.ModuleWriter to output a text representation.
    cCsBd|_t|_t|_|o
||_nt	i
ƒ|_dS(søInitialize a PolicyGenerator with an optional
        existing module.

        If the module paramater is not None then access
        will be added to the passed in module. Otherwise
        a new reference policy module will be created.
        N(tNonetselftifgentNO_EXPLANATIONtexplaintFalsetgen_requirestmoduletmoduelt	refpolicytModule(RR((t8/usr/lib64/python2.4/site-packages/sepolgen/policygen.pyt__init__>s			
cCs=|ot||ƒ|_t|_n
d|_|iƒdS(s?Set whether reference policy interfaces are generated.

        To turn on interface generation pass in an interface set
        to use for interface generation. To turn off interface
        generation pass in None.

        If interface generation is enabled requires generation
        will also be enabled.
        N(	tif_settInterfaceGeneratort	perm_mapsRRtTrueRRt"_PolicyGenerator__set_module_style(RRR((Rtset_gen_refpolNs	
	cCs
||_dS(s&Set whether module requires are generated.

        Passing in true will turn on requires generation and
        False will disable generation. If requires generation is
        disabled interface generation will also be disabled and
        can only be re-enabled via .set_gen_refpol.
        N(tstatusRR(RR((Rtset_gen_requires`scCs
||_dS(s)Set whether access is explained.
        N(RR(RR((Rtset_gen_explainjscCsA|io
t}nt}x |iiƒD]}||_q*WdS(N(RRRR
RRtmodule_declarationstmod(RR
R((Rt__set_module_styleos

s1.0cCs‰d}x|iiƒD]}|}qW|p&tiƒ}|iii	d|ƒn||_
||_|io
t
|_n
t|_dS(s?Set the name of the module and optionally the version.
        iN(RtmRRRRR
tModuleDeclarationtchildrentinserttnametversionRRR(RRRRR((Rtset_module_namews
		

cCs|iS(sReturn the generated moduleN(RR(R((Rt
get_moduleˆscCsfx_|D]W}ti|ƒ}|io%tit|d|iƒƒ|_	n|i
ii|ƒqWdS(Nt	verbosity(
tavstavR
tAVRuletruleRRtCommenttexplain_accesstcommentRRtappend(RR#R&R$((Rt__add_allow_rulesŒs
%cCsq|io5|ii||iƒ\}}|iii	|ƒn|}|i
|ƒ|iot|iƒndS(sJAdd the access from the access vector set to this
        module.
        N(RRtgentav_setRt	raw_allowtifcallsRRtextendt!_PolicyGenerator__add_allow_rulesR(RR-R/R.((Rt
add_access”s


(t__name__t
__module__t__doc__RR
RRRtSHORT_EXPLANATIONRRR R!R1R2(((RR's
			cs†g‰‡‡d†}|tjoÕxÇ|iD]¼}ˆid|iƒˆidt	|i
ƒt	|iƒfƒˆid|it
i|iƒfƒˆid|i|i|ifƒˆitid|iddd	d
ddƒƒq,W|ƒnŒ|o„ˆid
|i|i|i|iiƒfƒt|iƒdjo4|id}ˆid|i|i|ifƒn|ƒnˆS(sªExplain why a policy statement was generated.

    Return a string containing a text explanation of
    why a policy statement was generated. The string is
    commented and wrapped and can be directly inserted
    into a policy.

    Params:
      av - access vector representing the access. Should
       have .audit_msgs set appropriately.
      verbosity - the amount of explanation provided. Should
       be set to NO_EXPLANATION, SHORT_EXPLANATION, or
       LONG_EXPLANATION.
    Returns:
      list of strings - strings explaining the access or an empty
       string if verbosity=NO_EXPLANATION or there is not sufficient
       information to provide an explanation.
    cslˆpdSnˆidƒxIˆiƒD];}t|iˆiƒ}ˆid|i	ƒ|i
fƒq)WdS(Ns Interface options:s   %s # [%d](tmltsR*talltmatchtcall_interfacet	interfaceR$tifcallt	to_stringtdist(R=R:(R7R8(Rtexplain_interfacesÀs

s %ss  scontext="%s" tcontext="%s"s  class="%s" perms="%s"s  comm="%s" exe="%s" path="%s"s	message="t"iPtinitial_indents  tsubsequent_indents   s) src="%s" tgt="%s" class="%s", perms="%s"is comm="%s" exe="%s" path="%s"N(R8R@R"tLONG_EXPLANATIONR$t
audit_msgstmsgR*theadertstrtscontextttcontextttclassR
tlist_to_space_strtaccessestcommtexetpathR0ttextwraptwraptmessagetsrc_typettgt_typet	obj_classtpermstto_space_strtlen(R$R7R"R8RFR@((R7R8RR(«s(

)&##/
'cCst|i|iƒS(N(tcmptbtnumta(R]R[((Rt
param_compâscCsþg}g}|i|iiƒƒ|itƒtiƒ}|i
|_x°tt
|ƒƒD]œ}||itijo|ii|iƒqZ||itijo|ii|iƒqZ||itijo|ii|iƒqZ||iGHqZW|S(N(tparamstargsR0R<tvaluestsortR^R
t
InterfaceCallR=RtifnametrangeRYtittypetSRC_TYPER*R$RTtTGT_TYPERUt	OBJ_CLASSRV(R<R$RfR`R_R=((RR;ås$
RcBs/tZdd„Zd„Zd„Zd„ZRS(NcCs5||_|i|ƒti|ƒ|_g|_dS(N(tifsRthack_check_ifstmatchingt
AccessMatcherRtmatchertcalls(RRkR((RR
ÿs	
cCs¾x·|iiƒD]¦}g}|i|iiƒƒ|itƒxttt	|ƒƒD]`}|d||ijot|_
Pn||itititigjot|_
PqRqRWqWdS(Ni(Rkt
interfacesRatxR_R0RbR^ReRYRfR\RtenabledRgR
RhRiRj(RRkRfR_Rr((RRls
	&	cCs|i|ƒ}	g}xk|iD]`}t|iƒi	|i
ƒ}|o%t
it|i
||ƒƒ|_n|i||fƒqWg}xˆ|D]€\}}t}xS|D]K}
|
i|ƒo5|
io!|io|
ii|iƒnt}q©q©W|p|i|ƒqqW|	|fS(N(RR:R#traw_avR/RpR7R;tbestR<R$R=R"R
R'R(R)R*tdRkRtfoundto_ifcalltmatchestmergeR(RR#R"R/RvRkR7RwR=RtRx((RR,s*
%cCsng}xa|D]Y}tiƒ}|ii|i	||ƒt
|ƒo|ii|ƒq
|i|ƒq
W|S(N(
RtR#R$Rmt	MatchListtansRRot
search_ifsRkRYRpR*(RR#R|R$Rt((RR:3s
(R3R4RR
RlR,R:(((RRþs		cCs.d„}x|iƒD]}||ƒqWdS(s*Add require statements to the module.
    cCsÒtiƒ}xa|iƒD]S}|ii|iƒ|ii|i	ƒx$|i
D]}|i||i
ƒqOWqWx8|iƒD]*}x!|iD]}|ii|ƒqWq}W|iidƒ|iid|ƒdS(NRi(R
tRequiretrtnodetavrulestavrulettypestupdatet	src_typest	tgt_typestobj_classestobjt
add_obj_classRWtinterface_callsR=R`targtaddtdiscardRR(R€RˆR‚RR‹R=((Rtcollect_requiresCs



N(RŽRtnodesR€(RR€RŽ((RR@s
	
(R5t	itertoolsRQR
tobjectmodeltaccessRqRmRR6RDRRR(R^R;RR(R(R
RR‘RqRRQR6R’RR;R^RDRmRR((Rt?s 							„7		B

Anon7 - 2021