403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.222.188.103
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3.6/site-packages/authselect/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/authselect/__pycache__/authcompat.cpython-36.opt-1.pyc
3

��*e)V�@s�ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ejZdd�ZGdd�d�Z
Gd	d
�d
�ZGdd�d�ZGd
d�d�ZGdd�d�Zdd�Zedkr�e�dS)�N)�Options)�EnvironmentFile)�
ConfigSnippetcOst|dtji|��dS)N�file)�print�sys�stderr)�args�kwargs�r� /usr/lib/python3.6/authcompat.py�eprint%sr
c@s"eZdZdZddd�Zdd�ZdS)	�CommandFNTcCs2|g||_|dk	r|j�nd|_||_d|_dS)N)r	�encode�input�check�result)�self�commandr	rrrrr�__init__,szCommand.__init__cCsFttd�dj|j��|jr"dStj|j|j|jtj	tj	d�|_
dS)Nz
Executing: %s� )rr�stdoutr)r�_�joinr	�TEST�
subprocess�runrr�PIPEr)rrrrr2szCommand.run)NT)�__name__�
__module__�__qualname__rrrrrrrr)s
rc@s>eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�ZdS)�ServicecCs|d|_dS)Nz.service)�name)rr"rrrr?szService.__init__cCs�y|j�Wn|tjk
r�}z^|rB|j|krBttd�|j�n6|j|krxttd�dj|j�|jf�t|j	j
��WYdd}~XnXdS)Nz5Service %s was not found. Please install the service.z$Command [%s] failed with %d, stderr:r)rr�CalledProcessError�
returncoder
rr"r�cmdr�decode)rr�requiredZenoent_coderrrr�
runsystemdBs
zService.runsystemdcCs(ttjd�d|jg�}|j|dd�dS)Nz
cmd-systemctl�enableT�)r�Path�Systemr"r()rr%rrrr)NszService.enablecCs(ttjd�d|jg�}|j|dd�dS)Nz
cmd-systemctl�disableFr*)rr+r,r"r()rr%rrrr-RszService.disableTcCs4|r|j�ttjd�d|jg�}|j|dd�dS)Nz
cmd-systemctl�startT�)�stoprr+r,r"r()r�Restartr%rrrr.Vsz
Service.startcCs(ttjd�d|jg�}|j|dd�dS)Nz
cmd-systemctlr0Fr/)rr+r,r"r()rr%rrrr0\szService.stopN)T)	rrr rr(r)r-r.r0rrrrr!>s
r!c
@sbeZdZejjejje��Ze	ed�Z
dddddddd	d
ddd
d�Zedd��Z
edd��ZdS)r+z/authcompat_pathsz/etc/openldap/ldap.confz$/etc/krb5.conf.d/authconfig-krb.confz%/etc/sssd/conf.d/authconfig-sssd.confz/etc/sysconfig/authconfigz/etc/sysconfig/networkz;/etc/security/pwquality.conf.d/10-authconfig-pwquality.confz/etc/yp.confz/usr/bin/systemctlz/usr/bin/authselectz/usr/sbin/realmz/usr/bin/domainnamez/usr/sbin/setsebool)z	ldap.confz	krb5.confz	sssd.conf�
authconfig�networkzpwquality.confzyp.confz
cmd-systemctlzcmd-authselectz	cmd-realmzcmd-domainnamez
cmd-setseboolcCsdtj|fS)Nz%s/%s)r+�LocalDir)�relpathrrr�Localtsz
Path.LocalcCs
tj|S)N)r+�Files)r"rrrr,xszPath.SystemN)rrr �os�path�dirname�realpath�__file__r4rZConfigr7�staticmethodr6r,rrrrr+as r+c@s�eZdZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�Z	Gd
d�de�Z
Gdd�de�ZGdd�de�ZdS)�
Configurationc@sxeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�Zdd�ZdS)zConfiguration.BaseNcCs"||_d|_|dk	rt|�|_dS)N)�options�servicer!)rr?�ServiceNamerrrrszConfiguration.Base.__init__cCsdS)NTr)rrrr�	isEnabled�szConfiguration.Base.isEnabledcCs
|j�S)N)rB)rrrr�
isDisabled�szConfiguration.Base.isDisabledcCs*|jdkrdS|jj�|s&|jj�dS)N)r@r)r.)r�nostartrrr�
enableService�s


z Configuration.Base.enableServicecCs*|jdkrdS|jj�|s&|jj�dS)N)r@r-r0)r�nostoprrr�disableService�s


