Your IP : 18.117.166.170


Current Path : /lib64/python2.7/site-packages/sepolicy/
Upload File :
Current File : //lib64/python2.7/site-packages/sepolicy/manpage.pyo

�
4��]c@s�dddddgZddlZddlZddlZddlZddlTddlmZddlZddlZddl	Z	ddl
Z
ddlZid0d
6d1d6dd6dd6Zidgd6dgd6ddgd6dgd6d gd!6d"gd#6Z
d$gZdad%d&�Zdadad'�Zdad(�Zdad)�Zdad*�Zd+�ZgZgZd,�Zd-�Zdd2d.��YZ dd3d/��YZ!dS(4tManPagetHTMLManPagestmanpage_domainst
manpage_rolestgen_domainsi����N(t*(tutiltamavis_ttclamd_tt
clamscan_ttfreshclam_ttantivirus_ttrgmanager_tt
corosync_tt	aisexec_ttpacemaker_tt	cluster_ttqemu_ttsvirt_ttphpfpm_tthttpd_ttsambatsmbdtapachethttpdtvirttlibvirttvirtdtbindtnamedtsmartmontfsdaemontraidtmdadms/vars#/usr/share/selinux/devel/policy.xmlcCstr
tSddl}iay�|jjjt|��}x�|jd�D]�}x�|jd�D]�}|jd�}|dks`|dkr�q`n|dkr�d}n|dkr�d}nx$|jd	�D]}|jt|<q�Wq`WqJWWnt	k
r}nXtS(
Ni����tlayertmoduletnametusert
unconfinedt
unprivusertunconfinedusertsummary(
tmodules_dicttxml.etree.ElementTreetetreetElementTreet
fromstringt
policy_xmltfindalltgetttexttIOError(tpathtxmlttreetltmR$tbte((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pytgen_modules_dict6s(		cCs�trtrttfSgaiag}tt�}x>|D]6}|j|d�|dt|djd�d<q;Wx6|D].}|d
kr|tj|jdd	��q|q|Wtj�ttfS(NR$tranget_itsystem_utroottunconfined_ut_ut(R>srootR@(tuserstusers_rangetinfotUSERtappendtsplittreplacetsort(talluserst
allusers_infotdtu((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pytget_all_users_infoRs

#
 
cCs*ts&tjtjd�ddantS(Nt
entry_typeittypes(tall_entrypointstsepolicyREt	ATTRIBUTE(((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pytget_entrypointsjs cCs�tr
tSgax@t�D]5}t}|d }|tkrBqntj|�qWxDt�D]9}|d tks]|dkr�q]ntj|d �q]Wtj�tS(Ni����tsystem_r(tdomainstget_all_domainstFalseRGt
get_all_rolesRJ(RMtfoundtdomaintrole((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyRss

cCsetr
tStjtj�}iax<|D]4}y|dt|d<Wq)gt|d<q)Xq)WtS(Nt
attributesR$(RQRSREtTYPE(t	all_typestrec((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt
_gen_types�s
cCs!dj|t|� jd��S(Nt R=(tjointlenRH(tfttrim((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pytprettyprint�scCs�tjtjg�}xltjD]a}g}xH|D]@}|jd�dd|kr2|j|jd�d�q2q2W|||<qW|S(Nt/i����i(tdicttfromkeyststringt
ascii_lettersRHRG(tmanpage_listtalphabet_manpagestittemptj((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pytget_alphabet_manpages�s
!cCs�y&tjd|dtjdt�}Wn3tjk
r[}tjjtj	|j
��dSXt|d�}|j|�|j�|GHdS(Ns)/usr/bin/groff -man -Thtml %s 2>/dev/nulltstderrtshelltwb(
t
subprocesstcheck_outputtSTDOUTtTruetCalledProcessErrortsysRttwriteRtdecode_inputtoutputtopentclose(thtml_manpagetmanpagetman_pageR:tfd((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pytconvert_manpage_to_html�s	


cBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(sG
            Generate a HHTML Manpages on an given SELinux domains
    cCsmt|�|_t|�|_||_|d|_|j|_|jrV|j�nd|GHtd�dS(NRis7SELinux HTML man pages can not be generated for this %si(RsRRt
os_versiontold_pathtnew_patht _HTMLManPages__gen_html_manpagestexit(tselfRRR4R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt__init__�s	
	
	cCs"|j�|j�|j�dS(N(t_write_html_manpaget
_gen_indext_gen_css(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt__gen_html_manpages�s

cCs
tjj|j�s(tj|j�nxlt|jj��D]U}t|�r>x@|D]5}t	|j|j
dd�dd|j|�qWWq>q>Wxlt|jj��D]U}t|�r�x@|D]5}t	|j|j
dd�dd|j|�q�Wq�q�WdS(Nt_selinuxiis.html(
tosR4tisdirR�tmkdirtlistRtvaluesReR�trsplitR�R(R�R\RMR]tr((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s
:
c	Cs	|jd}t|d�}|jd|j�x>|jD]3}t|j|�r:|jd||f�q:q:W|jd�d}xy|jD]n}t|j|�r�|d7}xH|j|D]6}|jdd	�d
}|d||||f7}q�Wq�q�W|jd|�x>|jD]3}t|j|�r|jd
||f�qqW|jd�d}xy|jD]n}t|j|�ro|d7}xH|j|D]6}|jdd	�d
}|d||||f7}q�WqoqoW|jd|�|j�d|GHdS(Ns
index.htmltws�
<html>
<head>
        <link rel=stylesheet type="text/css" href="style.css" title="style">
        <title>SELinux man pages</title>
</head>
<body>
<h1>SELinux man pages for %s</h1>
<hr>
<table><tr>
<td valign="middle">
<h3>SELinux roles</h3>
s
<a href=#%s_role>%s</a>s
</td>
</tr></table>
<pre>
RBs<p>R�iiso<a name=%s_role></a><a href=%s.html>%s_selinux(8)</a> - Security Enhanced Linux Policy for the %s SELinux user
sH%s
</pre>
<hr>
<table><tr>
<td valign="middle">
<h3>SELinux domains</h3>s3
<a href=#%s_domain>%s</a>
                        sv<a name=%s_domain></a><a href=%s.html>%s_selinux(8)</a> - Security Enhanced Linux Policy for the %s SELinux processes
s%s
</pre>
</body>
</html>
s%s has been created(	R�R�R}R�RReR�RR�(	R�thtmlR�tlettert
rolename_bodyR�trolenametdomainname_bodyt
domainname((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��sL

%
%
cCs@|jd}t|d�}|jd�|j�d|GHdS(Ns	style.cssR�sf
html, body {
    background-color: #fcfcfc;
    font-family: arial, sans-serif;
    font-size: 110%;
    color: #333;
}

h1, h2, h3, h4, h5, h5 {
        color: #2d7c0b;
        font-family: arial, sans-serif;
        margin-top: 25px;
}

a {
    color: #336699;
    text-decoration: none;
}

a:visited {
    color: #4488bb;
}

a:hover, a:focus, a:active {
    color: #07488A;
    text-decoration: none;
}

a.func {
    color: red;
    text-decoration: none;
}
a.file {
    color: red;
    text-decoration: none;
}

pre.code {
    background-color: #f4f0f4;
//    font-family: monospace, courier;
    font-size: 110%;
    margin-left: 0px;
    margin-right: 60px;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 8px;
    padding-right: 8px;
    border: 1px solid #AADDAA;
}

.url {
    font-family: serif;
    font-style: italic;
    color: #440064;
}
s%s has been created(R�R�R}R�(R�t	style_cssR�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�*s
7
(t__name__t
__module__t__doc__R�R�R�R�R�(((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�s				GcBs^eZdZd'ZddgZddeed�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(RS((sK
        Generate a Manpage on an SELinux domain in the specified path
    tDisabledtEnableds/tmpRicCs�||_||_||_t�d|_t�|_t�|_t	�|_
t�|_t
�|_t�|_t�d|_t�d|_t�|_t�|_t�|_|jr�|jd|_n|jtj�|_t|j�|_tj j!|�stj"|�n||_ |jrB|jd|_#n|jd|_#t$|j#�|_%t&|�\|_'|_(|j'd|_)|j*�d||j'f|_+t,|j+d�|_-|j'd	|jkr|j.�|jr&t/j0|j+�q&n&|jrt1j0|j+�n|j2�|j-j3�xNt4t5j6��D]:}||j'krFx"t5|D]}|j7|�qfWqFqFWdS(
Niit
file_contextss
policy.xmls#/usr/share/selinux/devel/policy.xmlt_ts%s/%s_selinux.8R�t_r(8R�tsource_filesR?t
gen_port_dicttportrecsRRWRXtall_domainstget_all_attributestall_attributest
get_all_boolst	all_boolstget_all_port_typestall_port_typesRZt	all_rolesROt	all_userstall_users_rangetget_all_file_typestall_file_typestget_all_role_allowstrole_allowsRbRQtfcpathtselinuxtselinux_file_context_patht
get_fcdicttfcdictR�R4texiststmakedirstxmlpatht
gen_bool_dictt
booleans_dicttgen_short_nameR�t
short_namettypet
_gen_boolst
man_page_pathR�R�t_ManPage__gen_user_man_pageRRGRt_ManPage__gen_man_pageR�R�t
equiv_dicttkeyst_ManPage__gen_man_page_link(R�R�R4R?R�R�tktalias((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�qsV						

		

cCs�g|_g|_|jg}|jtkrox?t|jD]-}|d|jkr;|j|d�q;q;Wnx>|D]6}t|�\}}|j|7_|j|7_qvW|jj�|jj�dS(NR�(	tboolstdomainboolsR�R�R�R�RGt	get_boolsRJ(R�RQttR�R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s		

cCs|jS(N(R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pytget_man_page_path�scCs'|jd|_|js.t|j�|_ny|j|j|_Wnd|j|_nX|j|jkr�tjtj	|j
�dd|_|j�|j
�|j�|j�|j�|j�|j�|j�n|j�|j�|j�|j�|j�|j�dS(NR�s%s user roleiR^(R�R]R*R;R�tdescR�RSRER_R�R^t_user_headert_user_attributet	_can_sudot_xwindows_logint_networkt	_booleanst
_home_exect_transitionst_role_headert_port_typest
_mcs_typest_writest_footer(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt__gen_user_man_page�s.	#












cCs_d|j|f}td|j|fd�|_|jjd|j�|jj�|GHdS(Ns%s/%s_selinux.8R�s.so man8/%s_selinux.8(R4R�R�R}R�R�(R�R�R4((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt__gen_man_page_link�s

cCsAg|_i|_g|_|j�x�|jD]�}yWt|r�|j}|j}xt|D]}|j|�q_W||_||_nWntk
r�q/nXt	j
t	jd|�dd|j|<q/W|j�|j
�|j�|j�|j�|j�|j�|j�|j�|j�|j�dS(Ns%siR^(t	anon_listR^tptypest_get_ptypesttypealias_typesR�R�t_typealias_gen_mantKeyErrorRSRER_t_headert_entrypointst_process_typesR�R�t_nsswitch_domainR�R�t
_file_contextt_public_contentR�(R�tdomain_typeR�R�R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt__gen_man_page�s6			

			
,









cCsOxH|jD]=}|j|j�s4|j|j�r
|jj|�q
q
WdS(N(R�t
startswithR�R�R�RG(R�Rf((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�s$cCsmd|j|d f|_g|_d|_t|jd�|_|j|d �|j�|jj�dS(Ns%s/%s_selinux.8i����RBR�(	R4R�tportstbooltextR�R�t
_typealiasR�R�(R�R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�	s		
cCsr|jjdi|d6tjd�d6�|jjdi|d6|jd6�|jjdi|jd6�dS(Ns\.TH  "%(typealias)s_selinux"  "8"  "%(date)s" "%(typealias)s" "SELinux Policy %(typealias)s"t	typealiass%y-%m-%dtdates�
.SH "NAME"
%(typealias)s_selinux \- Security Enhanced Linux Policy for the %(typealias)s processes
.SH "DESCRIPTION"

%(typealias)s_t SELinux domain type is now associated with %(domainname)s domain type (%(domainname)s_t). 
R�sE
Please see 

.B %(domainname)s_selinux 

man page for more details.
(R�R}ttimetstrftimeR�(R�R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�s		cCsP|jjdi|jd6tjd�d6�|jjdi|jd6�dS(Ns_.TH  "%(domainname)s_selinux"  "8"  "%(date)s" "%(domainname)s" "SELinux Policy %(domainname)s"R�s%y-%m-%dR�s�
.SH "NAME"
%(domainname)s_selinux \- Security Enhanced Linux Policy for the %(domainname)s processes
.SH "DESCRIPTION"

Security-Enhanced Linux secures the %(domainname)s processes via flexible mandatory access control.

The %(domainname)s processes execute with the %(domainname)s_t SELinux type. You can check if you have these processes running by executing the \fBps\fP command with the \fB\-Z\fP qualifier.

For example:

.B ps -eZ | grep %(domainname)s_t

(R�R}R�R�R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�%s"	
cCsO|j|ddj�|j|dd}|ddkrK|d }n|S(Niiii����t.(R�tlower(R�R9R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt_format_boolean_desc7s.
cCs�d}x�|j|jD]|\}}|jd�rT||jkrT|jj|�q||jkriqn|d|j|�||j||f7}qW|S(NRBt
anon_writesg
.PP
If you want to %s, you must turn on the %s boolean. %s by default.

.EX
.B setsebool -P %s 1

.EE
(R�R�tendswithR�RGR�R�tenabled_str(R�R�R9tenabled((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt_gen_bool_text=s+cCsX|j�|_|jdkrT|jjd|j|jf�|jj|j�ndS(NRBs�
.SH BOOLEANS
SELinux policy is customizable based on least access required.  %s policy is extremely flexible and has several booleans that allow you to manipulate the policy and run %s with the tightest access possible.

(RR�R�R}R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�Ps
	cCs�g}ddg}d}x@t|jj��D])}d|j|kr.|j|�q.q.Wt|�r�|jjd�x=|D]2}|d|j|�dj|�||f7}q~Wn|jj|�dS(Ntauthlogin_nsswitch_use_ldaptkerberos_enabledRBtnsswitch_domains
.SH NSSWITCH DOMAIN
sb
.PP
If you want to %s for the %s, you must turn on the %s boolean.

.EX
.B setsebool -P %s 1
.EE
s, (	R�R^R�RGReR�R}R�Rd(R�tnsswitch_typestnsswitch_booleanstnsswitchbooltextR�R9((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�\s	
0cCsyt|j�dkrdS|jjdi|jd6�|jjddj|j��|jjdi|jd6�dS(Nis�
.SH PROCESS TYPES
SELinux defines process types (domains) for each process running on the system
.PP
You can see the context of a process using the \fB\-Z\fP option to \fBps\bP
.PP
Policy governs the access confined processes have to files.
SELinux %(domainname)s policy is very flexible allowing users to setup their %(domainname)s processes in as secure a method as possible.
.PP
The following process types are defined for %(domainname)s:
R�s
.EX
.B %s
.EEs, s�
.PP
Note:
.B semanage permissive -a %(domainname)s_t
can be used to make the process type %(domainname)s_t permissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated.
(ReR�R�R}R�Rd(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�ts	
		c	Cs5g|_xH|jD]=}|j|j�s=|j|j�r|jj|�qqWt|j�dkrmdS|jjdi|jd6�x�|jD]�}|jjd|�t	}xud
D]m}||f|j
kr�|r�|jjd�nt}|jjd|d	j|j
||f�f�q�q�Wq�WdS(Nis�
.SH PORT TYPES
SELinux defines port types to represent TCP and UDP ports.
.PP
You can see the types associated with a port by using the following command:

.B semanage port -l

.PP
Policy governs the access confined processes have to these ports.
SELinux %(domainname)s policy is very flexible allowing users to setup their %(domainname)s processes in as secure a method as possible.
.PP
The following port types are defined for %(domainname)s:R�s

.EX
.TP 5
.B %s
.TP 10
.EE
ttcptudps

Default Defined Ports:s

%s %s
.EEt,(R
R(
R�R�R�R�R�RGReR�R}RzR�RYRd(R�Rftptoncetprot((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s(	$		
	
	cCsXg}g}g}x�|jD]y}|j|j�r|j|�t|�s[t|�rk|j|�n||jkr�||j|d}q�qqWt|�dkr�dS|j�i}x�|D]�}t	}x8|D]0}|j|�r�||j|�t
}Pq�q�W|s�xAtD]6}	|j|	�r|jd�rg||d <PqqWq�q�Wg}
x4|D],}t||�dkrh|
j|�qhqhW|j
jdi|jd6�t|
�dkr%|j
jd�xJ|
D]?}	|j
jdi|jd6|	d	6|	jd
�dd6�q�Wn|rW|j
jd
i|jd6|dd6�n|j
jdi|jd6�x�|D]�}|j
jd|tj|�f�||jkr|d}t|j|d�dkr@d}|j
jd||j|ddf�x4|j|ddD]}
|j
jd|
�qWq@q|q|W|j
jd�dS(Ntregexis(/.*)?i����s�
.SH FILE CONTEXTS
SELinux requires files to have an extended attribute to define the file type.
.PP
You can see the context of a file using the \fB\-Z\fP option to \fBls\bP
.PP
Policy governs the access confined processes have to these files.
SELinux %(domainname)s policy is very flexible allowing users to setup their %(domainname)s processes in as secure a method as possible.
.PP
R�s 
.PP
.B EQUIVALENCE DIRECTORIES
s�
.PP
%(domainname)s policy stores data with multiple different file context types under the %(equiv)s directory.  If you would like to store the data in a different directory you can use the semanage command to create an equivalence mapping.  If you wanted to store this data under the /srv dirctory you would execute the following command:
.PP
.B semanage fcontext -a -e %(equiv)s /srv/%(alt)s
.br
.B restorecon -R -v /srv/%(alt)s
.PP
tequivRii����talts�
.PP
.B STANDARD FILE CONTEXT

SELinux defines the file context types for the %(domainname)s, if you wanted to
store files with these types in a diffent paths, you need to execute the semanage command to sepecify alternate labeling and then use restorecon to put the labels on disk.

.B semanage fcontext -a -t %(type)s '/srv/my%(domainname)s_content(/.*)?'
.br
.B restorecon -R -v /srv/my%(domainname)s_content

Note: SELinux often uses regular expressions to specify labels that match multiple files.
R�s=
.I The following file types are defined for %(domainname)s:
s

.EX
.PP
.B %s
.EE

- %s
RBitss
.br
.TP 5
Path%s:
%ss, %ss

.PP
Note: File context can be temporarily modified with the chcon command.  If you want to permanently change the file context you need to use the
.B semanage fcontext
command.  This will modify the SELinux labeling database.  You will need to use
.B restorecon
to apply the labels.
(R�R�R�RGtfile_type_is_executabletfile_type_is_entrypointR�ReRJRYRzt
equiv_dirsRR�R}RHRStget_description(R�tflisttflist_non_exectmpathsRftmdirstmpR[tmdR:RR8tpluraltx((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��sp





			
	7	#	
		 "	cCs�d}xp|jD]e}||jkr+qn|j|j�rN|d|7}n|j|jd�r|d|7}qqW|jj|�dS(NRBs, %s_selinux(8)R=(RWR�R�R�R�R}(R�tretRM((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt	_see_also'scCs�t|j�dkr�|jjdi|jd6�x_|jD]Q}|j|ddj�|j|dd}|jjd|||f�q=WndS(Nis,
.SH SHARING FILES
If you want to share files with multiple domains (Apache, FTP, rsync, Samba), you can set a file context of public_content_t and public_content_rw_t.  These context allow any of the above domains to read the content.  If you want a particular domain to write to the public_content_rw_t domain, you must set the appropriate boolean.
.TP
Allow %(domainname)s servers to read the /var/%(domainname)s directory by adding the public_content_t file type to the directory and by restoring the file type.
.PP
.B
semanage fcontext -a -t public_content_t "/var/%(domainname)s(/.*)?"
.br
.B restorecon -F -R -v /var/%(domainname)s
.pp
.TP
Allow %(domainname)s servers to read and write /var/%(domainname)s/incoming by adding the public_content_rw_t type to the directory and by restoring the file type.  You also need to turn on the %(domainname)s_anon_write boolean.
.PP
.B
semanage fcontext -a -t public_content_rw_t "/var/%(domainname)s/incoming(/.*)?"
.br
.B restorecon -F -R -v /var/%(domainname)s/incoming
.br
.B setsebool -P %(domainname)s_anon_write 1
R�iisW
.PP
If you want to %s, you must turn on the %s boolean.

.EX
.B setsebool -P %s 1
.EE
(ReR�R�R}R�R�R�(R�R9R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�2s	.	cCs�|jjd�t|j�dkr8|jjd�n|jdkrZ|jjd�n|jjd|j�|jdkr�|jjd�n|j�dS(Ns#
.SH "COMMANDS"
.B semanage fcontext
can also be used to manipulate default file context mappings.
.PP
.B semanage permissive
can also be used to manipulate whether or not a process type is permissive.
.PP
.B semanage module
can also be used to enable/disable/install/remove policy modules.
isF
.B semanage port
can also be used to manipulate the port definitions
RBsA
.B semanage boolean
can also be used to manipulate the booleans
s�
.PP
.B system-config-selinux
is a GUI tool available to customize SELinux policy settings.

.SH AUTHOR
This manual page was auto-generated using
.B "sepolicy manpage".

.SH "SEE ALSO"
selinux(8), %s(8), semanage(8), restorecon(8), chcon(1), sepolicy(8)
s, setsebool(8)(R�R}ReR�R�R�R!(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�Ts	
	
	
	cCsW||jdgkrtS|jd�rSx(|D]}||j|kr/tSq/WntS(NR\R�(R�RYRRQRz(R�tcheckR^ta((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt_valid_writes
cCsMyNgtjtjgi|jd6dgd6dd6�D]}|d^q7}WndSX|jjd�t|�dkr�d	d
j|�}nd|d}|jjd
|j||jf�d|kr�|j	d�|jjd�ng}x5|D]-}||j
kr�||j
|d7}q�q�W|jjdd
j|��dS(Ntsourcet
entrypointtpermlisttfiletclassttargets
.SH "ENTRYPOINTS"
is\fB%s\fP file typess, s\fB%s\fP file typeisw
The %s_t SELinux type can be entered via the %s.

The default entrypoint paths for the %s_t domain are the following:
tbin_ts^
All executeables with the default executable label, usually stored in /usr/bin and /usr/sbin.Rs
%s(RStsearchtALLOWR�R�R}ReRdR�tremoveR�(R�Rtentrypointstentrypoints_strtpathsR&((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s*N		
	

	cCsRtjtj|j�dd}d|kr0dS|jjdi|jd6�dS(NiR^tmcs_constrained_types�
.SH "MCS Constrained"
The SELinux process type %(type)s_t is an MCS (Multi Category Security) constrained type.  Sometimes this separation is referred to as sVirt. These types are usually used for securing multi-tenant environments, such as virtualization, containers or separation of users.  The tools used to launch MCS types, pick out a different MCS label for each process group.

For example one process might be launched with %(type)s_t:s0:c1,c2, and another process launched with %(type)s_t:s0:c3,c4. The SELinux kernel only allows these processes can only write to content with a matching MCS label, or a MCS Label of s0. A process running with the MCS level of s0:c1,c2 is not allowed to write to content with the MCS label of s0:c3,c4
R�(RSRER_R�R�R}R�(R�R^((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s
 	cCs�tjtjgi|jd6ddgd6dd6�}|dksTt|�dkrXdSg}dd	g}x5|D]-}|d
jd�sq|j|d
�qqqqWxK|D]C}|j|d
|�r�|d
|kr�|j|d
�q�q�q�Wt|�dkrdS|j	j
d�|j	j
d
|j�|j�d|krOdg}nxd|D]\}|j	j
d|�||j
krVx0|j
|dD]}|j	j
d|�q�WqVqVWdS(NR%R�R}R'R(R)it	proc_typetsysctl_typeR*R�s
.SH "MANAGED FILES"
s�
The SELinux process type %s_t can manage files labeled with the following file types.  The paths listed are the default paths for these file types.  Note the processes UID still need to have DAC permissions.
t	file_types
.br
.B %s

Rs	%s
.br
(RSR,R-R�tNoneReRRGR$R�R}R�RJR�(R�R't
all_writesR^RpRfR4((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s86

		

		cCs$|j|jkr |j|jSdS(Nts0(R�R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt_get_users_range�scCs�|jjdi|jd6�|jjdi|jd6|jd6|jd6|j�d6�d|jkr�d|jkr�|jjdi|jd6�ndS(	Nsd.TH  "%(type)s_selinux"  "8"  "%(type)s" "mgrepl@redhat.com" "%(type)s SELinux Policy documentation"R�s
.SH "NAME"
%(user)s_u \- \fB%(desc)s\fP - Security Enhanced Linux Policy

.SH DESCRIPTION

\fB%(user)s_u\fP is an SELinux User defined in the SELinux
policy. SELinux users have default roles, \fB%(user)s_r\fP.  The
default role has a default type, \fB%(user)s_t\fP, associated with it.

The SELinux user will usually login to a system with a context that looks like:

.B %(user)s_u:%(user)s_r:%(user)s_t:%(range)s

Linux users are automatically assigned an SELinux users at login.
Login programs use the SELinux User to assign initial context to the user's shell.

SELinux policy uses the context to control the user's access.

By default all users are assigned to the SELinux user via the \fB__default__\fP flag

On Targeted policy systems the \fB__default__\fP user is assigned to the \fBunconfined_u\fP SELinux user.

You can list all Linux User to SELinux user mapping using:

.B semanage login -l

If you wanted to change the default user mapping to use the %(user)s_u user, you would execute:

.B semanage login -m -s %(user)s_u __default__

R�R%R<tlogin_userdomains�
If you want to map the one Linux user (joe) to the SELinux user %(user)s, you would execute:

.B $ semanage login -a -s %(user)s_u joe

(R�R}R�R�R�R9R^R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s	6	cCs�d|j}|jjd�||jkr�|jd}|jjdi|jd6�x�|j|D]k}|jjdi|d d6|jd6�|jjd	i|jd6d
j|g|j|�d6�qeW|jjd|j�ndS(
Ns	%s_sudo_ts

.SH SUDO
R�s�
The SELinux user %(user)s can execute sudo.

You can set up sudo to allow %(user)s to transition to an administrative domain:

Add one or more of the following record to sudoers using visudo.

R%s�
USERNAME ALL=(ALL) ROLE=%(admin)s_r TYPE=%(admin)s_t COMMAND
.br
sudo will run COMMAND as %(user)s_u:%(admin)s_r:%(admin)s_t:LEVEL
i����tadmins_
You might also need to add one or more of these new roles to your SELinux user record.

List the SELinux roles your SELinux user can reach by executing:

.B $ semanage user -l |grep selinux_name

Modify the roles list and add %(user)s_r to this list.

.B $ semanage user -m -R '%(roles)s' %(user)s_u

For more details you can see semanage man page.

Rctroless7
The SELinux type %s_t is not allowed to execute sudo.
(R�R�R}RQR�Rd(R�tsudotypeR]t	adminrole((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�
s
	
		 	
7	cCs�|jjd�d|jkr9|jjd|j�nd|jkrb|jjd|j�nd|jkr�|jjd|j�ndS(Ns
.SH USER DESCRIPTION
tunconfined_usertypes�
The SELinux user %s_u is an unconfined user. It means that a mapped Linux user to this SELinux user is supposed to be allow all actions.
tunpriv_userdomains�
The SELinux user %s_u is defined in policy as a unprivileged user. SELinux prevents unprivileged users from doing administration tasks without transitioning to a different role.
tadmindomains�
The SELinux user %s_u is an admin user. It means that a mapped Linux user to this SELinux user is intended for administrative actions. Usually this is assigned to a root Linux user.
(R�R}R^R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�6s				cCsfd|jkrb|jjd�d|jkrH|jjd|j�qb|jjd|j�ndS(Ntx_domains
.SH X WINDOWS LOGIN
s3
The SELinux user %s_u is able to X Windows login.
s7
The SELinux user %s_u is not able to X Windows login.
(R�R�R}R^R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�Is			cCsfd|jkrb|jjd�d|jkrH|jjd|j�qb|jjd|j�ndS(NR:s
.SH TERMINAL LOGIN
s2
The SELinux user %s_u is able to terminal login.
s6
The SELinux user %s_u is not able to terminal login.
(R�R�R}R^R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt_terminal_loginWs			cCsUddlm}|jjd�x.d
D]&}|j|j|d�}t|�dkr�|jjd|j|f�xI|D]>}x5||D])\}}|jjd	d
j|��q�Wq{Wn|j|jdd�}t|�dkr'|jjd|j�xI|D]>}x5||D])\}}|jjd	d
j|��qWqWq'q'WdS(Ni����(tnetworks

.SH NETWORK
R
Rt	name_bindisH
.TP
The SELinux user %s_u is able to listen on the following %s ports.
s
.B %s
Rtname_connectsJ
.TP
The SELinux user %s_u is able to connect to the following tcp ports.
(stcpsudp(	RSRDR�R}tget_network_connectR�ReR�Rd(R�RDtnettportdictR
R�R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR�es(	
	
		
	c	Cs�tjtjgi|jd6dd6dd6dddd	d
dgd6�}|jjd
�|dk	r|jjd|j�n|jjd|j�dS(NR%tuser_home_typeR*R(R)tioctltreadtgetattrtexecutetexecute_no_transR�R's
.SH HOME_EXEC
s;
The SELinux user %s_u is able execute home content files.
s?
The SELinux user %s_u is not able execute home content files.
(RSR,R-R�R�R}R6R�(R�R'((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��sI			cCs,|jjdi|jd6|jd6�dS(Ns�
.SH TRANSITIONS

Three things can happen when %(type)s attempts to execute a program.

\fB1.\fP SELinux Policy can deny %(type)s from executing the program.

.TP

\fB2.\fP SELinux Policy can allow %(type)s to execute the program in the current user type.

Execute the following to see the types that the SELinux user %(type)s can execute without transitioning:

.B sesearch -A -s %(type)s -c file -p execute_no_trans

.TP

\fB3.\fP SELinux can allow %(type)s to execute the program and transition to a new type.

Execute the following to see the types that the SELinux user %(type)s can execute and transition:

.B $ sesearch -A -s %(type)s -c process -p transition

R%R�(R�R}R�R�(R�((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s	cCs�|jjdi|jd6�|jjdi|jd6|jd6�g}x;|jD]0}|jd|j|krV|j|�qVqVWt|�dkr�d}t|�dkr�d	}|jjd
dj|�||jf�q�ndS(Nsd.TH  "%(user)s_selinux"  "8"  "%(user)s" "mgrepl@redhat.com" "%(user)s SELinux Policy documentation"R%s]
.SH "NAME"
%(user)s_r \- \fB%(desc)s\fP - Security Enhanced Linux Policy

.SH DESCRIPTION

SELinux supports Roles Based Access Control (RBAC), some Linux roles are login roles, while other roles need to be transition into.

.I Note:
Examples in this man page will use the
.B staff_u
SELinux user.

Non login roles are usually used for administrative tasks. For example, tasks that require root privileges.  Roles control which types a user can run processes with. Roles often have default types assigned to them.

The default type for the %(user)s_r role is %(user)s_t.

The
.B newrole
program to transition directly to this role.

.B newrole -r %(user)s_r -t %(user)s_t

.B sudo
is the preferred method to do transition from one role to another.  You setup sudo to transition to %(user)s_r by adding a similar line to the /etc/sudoers file.

USERNAME ALL=(ALL) ROLE=%(user)s_r TYPE=%(user)s_t COMMAND

.br
sudo will run COMMAND as staff_u:%(user)s_r:%(user)s_t:LEVEL

When using a a non login role, you need to setup SELinux so that your SELinux user can reach %(user)s_r role.

Execute the following to see all of the assigned SELinux roles:

.B semanage user -l

You need to add %(user)s_r to the staff_u user.  You could setup the staff_u user to be able to use the %(user)s_r role with a command like:

.B $ semanage user -m -R 'staff_r system_r %(user)s_r' staff_u

R�R�iRBiRs�

SELinux policy also controls which roles can transition to a different role.
You can list these rules using the following command.

.B sesearch --role_allow

SELinux policy allows the %s role%s can transition to the %s_r role.

s, (R�R}R�R�R�RGReRd(R�ttrolesRpR((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyR��s	)		N()R�R�R�R6R*RRYR�R�R�R�R�R�R�R�R�R�R�RR�R�R�R�R�R!R�R�R$R�R�R�R9R�R�R�R�RCR�R�R�R�(((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyRjsJ8					!											+	o		"	+			 		(		-	)						(RRR	R
(RR
RR((("t__all__RltargparseR�RStsepolgenRRwR|R�treR�R�R�RR6R*R;RCRDRORRRURWRRQRbRhRRRsR�RR(((s6/usr/lib64/python2.7/site-packages/sepolicy/manpage.pyt<module>sH

E							
	