404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.119.192.221: ~ $
3

El�f��@sdddddgZddlZddlZddlZddlZddlZd3d4ddd�Zdgdgddgdgdgdgd�ZdgZda	d5dd�Z
dadadd�Z
dad d!�Zdad"d�Zdad#d$�Zdad%d&�Zdad'd(�Zdad)d*�Zd+d,�ZgZgZd-d.�Zd/d0�ZGd1d�d�ZGd2d�d�Z dS)6�ManPage�HTMLManPages�manpage_domains�
manpage_roles�gen_domains�N�amavis_t�clamd_t�
clamscan_t�freshclam_t�rgmanager_t�
corosync_t�	aisexec_t�pacemaker_tZqemu_tZphpfpm_t)Zantivirus_tZ	cluster_tZsvirt_tZhttpd_tZsambaZapacheZvirtZlibvirtZbindZsmartmonZraid)ZsmbdZhttpdZvirtdZnamedZfsdaemonZmdadmz/var�#/usr/share/selinux/devel/policy.xmlcCs�trtSddl}iay�|jjjtj|��}xx|jd�D]j}xd|jd�D]V}|jd�}|dksF|dkrfqF|dkrrd}|dkr~d}x|jd	�D]}|j	t|<q�WqFWq6WWnt
k
r�YnXtS)
NrZlayer�module�name�userZ
unconfinedZ
unprivuserZunconfineduserZsummary)�modules_dictZxml.etree.ElementTreeZetreeZElementTreeZ
fromstring�sepolicyZ
policy_xml�findall�get�text�IOError)�pathZxmlZtree�l�mr�b�r�/usr/lib/python3.6/manpage.py�gen_modules_dict-s(
rcCs�trtrttfSgaiag}tjtj�}x<|D]4}|j|d�d|kr.|dt|djd�d<q.Wx&|D]}|d
krltj|jdd	��qlWtj�ttfS)Nr�range�_r�system_u�root�unconfined_uZ_u�)r"r#r$)	�users�users_ranger�infoZUSER�append�split�replace�sort)ZallusersZ
allusers_info�d�urrr�get_all_users_infoIs

r/cCststtjtjd��datS)N�
entry_type�types)�all_entrypoints�nextrr(�	ATTRIBUTErrrr�get_entrypointsasr5cCs�trtSgax4tj�D](}d}|dd�}|tkr4qtj|�qWx<tj�D]0}|dd�tksL|dkrjqLtj|dd��qLWtj�tS)NF�Zsystem_r���r7r7)�domainsr�get_all_domainsr)�
get_all_rolesr,)r-�found�domain�rolerrrrjscCs"tdkrttjtjd��datS)NZ	exec_typer1)�
exec_typesr3rr(r4rrrr�_gen_exec_types�sr?cCs"tdkrttjtjd��datS)Nr0r1)�entry_typesr3rr(r4rrrr�_gen_entry_types�srAcCstdkrttjtjd��atS)NZmcs_constrained_type)�mcs_constrained_typesr3rr(r4rrrr�_gen_mcs_constrained_types�srCcCsXtrtStjtj�}iax:|D]2}y|dt|d<Wqgt|d<YqXqWtS)N�
attributesr)r1rr(�TYPE)Z	all_typesZrecrrr�
_gen_types�s
rFcCsdj|dt|��jd��S)N� r!)�join�lenr*)�fZtrimrrr�prettyprint�srKcCsftjtjg�}xRtjD]H}g}x6|D].}|jd�dd|kr$|j|jd�d�q$W|||<qW|S)N�/�r���rN)�dict�fromkeys�stringZ
ascii_lettersr*r))Zmanpage_listZalphabet_manpages�iZtemp�jrrr�get_alphabet_manpages�s
rTcCstyddlm}Wn tk
r0ddlm}YnX|d|�\}}|dkrpt|d�t|d�}|j|�|j�dS)Nr)�getstatusoutputz)/usr/bin/groff -man -Thtml %s 2>/dev/nullzhas been created�w)ZcommandsrU�ImportError�
subprocess�print�open�write�close)Zhtml_manpageZmanpagerUZrc�output�fdrrr�convert_manpage_to_html�s


