New version of salt-formula from Saltstack
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

56 linhas
1.3KB

  1. {%- from "salt/map.jinja" import minion with context %}
  2. {%- if minion.enabled %}
  3. include:
  4. - salt.minion.service
  5. /etc/salt/minion.d/_pki.conf:
  6. file.managed:
  7. - source: salt://salt/files/_pki.conf
  8. - template: jinja
  9. - require:
  10. - pkg: salt_minion_packages
  11. - watch_in:
  12. - service: salt_minion_service
  13. {%- for ca_name,ca in minion.ca.iteritems() %}
  14. /etc/pki/ca/{{ ca_name }}/certs:
  15. file.directory:
  16. - makedirs: true
  17. /etc/pki/ca/{{ ca_name }}/ca.key:
  18. x509.private_key_managed:
  19. - bits: 4096
  20. - backup: True
  21. - require:
  22. - file: /etc/pki/ca/{{ ca_name }}/certs
  23. /etc/pki/ca/{{ ca_name }}/ca.crt:
  24. x509.certificate_managed:
  25. - signing_private_key: /etc/pki/ca/{{ ca_name }}/ca.key
  26. - CN: {{ ca.common_name }}
  27. - C: {{ ca.country }}
  28. - ST: {{ ca.state }}
  29. - L: {{ ca.locality }}
  30. - basicConstraints: "critical CA:true"
  31. - keyUsage: "critical cRLSign, keyCertSign"
  32. - subjectKeyIdentifier: hash
  33. - authorityKeyIdentifier: keyid,issuer:always
  34. - days_valid: {{ ca.days_valid.authority }}
  35. - days_remaining: 0
  36. - backup: True
  37. - require:
  38. - x509: /etc/pki/ca/{{ ca_name }}/ca.key
  39. mine.send:
  40. module.run:
  41. - func: x509.get_pem_entries
  42. - kwargs:
  43. glob_path: /etc/pki/ca/{{ ca_name }}/ca.crt
  44. - onchanges:
  45. - x509: /etc/pki/ca/{{ ca_name }}/ca.crt
  46. {%- endfor %}
  47. {%- endif %}