Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step_ca_certificate: Support file attributes #338

Open
maxhoesel opened this issue Oct 10, 2023 · 2 comments
Open

step_ca_certificate: Support file attributes #338

maxhoesel opened this issue Oct 10, 2023 · 2 comments
Labels
enhancement New feature or improvement to an existing one modules Something affecting one or more module

Comments

@maxhoesel
Copy link
Collaborator

The step_ca_certificate module deals with writing files to disk, so it should support the common file attributes as provided by ansible: https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/doc_fragments/files.py

This would allow direct setting of owners, selinux context etc.

@maxhoesel maxhoesel added enhancement New feature or improvement to an existing one modules Something affecting one or more module labels Oct 10, 2023
@maxhoesel maxhoesel added this to the version-1 milestone Oct 10, 2023
@maxhoesel maxhoesel removed this from the version-1 milestone Oct 26, 2023
@eengstrom
Copy link
Contributor

I'm hopeful that the final etc. would include permissions.

Related - As of this moment, I'm experimenting with using ACLs to allow non-root processes access to the generated certificates.

@eengstrom
Copy link
Contributor

I was thinking about this again, and recalled that when I was working on the PR (#129) to solve #127, I implemented this convention for the _certfile and _keyfile vars passed to the module, as in this example:

vars:
  # ...
  step_cert_certfile:
    path: "{{ bacula_tls_dir }}/{{ inventory_hostname }}.crt"
    owner: "{{ bacula_master_user }}"
    group: "{{ bacula_master_group }}"
    mode: "0644"
  step_cert_keyfile:
    path: "{{ bacula_tls_dir }}/{{ inventory_hostname }}.key"
    owner: "{{ bacula_master_user }}"
    group: "{{ bacula_master_group }}"
    mode: "0600"

That is, passing a dictionary in place of a simple string. The module could conditionally accept either a string, assumed to be the path, or a dictionary which must provide the path key/value pair.

In full disclosure, I can't recall if I came up with that on my own, or I was following a previous convention that you had started. More importantly, it's a bit of non-standard approach. On the other hand, it does allow the specification of the dictionaries elsewhere and passed as a single variable.

I might be able to make some time to help implement, regardless of the approach, but I'd rather not start if you don't like the approach itself, @maxhoesel .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to an existing one modules Something affecting one or more module
Projects
None yet
Development

No branches or pull requests

2 participants