r_c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rzF
            Generate a HTML Manpages on an given SELinux domains
    cCsTt|�|_t|�|_||_|d|_|j|_|jr<|j�ntd|�td�dS)NrLz7SELinux HTML man pages can not be generated for this %srM)	rTrr�
os_version�old_path�new_path� _HTMLManPages__gen_html_manpagesrY�exit)�selfrrrr`rrr�__init__�s



zHTMLManPages.__init__cCs|j�|j�|j�dS)N)�_write_html_manpage�
_gen_index�_gen_css)rerrrZ__gen_html_manpages�sz HTMLManPages.__gen_html_manpagescCs�tjj|j�stj|j�xN|jj�D]@}t|�r&x2|D]*}t|j|j	dd�dd|j
|�q8Wq&WxN|jj�D]@}t|�rvx2|D]*}t|j|j	dd�dd|j
|�q�WqvWdS)N�_selinuxrMrz.html)�osr�isdirrb�mkdirr�valuesrIr_�rsplitrar)rer<r-r=�rrrrrg�s
.
z HTMLManPages._write_html_manpagec	Cs�|j|jd}t|d�}|jd|j�x.|jD]$}t|j|�r2|jd||f�q2W|jd�d}x\|jD]R}t|j|�rp|d7}x6|j|D](}|jdd	�d
}|d||||f7}q�WqpW|jd|�x.|jD]$}t|j|�r�|jd
||f�q�W|jd�d}xb|jD]X}t|j|��r|d7}x8|j|D]*}|jdd	�d
}|d||||f7}�qBW�qW|jd|�|j�t	d|�dS)Nz.htmlrVz�
<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>
z
<a href=#%s_role>%s</a>z
</td>
</tr></table>
<pre>
r%z<p>rjrMrzo<a name=%s_role></a><a href=%s.html>%s_selinux(8)</a> - Security Enhanced Linux Policy for the %s SELinux user
zH%s
</pre>
<hr>
<table><tr>
<td valign="middle">
<h3>SELinux domains</h3>z
<a href=#%s_domain>%s</a>
			zv<a name=%s_domain></a><a href=%s.html>%s_selinux(8)</a> - Security Enhanced Linux Policy for the %s SELinux processes
z%s
</pre>
</body>
</html>
z%s has been created)
rbr`rZr[rrIrorr\rY)	re�htmlr^ZletterZ
rolename_bodyrpZrolenameZdomainname_body�
domainnamerrrrh�sL
 
zHTMLManPages._gen_indexcCs6|jd}t|d�}|jd�|j�td|�dS)Nz	style.cssrVaQ
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;
}
z%s has been created)rarZr[r\rY)reZ	style_cssr^rrrri8s

7zHTMLManPages._gen_cssN)	�__name__�
__module__�__qualname__�__doc__rfrcrgrhrirrrrr�s
Gc@s.eZdZdZdZddgZdLdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dBdC�Z#dDdE�Z$dFdG�Z%dHdI�Z&dJdK�Z'dS)MrzK
        Generate a Manpage on an SELinux domain in the specified path
    NZDisabledZEnabled�/tmprLFcCs||_||_||_tj�d|_t�|_tj�|_	tj
�|_tj�|_
tj�|_tj�|_t�d|_t�d|_tj�|_tj�|_t�|_t�|_t�|_t�|_ |jr�|jd|_!n|jt"j#�|_!tj$|j!�|_%t&j'j(|�s�t&j)|�||_'|j�r
|jd|_*n|jd|_*tj+|j*�|_,tj-|�\|_.|_/|j.d|_0|j1�d||j.f|_2t3|j2d�|_4|j.d	|jk�r�|j5�|j�r�t6j7|j2�n|j�r�t8j7|j2�|j9�|j4j:�x<t;j<�D]0}||j.k�r�xt;|D]}|j=|��q�W�q�WdS)
NrrMZ
file_contextsz
policy.xmlz#/usr/share/selinux/devel/policy.xml�_tz%s/%s_selinux.8rV�_r)>rq�source_filesr#rZ
gen_port_dict�portrecsrr8r9�all_domainsZget_all_attributes�all_attributesZ
get_all_boolsZ	all_boolsZget_all_port_types�all_port_typesr:Z	all_rolesr/�	all_users�all_users_rangeZget_all_file_types�all_file_typesZget_all_role_allows�role_allowsrFr1r?r>rAr@rCrBZfcpath�selinuxZselinux_file_context_pathZ
get_fcdict�fcdictrkr�exists�makedirs�xmlpathZ
gen_bool_dict�
booleans_dictZgen_short_namerr�
short_name�type�
_gen_bools�
man_page_pathrZr^�_ManPage__gen_user_man_pagerr)r�_ManPage__gen_man_pager\�
equiv_dict�keys�_ManPage__gen_man_page_link)rerrrr#rzrq�k�aliasrrrrf�s\








