mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Adds a library that uses jinja2 to format a script that, when run, will build a CSR. Also adds a CLI command, 'cert-get-requestdata', that uses this library and builds the script for a given principal. The rules are read from json files in /usr/share/ipa/csr, but the rule provider is a separate class so that it can be replaced easily. https://fedorahosted.org/freeipa/ticket/4899 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
30 lines
890 B
Cheetah
30 lines
890 B
Cheetah
{# List containing rendered sections to be included at end #}
|
|
{% set openssl_sections = [] %}
|
|
|
|
{#
|
|
List containing one entry for each section name allocated. Because of
|
|
scoping rules, we need to use a list so that it can be a "per-render global"
|
|
that gets updated in place. Real globals are shared by all templates with the
|
|
same environment, and variables defined in the macro don't persist after the
|
|
macro invocation ends.
|
|
#}
|
|
{% set openssl_section_num = [] %}
|
|
|
|
{% macro section() -%}
|
|
{% set name -%}
|
|
sec{{ openssl_section_num|length -}}
|
|
{% endset -%}
|
|
{% do openssl_section_num.append('') -%}
|
|
{% set contents %}{{ caller() }}{% endset -%}
|
|
{% if contents -%}
|
|
{% set sectiondata = formatsection(name, contents) -%}
|
|
{% do openssl_sections.append(sectiondata) -%}
|
|
{% endif -%}
|
|
{{ name -}}
|
|
{% endmacro %}
|
|
|
|
{% macro formatsection(name, contents) -%}
|
|
[ {{ name }} ]
|
|
{{ contents -}}
|
|
{% endmacro %}
|