salt.states.win_pki#

Microsoft certificate management via the Pki PowerShell module.

platform:

Windows

New in version 2016.11.0.

The context argument refers to the certificate-store location, either LocalMachine or CurrentUser. The store argument refers to one of the standard Microsoft certificate stores within that location (for example My, Root, CA, AuthRoot, TrustedPublisher, TrustedPeople, Disallowed, WebHosting, Remote Desktop). List the stores actually available on a minion with PowerShell:

PS C:\> Set-Location Cert:\LocalMachine
PS Cert:\LocalMachine> Get-ChildItem

or by calling win_pki.get_stores.

salt.states.win_pki.import_cert(name, cert_format='cer', context='LocalMachine', store='My', exportable=True, password='', saltenv='base')#

Import the certificate file into the given certificate store.

Parameters:
  • name (str) -- The path of the certificate file to import.

  • cert_format (str) -- The certificate format. Specify 'cer' for X.509, or 'pfx' for PKCS #12.

  • context (str) -- The name of the certificate store location context.

  • store (str) -- The name of the certificate store.

  • exportable (bool) -- Mark the certificate as exportable. Only applicable to pfx format.

  • password (str) -- The password of the certificate. Only applicable to pfx format.

  • saltenv (str) -- The environment the file resides in.

Example of usage with only the required arguments:

site0-cert-imported:
    win_pki.import_cert:
        - name: salt://win/webserver/certs/site0.cer

Example of usage specifying all available arguments:

site0-cert-imported:
    win_pki.import_cert:
        - name: salt://win/webserver/certs/site0.pfx
        - cert_format: pfx
        - context: LocalMachine
        - store: My
        - exportable: True
        - password: TestPassword
        - saltenv: base
salt.states.win_pki.remove_cert(name, thumbprint, context='LocalMachine', store='My')#

Remove the certificate from the given certificate store.

Parameters:
  • thumbprint (str) -- The thumbprint value of the target certificate.

  • context (str) -- The name of the certificate store location context.

  • store (str) -- The name of the certificate store.

Example of usage with only the required arguments:

site0-cert-removed:
    win_pki.remove_cert:
        - thumbprint: 9988776655443322111000AAABBBCCCDDDEEEFFF

Example of usage specifying all available arguments:

site0-cert-removed:
    win_pki.remove_cert:
        - thumbprint: 9988776655443322111000AAABBBCCCDDDEEEFFF
        - context: LocalMachine
        - store: My