-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: address all implementation comments
Still need testing.
- Loading branch information
Showing
7 changed files
with
81 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,58 @@ | ||
--- | ||
- name: JWK Certificate Creation (Block) | ||
block: | ||
|
||
# CARGS="--ca-url https://hecate.sift.net --root /etc/step/certs/root_ca.crt" | ||
# HOST=testing | ||
# TOKEN=$(step-cli ca token $HOST.sift.net $CARGS) | ||
# step-cli ca certificate $HOST.sift.net $HOST.crt $HOST.key --token $TOKEN $CARGS | ||
# openssl x509 -noout -dates <$HOST.crt | ||
# step-cli ca renew $HOST.crt $HOST.key $CARGS | ||
# openssl x509 -noout -dates <$HOST.crt | ||
# step-cli ca certificate $HOST.sift.net $HOST.crt $HOST.key --token $TOKEN $CARGS | ||
- name: Create temproary file for JWK password | ||
ansible.builtin.tempfile: | ||
state: file | ||
suffix: jwk | ||
register: _jwk_password_file | ||
when: | ||
- step_cert_ca_jwk_password is defined | ||
- step_cert_ca_jwk_password | length > 0 | ||
|
||
- name: Generate JWK certificate token | ||
maxhoesel.smallstep.step_ca_token: | ||
name: '{{ step_cert_name }}' | ||
san: "{{ step_cert_san }}" | ||
provisioner: "{{ step_cert_ca_provisioner_name }}" | ||
provisioner_password_file: "{{ step_cert_ca_jwk_password_file }}" | ||
not_after: "{{ step_cert_duration | d(omit) }}" | ||
return_token: true | ||
step_cli_executable: "{{ step_cli_executable }}" | ||
register: _step_cert_token | ||
- name: deploy JWK provisioner password to temporary file | ||
copy: | ||
dest: "{{ _jwk_password_file.path }}" | ||
content: "{{ step_cert_ca_jwk_password }}" | ||
mode: 0600 | ||
no_log: true | ||
when: _jwk_password_file.path is defined | ||
|
||
# - debug: | ||
# var: _step_cert_token | ||
# changed_when: true | ||
- name: Generate JWK certificate token | ||
maxhoesel.smallstep.step_ca_token: | ||
name: '{{ step_cert_name }}' | ||
san: "{{ step_cert_san }}" | ||
provisioner: "{{ step_cert_ca_provisioner_name }}" | ||
provisioner_password_file: "{{ _jwk_password_file.path | d(step_cert_ca_jwk_password_file) | mandatory }}" | ||
not_after: "{{ step_cert_duration | d(omit) }}" | ||
return_token: true | ||
step_cli_executable: "{{ step_cli_executable }}" | ||
register: _step_cert_token | ||
|
||
- name: Get certificate from CA via JWK provisioner | ||
maxhoesel.smallstep.step_ca_certificate: | ||
provisioner: "{{ step_cert_ca_provisioner_name }}" | ||
token: "{{ _step_cert_token.token }}" | ||
name: '{{ step_cert_name }}' | ||
san: "{{ step_cert_san }}" | ||
contact: "{{ step_cert_contact }}" | ||
not_after: "{{ step_cert_duration | d(omit) }}" | ||
crt_file: "{{ step_cert_certfile_full.path }}" | ||
key_file: "{{ step_cert_keyfile_full.path }}" | ||
force: yes # stupid, but required flag to allow overwriting existing files | ||
step_cli_executable: "{{ step_cli_executable }}" | ||
become: yes | ||
environment: | ||
STEPPATH: "{{ step_cli_steppath }}" | ||
register: _step_certificate | ||
- name: Get certificate from CA via JWK provisioner | ||
maxhoesel.smallstep.step_ca_certificate: | ||
provisioner: "{{ step_cert_ca_provisioner_name }}" | ||
token: "{{ _step_cert_token.token }}" | ||
name: '{{ step_cert_name }}' | ||
san: "{{ step_cert_san }}" | ||
contact: "{{ step_cert_contact }}" | ||
not_after: "{{ step_cert_duration | d(omit) }}" | ||
crt_file: "{{ step_cert_certfile_full.path }}" | ||
key_file: "{{ step_cert_keyfile_full.path }}" | ||
force: yes # stupid, but required flag to allow overwriting existing files | ||
step_cli_executable: "{{ step_cli_executable }}" | ||
become: yes | ||
environment: | ||
STEPPATH: "{{ step_cli_steppath }}" | ||
register: _step_certificate | ||
|
||
# BLOCK Handling: cleanup temporary files | ||
always: | ||
- name: Remove temporary JWK password file | ||
ansible.builtin.file: | ||
path: "{{ _jwk_password_file.path }}" | ||
state: absent | ||
when: _jwk_password_file.path is defined | ||
|
||
# END BLOCK: JWK Certificate Creation (Block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,4 @@ | |
- include: check.yml | ||
- include: vars.yml | ||
- include: cert.yml | ||
|
||
# - meta: end_host | ||
|
||
- include: renewal.yml |