%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/mac_keychain.pyc

�
���^c@@sOdZddlmZmZmZddlZddlZddlZyddlZe	Z
Wnek
rueZ
nXddl
Zeje�ZdZeed�r�ejZn'e
r�eed�r�ejZndZd�Zdedd�Zddd	�Zdd
�Zd�Zddd
�Zddd�Zd�Zdd�ZdS(uO
Install certificates into the keychain on Mac OS

.. versionadded:: 2016.3.0

i(tabsolute_importtunicode_literalstprint_functionNukeychainuquotecC@s&tjjj�r"tdk	r"tStS(u
    Only work on Mac OS
    N(tsalttutilstplatformt	is_darwint_quotetNonet__virtualname__tFalse(((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pyt__virtual__#su"/Library/Keychains/System.keychaincC@sR|dk	rt||�ndj|||�}|rD|d7}ntd|�S(u�
    Install a certificate

    cert
        The certificate to install

    password
        The password for the certificate being installed formatted in the way
        described for openssl command in the PASS PHRASE ARGUMENTS section.

        Note: The password given here will show up as plaintext in the job returned
        info.

    keychain
        The keychain to install the certificate to, this defaults to
        /Library/Keychains/System.keychain

    allow_any
        Allow any application to access the imported certificate without warning

    keychain_password
        If your keychain is likely to be locked pass the password and it will be unlocked
        before running the import

        Note: The password given here will show up as plaintext in the returned job
        info.

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.install test.p12 test123
    u!security import {0} -P {1} -k {2}u -Aucmd.runN(Rtunlock_keychaintformatt__salt__(tcerttpasswordtkeychaint	allow_anytkeychain_passwordtcmd((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pytinstall,s&
cC@s<|dk	rt||�ndj||�}td|�S(uB
    Uninstall a certificate from a keychain

    cert_name
        The name of the certificate to remove

    keychain
        The keychain to install the certificate to, this defaults to
        /Library/Keychains/System.keychain

    keychain_password
        If your keychain is likely to be locked pass the password and it will be unlocked
        before running the import

        Note: The password given here will show up as plaintext in the returned job
        info.

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.install test.p12 test123
    u(security delete-certificate -c "{0}" {1}ucmd.runN(RRR
R(t	cert_nameRRR((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pyt	uninstall[scC@sDdjt|��}td|dt�}|jdd�jd�S(u
    List all of the installed certificates

    keychain
        The keychain to install the certificate to, this defaults to
        /Library/Keychains/System.keychain

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.list_certs
    uXsecurity find-certificate -a {0} | grep -o "alis".*\" | grep -o '\"[-A-Za-z0-9.:() ]*\"'ucmd.runtpython_shellu"uu
(R
RRtTruetreplacetsplit(RRtout((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pyt
list_certs|scC@sJdjt|�t|��}td|dt�}|jdd�j�S(u�
    Get the friendly name of the given certificate

    cert
        The certificate to install

    password
        The password for the certificate being installed formatted in the way
        described for openssl command in the PASS PHRASE ARGUMENTS section

        Note: The password given here will show up as plaintext in the returned job
        info.

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.get_friendly_name /tmp/test.p12 test123
    u^openssl pkcs12 -in {0} -passin pass:{1} -info -nodes -nokeys 2> /dev/null | grep friendlyName:ucmd.runRufriendlyName: u(R
RRRRtstrip(RRRR((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pytget_friendly_name�suusercC@s#dj|�}td|d|�S(u!
    Get the default keychain

    user
        The user to check the default keychain of

    domain
        The domain to use valid values are user|system|common|dynamic, the default is user

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.get_default_keychain
    u security default-keychain -d {0}ucmd.runtrunas(R
R(tusertdomainR((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pytget_default_keychain�scC@s&dj||�}td|d|�S(u�
    Set the default keychain

    keychain
        The location of the keychain to set as default

    domain
        The domain to use valid values are user|system|common|dynamic, the default is user

    user
        The user to set the default keychain as

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.set_keychain /Users/fred/Library/Keychains/login.keychain
    u'security default-keychain -d {0} -s {1}ucmd.runR (R
R(RR"R!R((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pytset_default_keychain�scC@s$dj||�}td|�dS(ut
    Unlock the given keychain with the password

    keychain
        The keychain to unlock

    password
        The password to use to unlock the keychain.

        Note: The password given here will show up as plaintext in the returned job
        info.

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.unlock_keychain /tmp/test.p12 test123
    u#security unlock-keychain -p {0} {1}ucmd.runN(R
R(RRR((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pyR�scC@s~d|dkr%dj||�}ndj|�}td|�}tjd|tjtjB�}|rv|jd�StSdS(	u�
    Returns the hash of a certificate in the keychain.

    name
        The name of the certificate (which you can get from keychain.get_friendly_name) or the
        location of a p12 file.

    password
        The password that is used in the certificate. Only required if your passing a p12 file.
        Note: This will be outputted to logs

    CLI Example:

    .. code-block:: bash

        salt '*' keychain.get_hash /tmp/test.p12 test123
    u.p12i����u9openssl pkcs12 -in {0} -passin pass:{1} -passout pass:{1}u(security find-certificate -c "{0}" -m -pucmd.runu8-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----iN(R
RtretsearchtDOTALLt	MULTILINEtgroupR
(tnameRRRtmatches((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pytget_hash�s
( t__doc__t
__future__RRRtloggingR%tshlextpipesRtHAS_DEPStImportErrorR
tsalt.utils.platformRt	getLoggert__name__tlogR	thasattrtquoteRRRRRRRR#R$RR,(((s=/usr/lib/python2.7/site-packages/salt/modules/mac_keychain.pyt<module>s:


	,		

Zerion Mini Shell 1.0