%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pyo

�
���^c@@s/dZddlmZmZmZddlZyddlZeZWn;e	k
r�e
ZyddlZWq�e	k
r}q�XnXddlZ
ddlmZyddlZ
eZWne	k
r�e
ZnXdZd�Zd�Zd�Zd	�Zd
�Zddd�Zd
�Zd�Zd�ZdS(u4
Manage the password database on Solaris systems

.. important::
    If you feel that Salt should be using this module to manage passwords on a
    minion, and it is using a different module (or gives an error similar to
    *'shadow.info' is not available*), see :ref:`here
    <module-provider-override>`.
i(tabsolute_importtunicode_literalstprint_functionN(tCommandExecutionErrorushadowcC@s&tjdd�dkrtStdfS(u)
    Only work on POSIX-like systems
    ukerneluuSunOSuVThe solaris_shadow execution module failed to load: only available on Solaris systems.(t
__grains__tgett__virtualname__tFalse(((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pyt__virtual__(scC@sdS(u�
    Returns the default hash used for unset passwords

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.default_hash
    u!((((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytdefault_hash1s
c		C@s�tr�yitj|�}i|jd6|jd6|jd6|jd6|jd6|jd6|j	d6|j
d6}WnOtk
r�id	d6d	d6d	d6d	d6d	d6d	d6d	d6d	d6}nX|Sid	d6d	d6d	d6d	d6d	d6d	d6d	d6d	d6}y'tj
|�}|ji|d6�Wntk
r>|SXd
}tjj|�s[|Stjjj|d��X}xN|D]F}|j�jd�}|d
|kr}|ji|dd6�q}q}WWdQXtddj|�dt�}|dd
kr|S|dj�}t|�dkr&|S|ji|jd6|dd6t|d�d6t|d�d6t|d�d6d	d6d	d6�|S(u�
    Return information for the specified user

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.info root
    unameupasswdulstchguminumaxuwarnuinactuexpireuu/etc/shadowurbu:iiNucmd.run_allu
passwd -s {0}tpython_shelluretcodeustdoutiiii(tHAS_SPWDtspwdtgetspnamtsp_namtsp_pwdt	sp_lstchgtsp_mintsp_maxtsp_warntsp_inactt	sp_expiretKeyErrortpwdtgetpwnamtupdatetostpathtisfiletsalttutilstfilestfopentstriptsplitt__salt__tformatRtlentpw_nametint(	tnametdatatretts_filetifiletlinetcompstoutputtfields((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytinfo>sz









	

%	
cC@sxt|�}||dkr tSdj||�}td|dt�t|�}|d|dkrt|d|kSdS(u�
    Set the maximum number of days during which a password is valid. See man
    passwd.

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.set_maxdays username 90
    umaxupasswd -x {0} {1}ucmd.runR
N(R1tTrueR$R#R(R(tmaxdaystpre_infotcmdt	post_info((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytset_maxdays�scC@sxt|�}||dkr tSdj||�}td|dt�t|�}|d|dkrt|d|kStS(u�
    Set the minimum number of days between password changes. See man passwd.

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.set_mindays username 7
    uminupasswd -n {0} {1}ucmd.runR
(R1R2R$R#R(R(tmindaysR4R5R6((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytset_mindays�s
usha512cC@s.tstd��ntjjj|||�S(uX
    .. versionadded:: 2015.8.8

    Generate hashed password

    .. note::

        When called this function is called directly via remote-execution,
        the password argument may be displayed in the system's process list.
        This may be a security risk on certain systems.

    password
        Plaintext password to be hashed.

    crypt_salt
        Crpytographic salt. If not given, a random 8-character salt will be
        generated.

    algorithm
        The following hash algorithms are supported:

        * md5
        * blowfish (not in mainline glibc, only available in distros that add it)
        * sha256
        * sha512 (default)

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.gen_password 'I_am_password'
        salt '*' shadow.gen_password 'I_am_password' crypt_salt='I_am_salt' algorithm=sha256
    ujgen_password is not available on this operating system because the "crypt" python module is not available.(t	HAS_CRYPTRRRtpycryptotgen_hash(tpasswordt
crypt_saltt	algorithm((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytgen_password�s"cC@s>dj|�}td|dtdd�t|�}|dS(u�
    .. versionadded:: 2015.8.8

    Delete the password from name user

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.del_password username
    u
passwd -d {0}ucmd.runR
toutput_logleveluquietupasswd(R$R#RR1(R(R5tuinfo((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytdel_password�sc	C@s1d}i}tjj|�s"|Sg}tjjj|d��}xu|D]m}|j�jd�}|d|kr�|j	|�qJn||d<dj
|�}|j	dj|��qJWWdQXtjjj|d��<}g|D]}	tjjj
|	�^q�}|j|�WdQXt|�}
|
d	|kS(
u5
    Set the password for a named user. The password must be a properly defined
    hash, the password hash can be generated with this command:
    ``openssl passwd -1 <plaintext password>``

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.set_password root $1$UYCIxa628.9qXjpQCjM4a..
    u/etc/shadowurbu:iiu{0}
Nuw+upasswd(RRRRRRR R!R"tappendtjoinR$tstringutilstto_strt
writelinesR1(R(R=R+R*tlinesR,R-R.tofilet_lRB((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytset_password
s&


 (cC@sxt|�}||dkr tSdj||�}td|dt�t|�}|d|dkrt|d|kStS(u�
    Set the number of days of warning before a password change is required.
    See man passwd.

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.set_warndays username 7
    uwarnupasswd -w {0} {1}ucmd.runR
(R1R2R$R#R(R(twarndaysR4R5R6((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pytset_warndays+s(t__doc__t
__future__RRRRRR2RtImportErrorRRtsalt.utils.filesRtsalt.exceptionsRtsalt.utils.pycryptoR:RRR	R1R7R9tNoneR@RCRLRN(((s?/usr/lib/python2.7/site-packages/salt/modules/solaris_shadow.pyt<module>
s8





			
	f		*		!

Zerion Mini Shell 1.0