pki management

This commit is contained in:
do
2020-04-02 16:18:18 +02:00
parent 0a74735ba9
commit 393c48b4cb
7 changed files with 120 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ common-installed:
- python-dev - python-dev
- python-pyinotify - python-pyinotify
- python-m2crypto - python-m2crypto
- python3-m2crypto
- lockfile-progs - lockfile-progs
- virt-what - virt-what
- ntp - ntp

51
base/pki/ca.sls Normal file
View File

@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
salt-minion:
service.running:
- enable: True
- listen:
- file: /etc/salt/minion.d/signing_policies.conf
/etc/salt/minion.d/signing_policies.conf:
file.managed:
- source: salt://base/pki/signing_policies.conf
/etc/pki/issued_certs:
file.directory
/etc/pki/ca.key:
x509.private_key_managed:
- bits: 4096
- backup: True
- require:
- file: /etc/pki
/etc/pki/ca.crt:
x509.certificate_managed:
- signing_private_key: /etc/pki/ca.key
- CN: tumor.chaos
- C: DE
- ST: Berlin
- L: Berlin
- basicConstraints: "critical CA:true"
- keyUsage: "critical cRLSign, keyCertSign"
- subjectKeyIdentifier: hash
- authorityKeyIdentifier: keyid,issuer:always
- days_valid: 3650
- days_remaining: 0
- backup: True
- require:
- file: /etc/pki
- x509: /etc/pki/ca.key
mine.send:
module.run:
- func: x509.get_pem_entries
- kwargs:
glob_path: /etc/pki/ca.crt
- onchanges:
- x509: /etc/pki/ca.crt

10
base/pki/cert.sls Normal file
View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
/usr/local/share/ca-certificates:
file.directory
/usr/local/share/ca-certificates/intca.crt:
x509.pem_managed:
- text: {{ salt['mine.get']('tumor.chaos', 'x509.get_pem_entries')['tumor.chaos']['/etc/pki/ca.crt']|replace('\n', '') }}

21
base/pki/host.sls Normal file
View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
/etc/pki/private.key:
x509.private_key_managed:
- bits: 4096
- backup: True
- require:
- file: /etc/pki
/etc/pki/public.crt:
x509.certificate_managed:
- ca_server: tumor.chaos
- signing_policy: host
- public_key: /etc/pki/private.key
- CN: {{ grains['fqdn'] }}
- days_remaining: 30
- backup: True
- require:
- x509: /etc/pki/private.key

10
base/pki/init.sls Normal file
View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
include:
- .cert
- .host
/etc/pki:
file.directory

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
x509_signing_policies:
host:
#- minions: 'host'
- signing_private_key: /etc/pki/ca.key
- signing_cert: /etc/pki/ca.crt
- C: DE
- ST: Berlin
- L: Berlin
- basicConstraints: "critical CA:false"
- keyUsage: "critical keyEncipherment"
- subjectKeyIdentifier: hash
- authorityKeyIdentifier: keyid,issuer:always
- days_valid: 360
- copypath: /etc/pki/issued_certs/

View File

@@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
base: base:
'*': '*':
#- base #- base
- sysctl - sysctl
- base.packages.common - base.packages.common
- base.pki
'cpuarch:aarch64': 'cpuarch:aarch64':
- match: grain - match: grain
- base.packages.arch.arm - base.packages.arch.arm
@@ -13,6 +18,10 @@ base:
- haproxy - haproxy
- prometheus - prometheus
- grafana - grafana
#- kubernetes
'tumor*':
- base.pki.ca
#'ebin*': #'ebin*':
# - ceph # - ceph
# - ceph.osd # - ceph.osd