z!Configuration.Base.disableServicecCsdS)Nr)rrrr�cleanup�szConfiguration.Base.cleanupcCsdS)Nr)rrrr�write�szConfiguration.Base.writecCs|jj|�S)N)r?�get)rr"rrrrJ�szConfiguration.Base.getcCs|jj|�S)N)r?�isset)rr"rrrrK�szConfiguration.Base.issetcCs|jj|�S)N)r?�
getTrueOrNone)rr"rrrrL�sz Configuration.Base.getTrueOrNonecCs|jj|�S)N)r?�getBool)rr"rrrrM�szConfiguration.Base.getBoolFcCs*|r|j|�rdS|j|�}|r&|S|S)N)rKrM)rr"Zif_trueZif_false�	AllowNone�valuerrr�getBoolAsValue�s
z!Configuration.Base.getBoolAsValuecCsHttd�|�|jjd�r dSytj|�Wntk
rBdSXdS)NzRemoving file: %sz	test-call)rrr?rMr8�remove�FileNotFoundError)r�filenamerrr�
removeFile�szConfiguration.Base.removeFile)N)F)rrr rrBrCrErGrHrIrJrKrLrMrPrTrrrr�Base~s
		

rUcs$eZdZ�fdd�Zdd�Z�ZS)zConfiguration.LDAPcsttj|�j|�dS)N)�superr>�LDAPr)rr?)�	__class__rrr�szConfiguration.LDAP.__init__cCsZttjd�dddd�}|jd�r2|jd|jd��|jd�rN|jd	|jd��|j�dS)
Nz	ldap.confrz\s\tF)Zdelimiter_reZquotes�
ldapserverZURI�
ldapbasednZBASE)rr+r,rK�setrJrI)r�configrrrrI�s


zConfiguration.LDAP.write)rrr rrI�
__classcell__rr)rXrrW�srWcs4eZdZ�fdd�Zdd�Zdd�Zdd�Z�ZS)	zConfiguration.Kerberoscsttj|�j|�dS)N)rVr>�Kerberosr)rr?)rXrrr�szConfiguration.Kerberos.__init__cCs4|jd�r|jd�rdS|jd�dkp2|jd�S)N�	krb5realm�krb5realmdns�)rKrJrM)rrrrrB�sz Configuration.Kerberos.isEnabledcCs0|jd�r|jd�rdS|jtjd��dS)Nr_r`z	krb5.conf)rKrTr+r,)rrrrrH�szConfiguration.Kerberos.cleanupcCs�|j�rdStjd�}t|tjd��}|jd�}|jd�|jd�|jd�|rV|jd�nd|rf|jd�nd|rt|j�ndd�}|j|�dS)	Nzsnippets/authconfig-krb.confz	krb5.confr_Z
krb5kdcdnsr`�krb5kdc�krb5adminserver)�realmzkdc-srvz	realm-srvZkdcZadminserverZdomain)rCr+r6rr,rJ�lowerrI)rr9r\rd�keysrrrrI�s

zConfiguration.Kerberos.write)rrr rrBrHrIr]rr)rXrr^�sr^cs$eZdZ�fdd�Zdd�Z�ZS)zConfiguration.Networkcsttj|�j|�dS)N)rVr>�Networkr)rr?)rXrrr�szConfiguration.Network.__init__cCs<|jd�}ttjd��}|dkr$dS|jd|�|j�dS)N�	nisdomainr3Z	NISDOMAIN)rJrr+r,r[rI)rrhr\rrrrI�s
zConfiguration.Network.write)rrr rrIr]rr)rXrrg�srgcs4eZdZ�fdd�Zdd�Zdd�Zdd�Z�ZS)	zConfiguration.SSSDcsttj|�j|dd�dS)N�sssd)rA)rVr>�SSSDr)rr?)rXrrrszConfiguration.SSSD.__init__cCs0|jd�r|jd�rdS|jd�p.|jd�S)N�ldapri)rKrM)rrrrrBszConfiguration.SSSD.isEnabledcCs|jtjd��dS)Nz	sssd.conf)rTr+r,)rrrrrHszConfiguration.SSSD.cleanupcCs�|jd�sdStjd�}t|tjd��}|jd�r6dnd}|jd�|jd�|jd�||jd�|jd	�|jd
�|jd�|jd�|jd
�d�
}|j|�tj	tjd�dd�dS)Nrkzsnippets/authconfig-sssd.confz	sssd.confZ
rfc2307bisrYrZZldaptls�krb5rbrcr_Z
cachecreds�	smartcard)
zldap-urizldap-basednzldap-tlszldap-schemarlzkdc-urizkpasswd-urirdzcache-credsz	cert-authi�)�mode)
rMr+r6rr,rJrLrIr8�chmod)rr9r\ZschemarfrrrrIs"


