HEX
Server: Apache
System: Linux hp3-stn-1011028.hostingp3.local 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: csh958633 (951153)
PHP: 8.3.30
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: //lib64/python2.7/site-packages/setroubleshoot/access_control.pyc
�
�3�Zc@sKdZddlZddlZddlZddlmZdgZy
ejZWn�e	k
r3ddl
Z
ddlZe
j�dZ
ejde
�r�dZq4ejde
�r�dZq4ejd	e
�r�d
Zq4ejde
�r�dZq4ejd
e
�rdZq4ejde
�r*dZq4dZnXddd��YZdS(s�Access control for setroubleshoot. For now this is only used for
determining which users are allowed to connect to the server: see
UserServerAccess for more information.i����N(t
get_configtServerAccessis^i\d86is^x86_64s^(ppc|powerpc)is
^(alpha|mips)is^sparci@s^parisci@cBsoeZdZiied6d6ied6d6Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(sg
    Determine if a user should be given access to the server based
    on the configuration file.
    twildcardtclienttfix_cmdcCsCi|_x3ttjj��D]}|j|�|j|<qWdS(N(t
privilegestlistRtkeystinit_privilege(tselft	privilege((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pyt__init__Ds	cCs9gtdd|�jd�D]}|j�^q}|S(Ntaccesss%s_userst,(Rtsplittstrip(R	R
tnamet	cfg_names((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pyROs2cCs4|tjk}|rtStjtjd|�tS(Nsunknown access privilege (%s)(RRtTruetsyslogtLOG_ERRtFalse(R	R
tvalid((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pytvalid_privilegeTs
cCs9|j|�stStj|ds(tSd|j|kS(NRt*(RRRR(R	R
((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pytunrestricted_privilegeZs
cCsE|j|�stS|j|�r&tS||j|kr=tStSdS(s�
        Determine if the given user name is allowed access.
        Returns True if access should be given, False if not.
        N(RRRRR(R	R
tuser((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pytuser_allowedascCsn|j|�stS|j|�r&tSyddl}|j|�}Wntk
rYtSX|j||d�S(s�
        Determine if the given uid is allowed access. No error
        is returned if the uid is invalid (False is returned).
        Returns True if access should be given, False if not.
        i����Ni(RRRRtpwdtgetpwuidtKeyErrorR(R	R
tuidRt	pwd_entry((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pytuid_allowedos
c
Csd}}}y&|j}|tjkr3||fSWntk
rGnXd}tj|�}yv|jtjt	|�}tj
||�\}}}|dkr�d}n|dkr�d}n|dkr�d}nWn8tk
r
}	d}}}tjtj
d|	�nX||fS(s�Obtain the effective user and group IDs of the process on
        the other end of a socket. SO_PEERCRED is used so the information
        returned is generally trustworthy (though root processes can
        impersonate any uid/gid).tIIIi����sget_credentials(): %sN(tNonetfamilytSockettAF_UNIXtAttributeErrortstructtcalcsizet
getsockoptt
SOL_SOCKETtSO_PEERCREDtunpackt	ExceptionRR(
R	tsocktpidRtgidR$tformat_ucredtsizeof_ucredtucredte((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pytget_credentials�s,	
		
(
t__name__t
__module__t__doc__RRRRRRRRR!R6(((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pyR:s						((R9R(tsocketR%Rtsetroubleshoot.configRt__all__R,R'tostretunametmachinetsearchR(((sC/usr/lib64/python2.7/site-packages/setroubleshoot/access_control.pyt<module>s2