Commit 5e23270a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

stack/caucase: make crt_path optional.

so that we can create caucase-updater for fetching CA / CRL only purpose.
parent bba044e5
...@@ -72,7 +72,7 @@ Client ...@@ -72,7 +72,7 @@ Client
This script allows you to re-issue a CSR using a locally-generated private key. This script allows you to re-issue a CSR using a locally-generated private key.
.. topic:: ``updater(prefix, buildout_bin_directory, updater_path, url, data_dir, crt_path, ca_path, crl_path, key_path=None, on_renew=None, max_sleep=None, mode='service', template_csr_pem=None, openssl=None)`` .. topic:: ``updater(prefix, buildout_bin_directory, updater_path, url, data_dir, ca_path, crl_path, crt_path=None, key_path=None, on_renew=None, max_sleep=None, mode='service', template_csr_pem=None, openssl=None)``
- ``<prefix>``: Creates ``<updater>`` executable file to start ``caucase-updater``, and ``<data_dir>`` directory for its data storage needs. - ``<prefix>``: Creates ``<updater>`` executable file to start ``caucase-updater``, and ``<data_dir>`` directory for its data storage needs.
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[caucase-jinja2-library] [caucase-jinja2-library]
filename = caucase.jinja2.library filename = caucase.jinja2.library
md5sum = 9a7247cdb2ee1d66c074b0660c54713f md5sum = 2e7e61bb0cf41c28d6d811a0283cf03e
...@@ -43,9 +43,9 @@ config-command = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc ...@@ -43,9 +43,9 @@ config-command = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc
updater_path, updater_path,
url, url,
data_dir, data_dir,
crt_path,
ca_path, ca_path,
crl_path, crl_path,
crt_path=None,
key_path=None, key_path=None,
on_renew=None, on_renew=None,
max_sleep=None, max_sleep=None,
...@@ -59,24 +59,25 @@ config-command = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc ...@@ -59,24 +59,25 @@ config-command = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
data-dir = {{ data_dir }} data-dir = {{ data_dir }}
{% if template_csr_pem or template_csr -%} {% if crt_path %}
{% if template_csr_pem or template_csr -%}
[{{ prefix }}-provided-csr-content] [{{ prefix }}-provided-csr-content]
{% if template_csr_pem %} {% if template_csr_pem %}
content = {{ dumps(template_csr_pem) }} content = {{ dumps(template_csr_pem) }}
{% elif template_csr %} {% elif template_csr %}
content = {{ template_csr }} content = {{ template_csr }}
{% endif %} {% endif %}
[{{ prefix }}-provided-csr] [{{ prefix }}-provided-csr]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
mode = 644 mode = 644
{% if template_csr_pem %} {% if template_csr_pem %}
template = inline:{{ '{{ content }}' }} template = inline:{{ '{{ content }}' }}
rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem
context = key content {{ prefix }}-provided-csr-content:content context = key content {{ prefix }}-provided-csr-content:content
{% elif template_csr %} {% elif template_csr %}
template = {{ '${' + prefix }}-provided-csr-content:content} template = {{ '${' + prefix }}-provided-csr-content:content}
rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem
{% endif %} {% endif %}
{{ rerequest( {{ rerequest(
prefix=prefix ~ '-csr', prefix=prefix ~ '-csr',
buildout_bin_directory=buildout_bin_directory, buildout_bin_directory=buildout_bin_directory,
...@@ -84,12 +85,13 @@ rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem ...@@ -84,12 +85,13 @@ rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem
csr='${:csr}', csr='${:csr}',
key=key_path, key=key_path,
)}} )}}
{%- else -%} {%- else -%}
[{{ prefix }}-csr] [{{ prefix }}-csr]
recipe = plone.recipe.command recipe = plone.recipe.command
command = '{{ openssl }}' req -newkey rsa:2048 -batch -new -nodes -subj /CN=example.com -keyout '{{ key_path or crt_path }}' -out '${:csr}' command = '{{ openssl }}' req -newkey rsa:2048 -batch -new -nodes -subj /CN=example.com -keyout '{{ key_path or crt_path }}' -out '${:csr}'
{%- endif %} {%- endif %}
csr = ${ {{- prefix }}-directory:data-dir}/good.csr.pem csr = ${ {{- prefix }}-directory:data-dir}/good.csr.pem
{%- endif %}
[{{ prefix }}] [{{ prefix }}]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
...@@ -98,8 +100,8 @@ command-line = '{{ buildout_bin_directory }}/caucase-updater' ...@@ -98,8 +100,8 @@ command-line = '{{ buildout_bin_directory }}/caucase-updater'
--ca-url '{{ url }}' --ca-url '{{ url }}'
--cas-ca '${ {{- prefix }}-directory:data-dir}/cas.crt.pem' --cas-ca '${ {{- prefix }}-directory:data-dir}/cas.crt.pem'
--mode '{{ mode }}' --mode '{{ mode }}'
--csr '${ {{- prefix }}-csr:csr}' {% if crt_path %}--csr '${ {{- prefix }}-csr:csr}'
--crt '{{ crt_path }}' --crt '{{ crt_path }}' {%- endif %}
--ca '{{ ca_path }}' --ca '{{ ca_path }}'
--crl '{{ crl_path }}' --crl '{{ crl_path }}'
{% if key_path %}--key '{{ key_path }}' {%- endif %} {% if key_path %}--key '{{ key_path }}' {%- endif %}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment