1
0

index.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. =====================
  2. Venafi Tools for Salt
  3. =====================
  4. Introduction
  5. ~~~~~~~~~~~~
  6. First, you need to configure the ``master`` file. This is because
  7. all module functions require either a configured ``api_key`` (for Cloud) or
  8. ``a ttp_user`` with a ``tpp_password`` and a ``base_url`` (for Trust Platform).
  9. For Venafi Cloud:
  10. .. code-block:: yaml
  11. venafi:
  12. api_key: abcdef01-2345-6789-abcd-ef0123456789
  13. base_url: "https://cloud.venafi.example.com/" (optional)
  14. If you don't have a Venafi Cloud account, you can sign up for one on the `enrollment page`_.
  15. .. _enrollment page: https://www.venafi.com/platform/cloud/devops
  16. For Venafi Platform:
  17. .. code-block:: yaml
  18. venafi:
  19. base_url: "https://tpp.example.com/"
  20. tpp_user: admin
  21. tpp_password: "Str0ngPa$$w0rd"
  22. trust_bundle: "/opt/venafi/bundle.pem"
  23. *It is not common for the Venafi Platform's REST API (WebSDK) to be secured using a certificate issued by a publicly trusted CA, therefore establishing trust for that server certificate is a critical part of your configuration. Ideally this is done by obtaining the root CA certificate in the issuing chain in PEM format and copying that file to your Salt Master (e.g. /opt/venafi/bundle.pem). You then reference that file using the 'trust_bundle' parameter as shown above.*
  24. For the Venafi module to create keys and certificates it is necessary to enable external pillars. This is done by adding the following to the ``/etc/salt/master`` file:
  25. .. code-block:: yaml
  26. ext_pillar:
  27. - venafi: True
  28. Runner Functions
  29. ~~~~~~~~~~~~~~~~
  30. request
  31. -------
  32. This command is used to enroll a certificate from Venafi Cloud or Venafi Platform.
  33. ``minion_id``
  34. ID of the minion for which the certificate is being issued. Required.
  35. ``dns_name``
  36. DNS subject name for the certificate. Required if ``csr_path`` is not specified.
  37. ``csr_path``
  38. Full path name of certificate signing request file to enroll. Required if ``dns_name`` is not specified.
  39. ``zone``
  40. Venafi Cloud zone ID or Venafi Platform folder that specify key and certificate policy. Defaults to "Default". For Venafi Cloud, the Zone ID can be found in the Zone page for your Venafi Cloud project.
  41. ``org_unit``
  42. Business Unit, Department, etc. Do not specify if it does not apply.
  43. ``org``
  44. Exact legal name of your organization. Do not abbreviate.
  45. ``loc``
  46. City/locality where your organization is legally located.
  47. ``state``
  48. State or province where your organization is legally located. Must not be abbreviated.
  49. ``country``
  50. Country where your organization is legally located; two-letter ISO code.
  51. ``key_password``
  52. Password for encrypting the private key.
  53. The syntax for requesting a new certificate with private key generation looks like this:
  54. .. code-block:: bash
  55. salt-run venafi.request minion.example.com dns_name=www.example.com \
  56. country=US state=California loc=Sacramento org="Company Name" org_unit=DevOps \
  57. zone=Internet key_password=SecretSauce
  58. And the syntax for requesting a new certificate using a previously generated CSR looks like this:
  59. .. code-block:: bash
  60. salt-run venafi.request minion.example.com csr_path=/tmp/minion.req zone=Internet
  61. show_cert
  62. ---------
  63. This command is used to show last issued certificate for domain.
  64. ``dns_name``
  65. DNS subject name of the certificate to look up.
  66. .. code-block:: bash
  67. salt-run venafi.show_cert www.example.com
  68. list_domain_cache
  69. -----------------
  70. This command lists domains that have been cached on this Salt Master.
  71. .. code-block:: bash
  72. salt-run venafi.list_domain_cache
  73. del_cached_domain
  74. -----------------
  75. This command deletes a domain from the Salt Master's cache.
  76. ``domains``
  77. A domain name, or a comma-separated list of domain names, to delete from this master's cache.
  78. .. code-block:: bash
  79. salt-run venafi.del_cached_domain www.example.com
  80. Transfer certificate to a minion
  81. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  82. To transfer a cached certificate to a minion, you can use Venafi pillar.
  83. Example state (SLS) file:
  84. .. code-block:: yaml
  85. /etc/ssl/cert/www.example.com.crt:
  86. file.managed:
  87. - contents_pillar: venafi:www.example.com:cert
  88. - replace: True
  89. /etc/ssl/cert/www.example.com.key:
  90. file.managed:
  91. - contents_pillar: venafi:www.example.com:pkey
  92. - replace: True
  93. /etc/ssl/cert/www.example.com-chain.pem:
  94. file.managed:
  95. - contents_pillar: venafi:www.example.com:chain
  96. - replace: True