Conversation
|
@NETWAYS/ansible-developer |
|
Wow, that's some huge contribution! Thank you so much. I'm sifting through the changes and trying to wrap my brain around them. Usually I prefer smaller PRs but I understand that these changes are intertwined so much that it just doesn't make sense to split them up and end up in merge conflict hell. I really love your approach to handlers. Honestly, I didn't know that this was possible and it will definitely improve not only this role but my future Ansible code as well. I'm on it but given the sheer size of the changes it will still take some time. |
tbauriedel
left a comment
There was a problem hiding this comment.
thank you for the contribution! It adds a nice feature and also fixes some issues inside of the role.
I found some small things so far. Please check these again. If I have overlooked something, please let me know. CC @DXist
@widhalmt could you also have quick look at it? Just we are on the safe side and dont loose backwards compatibility.
| force: "{{ not crt_info.valid_at.check_period | default(omit) or | ||
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" |
There was a problem hiding this comment.
| force: "{{ not crt_info.valid_at.check_period | default(omit) or | |
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" | |
| force: | |
| "{{ not crt_info.valid_at.check_period | default(omit) or | |
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" |
| force: "{{ not crt_info.valid_at.check_period | default(omit) or | ||
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" |
There was a problem hiding this comment.
| force: "{{ not crt_info.valid_at.check_period | default(omit) or | |
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" | |
| force: | |
| "{{ not crt_info.valid_at.check_period | default(omit) or | |
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" |
| force: "{{ not crt_info.valid_at.check_period | default(omit) or | ||
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" |
There was a problem hiding this comment.
| force: "{{ not crt_info.valid_at.check_period | default(omit) or | |
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" | |
| force: | |
| "{{ not crt_info.valid_at.check_period | default(omit) or | |
| hostvars[ca_ca_host]['ca_ca_renewed'] | default(omit) }}" |
| path: "{{ ansible_env.HOME }}/{{ inventory_hostname }}.initial_certificate" | ||
| register: initial_handler_file | ||
|
|
||
| - name: Fail if initial file of on certificate change handler does not exist |
There was a problem hiding this comment.
| - name: Fail if initial file of on certificate change handler does not exist | |
| - name: Fail if initial file of 'on certificate change' handler does not exist |
|
|
||
| - name: Fail if initial file of on certificate change handler does not exist | ||
| ansible.builtin.fail: | ||
| msg: "Failed because on certificate change handler hasn't created initial file" |
There was a problem hiding this comment.
| msg: "Failed because on certificate change handler hasn't created initial file" | |
| msg: "Failed because 'on certificate change' handler hasn't created initial file" |
| msg: "Failed because on certificate change handler hasn't created initial file" | ||
| when: not initial_handler_file.stat.exists | ||
|
|
||
| - name: Register if on certificate change handler has run for renewed client certificate |
There was a problem hiding this comment.
| - name: Register if on certificate change handler has run for renewed client certificate | |
| - name: Register if 'on certificate change' handler has run for renewed client certificate |
| path: "{{ ansible_env.HOME }}/{{ inventory_hostname }}.renewed_certificate" | ||
| register: renewed_handler_file | ||
|
|
||
| - name: Fail if renewed file of on certificate change handler does not exist |
There was a problem hiding this comment.
| - name: Fail if renewed file of on certificate change handler does not exist | |
| - name: Fail if renewed file of 'on certificate change' handler does not exist |
|
|
||
| - name: Fail if renewed file of on certificate change handler does not exist | ||
| ansible.builtin.fail: | ||
| msg: "Failed because on certificate change handler hasn't created renewed file" |
There was a problem hiding this comment.
| msg: "Failed because on certificate change handler hasn't created renewed file" | |
| msg: "Failed because 'on certificate change handler' hasn't created renewed file" |
|
@DXist , I guess, I owe you an apology. I can't really tell you why I wasn't able to complete the review. I had it in my mind the whole time but I was blocked from proceeding with it. So finally I asked a colleague to work on it. I hope, I haven't destroyed all your enthusiasm for contributing to this role. If so, then please blame it on me but not on the project. |
Co-authored-by: Tobias Bauriedel <tobias@bauriedel.de>
DXist
left a comment
There was a problem hiding this comment.
Rebased and removed openssl version detection.
This PR adds support for a different key algorithm for certificate signing and usage in client/server communications.
Default algorithm is RSA. I've extended molecule playbooks and included ca role configured to use Ed25519 keys.
Besides I replaced passphrase passing from command argument to stdin to make sure that passphrase is not displayed in verbose output.
Added more changes that I could extract into a separate PR:
ca_dir_ownerandca_dir_groupI noticed that when CA and client certificate directory is the same on CA servers certificate push from localhost is skipped and handler is not run for client certificate update on CA host.
I've fixed it by configuring different directories for CA files and client certificates for
renewandca-renewscenarios.This change revealed incorrect path used for
crt_path.Besides I hit checksum mismatch for concurrent CA certificate fetch and added
run_onceargument fordelegate_totasks supposed to run only once on CA host and localhost.I simplified
notAftervalidation viaopenssl -checkvalidflag.I've fixed
ansible-linterrors and enabledansible-lintin the Github workflow.I've added support of setting
ca_altnameXvariables tonullvalue and omittingsubjectAltNamefield. Alternatively it's possible to provide customca_subject_alternative_nameI've fixed
ca.conf.j2to include proper x509v3 extensions for CA certificate. RemovedsubjectAltNamefrom it becausesubjectAltNamemakes sense for end user certificates.I've changed default value for
ca_server_certto false. My assumption is that the first end-user certificate could be configured as client or/and server.Renamed
ca_client_*vars toca_cert_*to reflect that the first certificate could be not forclientAuthpurposeAdded
ca_certflag to be able to skip leaf certificate generation on CA host by default.extended_key_usageis renamed toca_extended_key_usageand become a list. It's possible to set it like thisWith handlers added I recommend to use different directories for CA host files and client certificates. But I didn't change it in the default variables for backward compatibility.