zManPage.__init__cCs�g|_g|_|jg}|jtkrNx.t|jD] }|d|jkr*|j|d�q*Wx6|D].}tj|�\}}|j|7_|j|7_qTW|jj	�|jj	�dS)Nrx)
�bools�domainboolsr�rrr�r|r)rZ	get_boolsr,)rer1�tr�r�rrrr��s


zManPage._gen_boolscCs|jS)N)r�)rerrr�get_man_page_path�szManPage.get_man_page_pathc
Cs�|jd|_|jst|j�|_y|j|j|_Wnd|j|_YnX|j|jkr�ttj	tj
|j��d|_|j
�|j�|j�|j�|j�|j�|j�|j�n|j�|j�|j�|j�|j�|j�dS)Nryz%s user rolerD)rrr=rrr��descrr3rr(rEr�rD�_user_header�_user_attribute�	_can_sudo�_xwindows_login�_network�	_booleans�
_home_exec�_transitions�_role_header�_port_types�
_mcs_types�_writes�_footer)rerrrZ__gen_user_man_page�s.
zManPage.__gen_user_man_pagecCsLd|j|f}td|j|fd�|_|jjd|j�|jj�t|�dS)Nz%s/%s_selinux.8rVz.so man8/%s_selinux.8)rrZr^r[rrr\rY)rer�rrrrZ__gen_man_page_link�s

zManPage.__gen_man_page_linkcCs�g|_i|_g|_|j�x�|jD]|}y@t|rd|j}|j}xt|D]}|j|�qFW||_||_Wntk
r|w"YnXt	t
jt
jd|��d|j|<q"W|j
�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�dS)Nz%srD)�	anon_listrD�ptypes�_get_ptypes�typealias_typesr^r��_typealias_gen_man�KeyErrorr3rr(rE�_header�_entrypoints�_process_typesr�r��_nsswitch_domainr�r��
_file_context�_public_contentr�)reZdomain_typer^r�r�rrrZ__gen_man_page�s6
$zManPage.__gen_man_pagecCs8x2|jD](}|j|j�s$|j|j�r|jj|�qWdS)N)r|�
startswithr�rrr�r))rerJrrrr�szManPage._get_ptypescCsZd|j|dd�f|_g|_d|_t|jd�|_|j|dd��|j�|jj�dS)Nz%s/%s_selinux.8r6r%rVr7r7)	rr��ports�booltextrZr^�
_typealiasr�r\)rer�rrrr�szManPage._typealias_gen_mancCsN|jjd|tjd�d��|jjd||jd��|jjdd|ji�dS)Nz\.TH  "%(typealias)s_selinux"  "8"  "%(date)s" "%(typealias)s" "SELinux Policy %(typealias)s"z%y-%m-%d)�	typealias�datez�
.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�rrzC
Please see

.B %(domainname)s_selinux

man page for more details.
rr)r^r[�time�strftimerr)rer�rrrr�#szManPage._typealiascCs8|jjd|jtjd�d��|jjdd|ji�dS)Nz_.TH  "%(domainname)s_selinux"  "8"  "%(date)s" "%(domainname)s" "SELinux Policy %(domainname)s"z%y-%m-%d)rrr�a�
.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

rr)r^r[rrr�r�)rerrrr�6s
zManPage._headercCsH|j|ddj�|j|ddd�}|ddkrD|dd�}|S)Nr6rrM�.rNrN)r��lower)rerr�rrr�_format_boolean_descHs,zManPage._format_boolean_desccCspd}xf|j|jD]V\}}|jd�r<||jkr<|jj|�q||jkrHq|d|j|�||j||f7}qW|S)Nr%Z
anon_writezg
.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��endswithr�r)r�r��enabled_str)rer�rZenabledrrr�_gen_bool_textNs
"zManPage._gen_bool_textcCs>|j�|_|jdkr:|jjd|j|jf�|jj|j�dS)Nr%z�
.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.

)r�r�r^r[rr)rerrrr�as


