New version of salt-formula from Saltstack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 8 години
преди 8 години
преди 8 години
преди 8 години
преди 8 години
преди 8 години
преди 8 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. - {{ minion.install_state }}
  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. {%- if ca.country is defined %}
  28. - C: {{ ca.country }}
  29. {%- endif %}
  30. {%- if ca.state is defined %}
  31. - ST: {{ ca.state }}
  32. {%- endif %}
  33. {%- if ca.locality is defined %}
  34. - L: {{ ca.locality }}
  35. {%- endif %}
  36. {%- if ca.organization is defined %}
  37. - O: {{ ca.organization }}
  38. {%- endif %}
  39. {%- if ca.organization_unit is defined %}
  40. - OU: {{ ca.organization_unit }}
  41. {%- endif %}
  42. - basicConstraints: "critical,CA:TRUE"
  43. - keyUsage: "critical,cRLSign,keyCertSign"
  44. - subjectKeyIdentifier: hash
  45. - authorityKeyIdentifier: keyid,issuer:always
  46. - days_valid: {{ ca.days_valid.authority }}
  47. - days_remaining: 0
  48. - backup: True
  49. - require:
  50. - x509: /etc/pki/ca/{{ ca_name }}/ca.key
  51. salt_system_ca_mine_send_ca_{{ ca_name }}:
  52. module.run:
  53. - name: mine.send
  54. - func: x509.get_pem_entries
  55. - kwargs:
  56. glob_path: /etc/pki/ca/{{ ca_name }}/ca.crt
  57. - require:
  58. - x509: /etc/pki/ca/{{ ca_name }}/ca.crt
  59. {%- endfor %}
  60. {%- endif %}