pogosoftware.self_signed_cert

Certyfikat samopodpisany

Ta rola ansible umożliwia generowanie certyfikatów samopodpisanych. W wyniku tego procesu zostaną wygenerowane 3 certyfikaty w formacie pem z kluczami: ca, kliencki i serwerowy. Dodatkowo, zostaną również wygenerowane 2 certyfikaty w formacie pfx dla klienta i serwera.

Ogólne zmienne

Katalog certyfikatów

self_signed_cert_dir: /etc/certs/

To jest katalog, w którym będą przechowywane certyfikaty.

URL do pobrania cfssl i cfssl_json

self_signed_cert_cfssl_url: https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
self_signed_cert_cfssl_json_url: https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64

Możesz określić, którą wersję cfssl i cfssl_tool chcesz pobrać.

Profile

self_signed_cert_profiles:
  - name: server
    expirity: 8760h
    usages:
      - signing
      - key encipherment
      - server auth
      - client auth

cfssl obsługuje wiele profili. Każdy profil ma swoją unikalną nazwę. Data ważności określa, kiedy certyfikat wygenerowany przy użyciu tego profilu wygaśnie. Użytkowania określają cel certyfikatu. Dozwolone wartości to:

  • Użytkowanie kluczy: signing, digital signature, content commitment, key encipherment, key agreement, data encipherment, cert sign, crl sign, encipher only, decipher only,
  • Rozszerzone użytkowanie kluczy: any, server auth, client auth, code signing, email protection, s/mime, ipsec end system, ipsec tunnel, ipsec user, timestamping, ocsp signing, microsoft sgc, netscape sgc

Urząd certyfikacji

self_signed_cert_ca_certs:
  - name: example-ca
    cn: example.com
    key_algo: rsa
    key_size: 2048
    country: EU
    location: Internet
    organisation: Example
    organisation_unit: IT
    state: internet
    trust_ca_cert: false

Algorytm klucza key_algo w urzędzie certyfikacji może mieć jedną z wartości: ECDSA256, RSA. trust_ca_cert będzie wstrzykiwać certyfikaty ca do zaufanych certyfikatów głównych.

Certyfikaty

self_signed_cert_certs:
  - name: server
    profile: server
    ca_name: example-ca
    export_to_pfx: true
    cn: example.com
    hosts:
      - example.com
      - www.example.com
    key_algo: rsa
    key_size: 2048
    country: EU
    location: Internet
    organisation: Example
    organisation_unit: IT
    state: internet

Przykładowy plik Playbook

- hosts: localhost
  become: yes
  roles:
    - self-signed-cert
  vars:
    self_signed_cert_cfssl_url: https://github.com/cloudflare/cfssl/releases/download/v1.4.1/cfssl_1.4.1_linux_amd64
    self_signed_cert_cfssl_json_url: https://github.com/cloudflare/cfssl/releases/download/v1.4.1/cfssljson_1.4.1_linux_amd64

    self_signed_cert_dir: /etc/certs/

    self_signed_cert_profiles:
      - name: server
        expirity: 8760h
        usages:
          - signing
          - key encipherment
          - server auth
          - client auth
      - name: client
        expirity: 8760h
        usages:
          - signing
          - key encipherment
          - client auth

    self_signed_cert_ca_certs:
      - name: example-ca
        cn: example.com
        key_algo: rsa
        key_size: 2048
        country: EU
        location: Internet
        organisation: Example
        organisation_unit: IT
        state: internet
        trust_ca_cert: false

    self_signed_cert_certs:
      - name: server
        profile: server
        ca_name: example-ca
        export_to_pfx: true
        cn: example.com
        hosts:
          - example.com
          - www.example.com
        key_algo: rsa
        key_size: 2048
        country: EU
        location: Internet
        organisation: Example
        organisation_unit: IT
        state: internet
      - name: client
        profile: client
        ca_name: example-ca
        export_to_pfx: true
        cn: example.com
        hosts:
          - example.com
          - www.example.com
        key_algo: rsa
        key_size: 2048
        country: EU
        location: Internet
        organisation: Example
        organisation_unit: IT
        state: internet
O projekcie

This ansible role allows generating a self-signed certificates.

Zainstaluj
ansible-galaxy install pogosoftware.self_signed_cert
Licencja
mit
Pobrania
514
Właściciel