zManPage._booleanscCs�g}ddg}d}x*|jj�D]}d|j|kr|j|�qWt|�r~|jjd�x,|D]$}|d|j|�dj|�||f7}qVW|jj|�dS)NZauthlogin_nsswitch_use_ldapZkerberos_enabledr%Znsswitch_domainz
.SH NSSWITCH DOMAIN
zb
.PP
If you want to %s for the %s, you must turn on the %s boolean.

.EX
.B setsebool -P %s 1
.EE
z, )rDr�r)rIr^r[r�rH)reZnsswitch_typesZnsswitch_booleansZnsswitchbooltextr�rrrrr�ms
"zManPage._nsswitch_domaincCsZt|j�dkrdS|jjdd|ji�|jjddj|j��|jjdd|ji�dS)Nra�
.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:
rrz
.EX
.B %s
.EEz, z�
.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.
)rIr�r^r[rrrH)rerrrr��s
zManPage._process_typesc	Cs�g|_x2|jD](}|j|j�s*|j|j�r|jj|�qWt|j�dkrLdS|jjdd|ji�xv|jD]l}|jjd|�d}xRdD]J}||f|j	kr�|r�|jjd�d	}|jjd
|dj
|j	||f�f�q�WqjWdS)
Nra�
.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:rrz

.EX
.TP 5
.B %s
.TP 10
.EE
T�tcp�udpz

Default Defined Ports:Fz

%s %s
.EE�,)r�r�)r�r~r�r�rrr)rIr^r[r{rH)rerJ�p�onceZprotrrrr��s(

zManPage._port_typescCs�g}g}g}x^|jD]T}|j|j�r|j|�||jksB||jkrL|j|�||jkr||j|d}qWt|�dkr|dS|j�i}xt|D]l}d}x*|D]"}|j|�r�||j|�d}Pq�W|s�x2t	D]*}	|j|	�o�|j
d�r�g||dd�<Pq�Wq�Wg}
x*|D]"}t||�dk�r|
j|��qW|jjdd|ji�t|
�dk�r�|jjd	�x2|
D]*}	|jjd
|j|	|	j
d�dd
���qdW|�r�|jjd|j|dd��|jjdd|ji�|j�x�|D]�}|jjd|tj|�f�||jk�r�d}t|j|d�dk�r�d}|jjd||j|ddf�x0|j|ddd�D]}
|jjd|
��q\W�q�W|jjd�dS)N�regexrFTz(/.*)?�a�
.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
rrz 
.PP
.B EQUIVALENCE DIRECTORIES
a�
.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
rLrM)rr�equivZalta�
.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.
)rrr�z=
.I The following file types are defined for %(domainname)s:
z

.EX
.PP
.B %s
.EE

- %s
r%�sz
.br
.TP 5
Path%s:
%sz, %sa

.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.
i����rNrN)r�r�rrr)r>r@r�rIr,�
equiv_dirsr�r^r[r*rZget_description)re�flistZflist_non_execZmpathsrJZmdirsZmpr;Zmd�er�r�plural�xrrrr��sr








	
$
zManPage._file_contextcCsdd}xN|jD]D}||jkrq|j|j�r4|d|7}|j|jd�r|d|7}qW|jj|�dS)Nr%z, %s_selinux(8)r!)r8rrr�r�r^r[)re�retr-rrr�	_see_also9s
zManPage._see_alsocCszt|j�dkrv|jjdd|ji�xP|jD]F}|j|ddj�|j|ddd�}|jjd|||f�q,WdS)Nra,
.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
rrr6rMzW
.PP
If you want to %s, you must turn on the %s boolean.

.EX
.B setsebool -P %s 1
.EE
)rIr�r^r[rrr�r�)rerr�rrrr�Ds,zManPage._public_contentcCsp|jjd�t|j�dkr&|jjd�|jdkr<|jjd�|jjd|j�|jdkrd|jjd�|j�dS)Na#
.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.
rzF
.B semanage port
can also be used to manipulate the port definitions
r%zA
.B semanage boolean
can also be used to manipulate the booleans
z�
.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)z, setsebool(8))r^r[rIr�r�rrr�)rerrrr�fs