zConfiguration.SSSD.write)rrr rrBrHrIr]rr)rXrrjsrjcs,eZdZ�fdd�Zdd�Zdd�Z�ZS)zConfiguration.Winbindcsttj|�j|dd�dS)N�winbind)rA)rVr>�Winbindr)rr?)rXrrr.szConfiguration.Winbind.__init__cCs0|jd�r|jd�rdS|jd�p.|jd�S)Nrp�winbindauth)rKrM)rrrrrB1szConfiguration.Winbind.isEnabledcCs�|jd�sdS|jjd�jdd�}|d}d}t|�dkrF|dd}ddd|d	d
g}|jd�rr|j|jd��ttjd�||d
�}y|j	�Wn*t
k
r�ttd�tjd��YnXdS)NZwinbindjoin�%r*r�
rz-Uz"%s"z--client-softwarerpZsmbworkgroupz	cmd-realm)rz)%s was not found. Please, install realmd.)
rKr?rJ�split�len�appendrr+r,rrRr
r)rZcreds�userZpasswordr	r%rrrrI7s$

zConfiguration.Winbind.write)rrr rrBrIr]rr)rXrrq-srqcs$eZdZ�fdd�Zdd�Z�ZS)zConfiguration.PWQualitycsttj|�j|�dS)N)rVr>�	PWQualityr)rr?)rXrrrSsz Configuration.PWQuality.__init__c
Cs�ttjd��}d}|jd�|jd�|jd�|jd�|jddd	d
d�|jddd	d
d�|jd
dd	d
d�|jddd	d
d�d�}x@|j�D]4\}}|dk	r�t|dt|��|j||�d
}q�W|r�|j	�dS)Nzpwquality.confFZ
passminlenZpassminclassZ
passmaxrepeatZpassmaxclassrepeatZreqlowerr*rT)rNZrequpperZreqdigitZreqother)ZminlenZminclassZ	maxrepeatZmaxclassrepeatZlcreditZucreditZdcreditZocredit�=���r{r{r{)
rr+r,rJrP�itemsr�strr[rI)rr\Z	value_setZpwopts�optrOrrrrIVs"zConfiguration.PWQuality.write)rrr rrIr]rr)rXrryRsrycs,eZdZ�fdd�Zdd�Zdd�Z�ZS)zConfiguration.MakeHomedircsttj|�j|dd�dS)NZoddjobd)rA)rVr>�MakeHomedirr)rr?)rXrrrpsz"Configuration.MakeHomedir.__init__cCs|jd�sdS|jd�S)N�	mkhomedir)rKrM)rrrrrBss
z#Configuration.MakeHomedir.isEnabledcCsdS)Nr)rrFrrrrGysz(Configuration.MakeHomedir.disableService)rrr rrBrGr]rr)rXrrosrcs<eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Z�ZS)zConfiguration.NIScs*ttj|�j|�td�|_td�|_dS)N�rpcbind�ypbind)rVr>�NISrr!r�r�)rr?)rXrrrs
zConfiguration.NIS.__init__cCs|jd�sdS|jd�S)N�nis)rKrM)rrrrrB�s
zConfiguration.NIS.isEnabledcCs�|jd�sdS|jd�}|s6ttjd�|g�}|j�ttjd�dddg�}|j�|jj�|jj�|s�|jj	dd�|jj	�dS)	Nrhzcmd-domainnamez
cmd-setseboolz-P�allow_ypbind�1F)r1)
rKrJrr+r,rr�r)r�r.)rrDZnisdomr%rrrrE�s




zConfiguration.NIS.enableServicecCsl|sttjd�dg�}|j�ttjd�dddg�}|j�|jj�|jj�|sh|jj�|jj�dS)Nzcmd-domainnamez(none)z
cmd-setseboolz-Pr��0)rr+r,rr�r-r�r0)rrFr%rrrrG�s



z Configuration.NIS.disableServicec	Cs�|jd�sdSd|jd�}g}|jd�r\|jd�jd�}|dd�}|d|dd7}n|d	7}x|D]}|d
|d7}qjWtjd�}|jd�r�td
|�t|�td|�dSt|d��}|j|�WdQRXdS)Nrhzdomain Z	nisserver�,r*z server rrtz broadcast
z	ypserver zyp.confz	test-callz+========== BEGIN Content of [%s] ==========z,========== END   Content of [%s] ==========
�w)	rKrJrur+r,rMr�openrI)r�outputZadditional_serversZserversZserverrS�frrrrI�s&




zConfiguration.NIS.write)	rrr rrBrErGrIr]rr)rXrr�~s
r�N)
rrr �objectrUrWr^rgrjrqryrr�rrrrr>}sE$)%r>c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�
AuthCompatcCsBttjd��|_t�|_|jj�|jj|j�|jj|j�dS)Nr2)	rr+r,�	sysconfigrr?�parseZapplysysconfigZupdatesysconfig)rrrrr�s

zAuthCompat.__init__cCspttd��ttd��ttd��ttd��|jj�}|rdttd��x|D]}td|�qPWtd�dS)Nz&Running authconfig compatibility tool.z�The purpose of this tool is to enable authentication against chosen services with authselect and minimum configuration. It does not provide all capabilities of authconfig.
zLIMPORTANT: authconfig is replaced by authselect, please update your scripts.zHSee man authselect-migration(7) to help you with migration to authselectzDWarning: These options are not supported anymore and have no effect:z  --%sra)rrr?ZgetSetButUnsupported)rr?r"rrr�printWarning�s

zAuthCompat.printWarningcCs(x"tjD]}td|j|jf�qWdS)Nz%s=%s)rZListrr"rO)r�optionrrr�printOptions�szAuthCompat.printOptionscCs,x&|jj�D]}td|j|jf�qWdS)Nz%s=%s)r�Zgetallrr"rO)r�linerrr�printSysconfig�szAuthCompat.printSysconfigcCs�ddddg}dddg}|jjd�r@tj�dkr@ttd	��d
Sx,|D]$}|jj|�rFttd|��d
SqFW|jjd�|jjd
�kr�ttd��d
Sx|D]}|jj|�r�dSq�Wttd��d
S)NZtestZprobeZ
restorebackupZrestorelastbackup�updateZ	updateallZ	kickstartrz"authconfig can only be run as rootFzNError: option --%s is no longer supported and we cannot continue if it is set.rprrz@Error: Both --enablewinbind and --enablewinbindauth must be set.Tz*Error: Please, provide --updateall option.)r?rMr8�getuidrr)rZ
disallowedr'r�rrr�canContinue�s$



zAuthCompat.canContinuec	CsZdddddddd�}|j�\}}|jjd	�sP|jjd
�sP|jjd�sP|jjd�rVd}n"|jjd
�rhd
}n|jjd�rxd}|dkr�d}xV|j�D]J\}}|jj|�s�q�|jj|�}|r�|j|�q�x||kr�|j|�q�Wq�W|jjd��rt|jjd��dk�r|jd�n
|jd�t	t
|��}d|g}|j|�|jd�tt
jd�|�}|j�dS)Nzwith-smartcardzwith-smartcard-requiredzwith-fingerprintzwith-mkhomedirz
with-faillockzwith-pamaccessz	with-krb5)rmZrequiresmartcardZfingerprintr�ZfaillockZ	pamaccessZwinbindkrb5rkZldapauthriZsssdauthr�rpZsmartcardactionrzwith-smartcard-lock-on-removalZselectz--forcezcmd-authselect)�getCurrentAuthselectConfigr?rMr|rKrwrQ�intrJ�listr[�extendrr+r,r)	r�mapZprofileZfeaturesr�Zfeature�enabledr	r%rrr�
runAuthselect
sJ



zAuthCompat.runAuthselectcCs~ttjd�dgdd�}|j�|jdks4|jjdkr<dgfSttjd�ddg�}|j�|jjjd�j�}|d|d	d�fS)
Nzcmd-authselectrF)rr�currentz--rawzutf-8r*)	rr+r,rrr$rr&ru)rr%r�rrrr�Hsz%AuthCompat.getCurrentAuthselectConfigcCstj|j�tj|j�tj|j�tj|j�tj|j�tj|j�tj|j�tj	|j�g}x�|D]�}|j
�|jjd�}y8|j�}|dkr�wZ|r�|j
|�n|j|�|j�WqZtjk
r�}z2ttd�dj|j�|jf�t|jj��WYdd}~XqZXqZWdS)NrDz$Command [%s] failed with %d, stderr:r)r>rWr?rgr^rjrqryrr�rIrMrBrErGrHrr#r
rrr%r$rr&)rZconfigsr\rDr�rrrr�writeConfigurationUs.








zAuthCompat.writeConfigurationN)rrr rr�r�r�r�r�r�r�rrrrr��s>
r�cCs�ytjtjd�Wn"tjk
r4tjjd�YnXt�}|j�|j	j
d�t_|j	j
d�t
_|j	j
d�t_|j�s�tjd�y|j�|j�|jj�WnPtjk
r�}z2ttd�dj|j�|jf�t|jj��WYdd}~XnXtjd�dS)Nraz%Warning: Unsupported locale setting.
z	test-callr*z$Command [%s] failed with %d, stderr:rr)�locale�	setlocale�LC_ALL�ErrorrrrIr�r�r?rMrrrrr��exitr�r�r�rr#r
rrr%r$r&)Z
authcompatrrrr�mainzs(
 r��__main__)r8rr��gettextrZauthcompat_OptionsrZauthcompat_EnvironmentFilerZauthcompat_ConfigSnippetrrr
rr!r+r>r�r�rrrrr�<module>s(#P0

Youez - 2016 - github.com/yon3zu
LinuXploit