New version of salt-formula from Saltstack
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

46 lines
1.2KB

  1. {%- from "salt/map.jinja" import minion with context %}
  2. {%- if minion.enabled %}
  3. {%- for cert_name,cert in minion.get('cert', {}).iteritems() %}
  4. {%- set rowloop = loop %}
  5. /etc/ssl/private/{{ cert.common_name }}.key:
  6. x509.private_key_managed:
  7. - bits: 4096
  8. {{ cert.common_name }}_rights:
  9. file.managed:
  10. - name: /etc/ssl/private/{{ cert.common_name }}.key
  11. - mode: 600
  12. - replace: False
  13. - require:
  14. - x509: /etc/ssl/private/{{ cert.common_name }}.key
  15. /etc/ssl/certs/{{ cert.common_name }}.crt:
  16. x509.certificate_managed:
  17. - ca_server: {{ cert.host }}
  18. - signing_policy: {{ cert.authority }}_{{ cert.signing_policy }}
  19. - public_key: /etc/ssl/private/{{ cert.common_name }}.key
  20. - CN: {{ cert.common_name }}
  21. {%- if cert.alternative_names is defined %}
  22. - subjectAltName: {{ cert.alternative_names }}
  23. {%- endif %}
  24. - days_remaining: 30
  25. - backup: True
  26. {%- for ca_path,ca_cert in salt['mine.get'](cert.host, 'x509.get_pem_entries')[cert.host].iteritems() %}
  27. {%- if '/etc/pki/ca/'+cert.authority in ca_path %}
  28. ca_cert_{{ cert.authority }}_{{ rowloop.index }}:
  29. x509.pem_managed:
  30. - name: /etc/ssl/certs/ca-{{ cert.authority }}.crt
  31. - text: {{ ca_cert|replace('\n', '') }}
  32. {%- endif %}
  33. {%- endfor %}
  34. {%- endfor %}
  35. {%- endif %}