zManPage._footercCs@||jdgkrdS|jd�r<x|D]}||j|kr"dSq"WdS)Nr<FrxT)r�r�r1)reZcheckrD�arrr�_valid_write�s

zManPage._valid_writecs�dd�t�fdd�tj��D�}t|�dkr0dS�jjd�t|�dkrXdd	j|�}nd
|d}�jjd�j|�jf�d|kr�|jd��jjd
�g}x(|D] }|�j	kr�|�j	|d7}q�W�jjdd	j|��dS)NcSsg|]}|d�qS)�targetr)�.0r�rrr�
<listcomp>�sz(ManPage._entrypoints.<locals>.<listcomp>cs&|d�jko$|ddko$d|dkS)N�source�class�file�
entrypoint�permlist)r�)�y)rerr�<lambda>�sz&ManPage._entrypoints.<locals>.<lambda>rz
.SH "ENTRYPOINTS"
rMz\fB%s\fP file typesz, z\fB%s\fP file typezw
The %s_t SELinux type can be entered via the %s.

The default entrypoint paths for the %s_t domain are the following:
Zbin_tz^
All executeables with the default executable label, usually stored in /usr/bin and /usr/sbin.r�z
%s)
�filterr�get_all_allow_rulesrIr^r[rHrr�remover�)reZentrypointsZentrypoints_str�pathsr�r)rerr��s*


zManPage._entrypointscCs.|j|jdkrdS|jjdd|ji�dS)Nr1a�
.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�)r�rBr^r[rr)rerrrr��szManPage._mcs_typescsT�jg�y*�tt�fdd�tj���dd7�WnYnXtt�fdd�tj���}|dksnt|�dkrrdSg}ddg}x6|D].}�j|d|�r�|d|kr�|j|d�q�Wt|�dkr�dS�j	j
d	��j	j
d
�j�|j�d|kr�dg}xT|D]L}�j	j
d|�|�j
k�rx(�j
|d
D]}�j	j
d|��q0W�qWdS)Ncs|d�jkS)Nr)r�)r�)rerrr��sz!ManPage._writes.<locals>.<lambda>rrDcs.|d�ko,tddg�j|d�o,|ddkS)Nr�rZr[r�r�r�)�set�issubset)r�)�src_listrrr��sZ	proc_typeZsysctl_typer�z
.SH "MANAGED FILES"
z�
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.
Z	file_typez
.br
.B %s

r�z	%s
.br
)r��listr�rZget_all_types_infor�rIr�r)r^r[rrr,r�)rer�Z
all_writesrDrRrJrr)rer�rr��s>*


zManPage._writescCs|j|jkr|j|jSdS)NZs0)rrr�)rerrr�_get_users_range�szManPage._get_users_rangecCsh|jjdd|ji�|jjd|j|j|j|j�d��d|jkrdd|jkrd|jjdd|ji�dS)Nzd.TH  "%(type)s_selinux"  "8"  "%(type)s" "mgrepl@redhat.com" "%(type)s SELinux Policy documentation"r�a
.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�rr �login_userdomainz�
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[rrr�r�r�rDr})rerrrr��szManPage._user_headercCs�d|j}|jjd�||jkr�|jd}|jjdd|ji�xn|j|D]N}|jjd|dd
�|jd��|jjd	|jd
j|g|j|�d��qLW|jjd|j�dS)Nz	%s_sudo_tz

.SH SUDO
ryz�
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.

rz�
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
r6)Zadminra_
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.

rG)rZrolesz7
The SELinux type %s_t is not allowed to execute sudo.
r7)rrr^r[r1r�rH)reZsudotyper=Z	adminrolerrrr�(s



(zManPage._can_sudocCsd|jjd�d|jkr(|jjd|j�d|jkrD|jjd|j�d|jkr`|jjd|j�dS)Nz
.SH USER DESCRIPTION
Zunconfined_usertypez�
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.
Zunpriv_userdomainz�
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.
Zadmindomainz�
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[rDrr)rerrrr�Qs


zManPage._user_attributecCsJd|jkrF|jjd�d|jkr4|jjd|j�n|jjd|j�dS)NZx_domainz
.SH X WINDOWS LOGIN
z3
The SELinux user %s_u is able to X Windows login.
z7
The SELinux user %s_u is not able to X Windows login.
)r}r^r[rDrr)rerrrr�ds

zManPage._xwindows_logincCsJd|jkrF|jjd�d|jkr4|jjd|j�n|jjd|j�dS)Nr�z
.SH TERMINAL LOGIN
z2
The SELinux user %s_u is able to terminal login.
z6
The SELinux user %s_u is not able to terminal login.
)r}r^r[rDrr)rerrr�_terminal_loginrs

zManPage._terminal_logincCs�ddlm}|jjd�x�dD]�}|j|j|d�}t|�dkr�|jjd|j|f�x8|D]0}x*||D]\}}|jjdd	j|��qhWqZW|j|jdd
�}t|�dkr|jjd|j�x8|D]0}x*||D]\}}|jjdd	j|��q�Wq�WqWdS)
Nr)�networkz
.SH NETWORK
r�r�Z	name_bindzH
.TP
The SELinux user %s_u is able to listen on the following %s ports.
z
.B %s
r�Zname_connectzJ
.TP
The SELinux user %s_u is able to connect to the following tcp ports.
)r�r�)	rr�r^r[Zget_network_connectr�rIrrrH)rer�ZnetZportdictr�r�r�rrrr��s(


zManPage._networkcsXtt�fdd�tj���}�jjd�|dk	rB�jjd�j�n�jjd�j�dS)NcsH|d�jkoF|ddkoF|ddkoFtdddd	d
dg�jt|d��S)
Nr�r�Zuser_home_typer�r�Zioctl�read�getattrZexecuteZexecute_no_transrZr�)r�r�r�)r�)rerrr��sz$ManPage._home_exec.<locals>.<lambda>z
.SH HOME_EXEC
z;
The SELinux user %s_u is able execute home content files.
z?
The SELinux user %s_u is not able execute home content files.
)r�r�rr�r^r[rr)rer�r)rerr��szManPage._home_execcCs|jjd|j|jd��dS)Na�
.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

)rr�)r^r[rrr�)rerrrr��szManPage._transitionscCs�|jjdd|ji�|jjd|j|jd��g}x,|jD]"}|jd|j|kr<|j|�q<Wt|�dkr�d}t|�dkr�d	}|jjd
dj|�||jf�dS)Nzd.TH  "%(user)s_selinux"  "8"  "%(user)s" "mgrepl@redhat.com" "%(user)s SELinux Policy documentation"ra[
.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 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�rryrr%rMr�z�

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

.B search --role_allow

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

z, )r^r[rrr�r�r)rIrH)reZtrolesrRr�rrrr��s)	zManPage._role_header)rwrLFF)(rsrtrurvrr�rfr�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�r�r�r�r�r�rrrrrxsJ
; 	+p"*	#
0-))rrr	r
)rrr
r)r)!�__all__rQr�rrkr�r�r�r�rrr&r'r/r2r5r8rr>r?r@rArBrCr1rFrKrrrTr_rrrrrr�<module>sH 


.

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 30.88 KB 0644
__init__.cpython-36.pyc File 30.88 KB 0644
booleans.cpython-36.opt-1.pyc File 962 B 0644
booleans.cpython-36.pyc File 962 B 0644
communicate.cpython-36.opt-1.pyc File 1.17 KB 0644
communicate.cpython-36.pyc File 1.17 KB 0644
generate.cpython-36.opt-1.pyc File 42.62 KB 0644
generate.cpython-36.pyc File 42.62 KB 0644
gui.cpython-36.opt-1.pyc File 82.08 KB 0644
gui.cpython-36.pyc File 82.08 KB 0644
interface.cpython-36.opt-1.pyc File 5.77 KB 0644
interface.cpython-36.pyc File 5.77 KB 0644
manpage.cpython-36.opt-1.pyc File 34.85 KB 0644
manpage.cpython-36.pyc File 34.85 KB 0644
network.cpython-36.opt-1.pyc File 1.6 KB 0644
network.cpython-36.pyc File 1.6 KB 0644
sedbus.cpython-36.opt-1.pyc File 2.29 KB 0644
sedbus.cpython-36.pyc File 2.29 KB 0644
transition.cpython-36.opt-1.pyc File 2.9 KB 0644
transition.cpython-36.pyc File 2.9 KB 0644