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

add support for systemd creds encrypt/decrypt #9383

Merged
merged 23 commits into from
Dec 29, 2024

Conversation

konstruktoid
Copy link
Contributor

@konstruktoid konstruktoid commented Dec 25, 2024

SUMMARY

This PR adds systemd-creds encrypt/decrypt functionality.

ISSUE TYPE
  • New Module/Plugin Pull Request
COMPONENT NAME
  • systemd_creds_decrypt
  • systemd_creds_encrypt
ADDITIONAL INFORMATION

- Note that I haven't updated the version_added information.

  • Since systemd-creds encrypt encrypts the information using host specific settings, it needs to be run as well when testing systemd-creds decrypt.
  • The systemd-creds encrypt doesn't support (unencrypted plaintext) input credential files as the systemd tool does, only stdin as string.

@ansibullbot ansibullbot added integration tests/integration module module plugins plugin (any type) tests tests labels Dec 25, 2024
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-10 Automatically create a backport for the stable-10 branch labels Dec 26, 2024
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I've added some first quick comments.

plugins/modules/systemd_creds_decrypt.py Outdated Show resolved Hide resolved
tests/integration/targets/systemd_creds_decrypt/main.yaml Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_encrypt.py Outdated Show resolved Hide resolved
Signed-off-by: Thomas Sjögren <[email protected]>
tests/integration/targets/systemd_creds_decrypt/main.yaml Outdated Show resolved Hide resolved
tests/integration/targets/systemd_creds_decrypt/aliases Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_encrypt.py Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_decrypt.py Outdated Show resolved Hide resolved
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
plugins/modules/systemd_creds_decrypt.py Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_decrypt.py Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_decrypt.py Show resolved Hide resolved
plugins/modules/systemd_creds_encrypt.py Outdated Show resolved Hide resolved
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
plugins/modules/systemd_creds_decrypt.py Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_decrypt.py Show resolved Hide resolved
plugins/modules/systemd_creds_decrypt.py Outdated Show resolved Hide resolved
konstruktoid and others added 2 commits December 28, 2024 01:41
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@konstruktoid
Copy link
Contributor Author

Looks good to me!

Thanks for the help and guidance @felixfontein

Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @konstruktoid

Just a couple of comments more. Other than that, LGTM.

plugins/modules/systemd_creds_encrypt.py Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_encrypt.py Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_encrypt.py Outdated Show resolved Hide resolved
plugins/modules/systemd_creds_encrypt.py Outdated Show resolved Hide resolved
russoz

This comment was marked as duplicate.

Signed-off-by: Thomas Sjögren <[email protected]>
Signed-off-by: Thomas Sjögren <[email protected]>
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@felixfontein felixfontein merged commit 482a90e into ansible-collections:main Dec 29, 2024
129 checks passed
Copy link

patchback bot commented Dec 29, 2024

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/482a90e8b4a66e1356c1b4771445edddfe1a026a/pr-9383

Backported as #9468

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 29, 2024
patchback bot pushed a commit that referenced this pull request Dec 29, 2024
* add support for systemd creds encrypt/decrypt

Signed-off-by: Thomas Sjögren <[email protected]>

* add __metaclass__

Signed-off-by: Thomas Sjögren <[email protected]>

* Python 2.7 issues

Signed-off-by: Thomas Sjögren <[email protected]>

* update version_added and ci test aliases

Signed-off-by: Thomas Sjögren <[email protected]>

* switch to container

Signed-off-by: Thomas Sjögren <[email protected]>

* run tests in docker as well

Signed-off-by: Thomas Sjögren <[email protected]>

* move tasks into tasks/

Signed-off-by: Thomas Sjögren <[email protected]>

* no need to call echo

Signed-off-by: Thomas Sjögren <[email protected]>

* lint and add become:

Signed-off-by: Thomas Sjögren <[email protected]>

* dont append a newline

Signed-off-by: Thomas Sjögren <[email protected]>

* don't clean newlines

Signed-off-by: Thomas Sjögren <[email protected]>

* only use module name

Signed-off-by: Thomas Sjögren <[email protected]>

* clean

Signed-off-by: Thomas Sjögren <[email protected]>

* change msg to value

Signed-off-by: Thomas Sjögren <[email protected]>

* add return values

Signed-off-by: Thomas Sjögren <[email protected]>

* update attributes and description

Signed-off-by: Thomas Sjögren <[email protected]>

* Update plugins/modules/systemd_creds_decrypt.py

Co-authored-by: Felix Fontein <[email protected]>

* set newline default

Signed-off-by: Thomas Sjögren <[email protected]>

* Update plugins/modules/systemd_creds_encrypt.py

Co-authored-by: Alexei Znamensky <[email protected]>

* Update plugins/modules/systemd_creds_encrypt.py

Co-authored-by: Alexei Znamensky <[email protected]>

* Update plugins/modules/systemd_creds_encrypt.py

Co-authored-by: Alexei Znamensky <[email protected]>

* update required and spelling

Signed-off-by: Thomas Sjögren <[email protected]>

* use single backslash

Signed-off-by: Thomas Sjögren <[email protected]>

---------

Signed-off-by: Thomas Sjögren <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Alexei Znamensky <[email protected]>
(cherry picked from commit 482a90e)
@felixfontein
Copy link
Collaborator

@konstruktoid thanks for your contribution!
@russoz thanks for reviewing!

felixfontein pushed a commit that referenced this pull request Dec 29, 2024
… encrypt/decrypt (#9468)

add support for systemd creds encrypt/decrypt (#9383)

* add support for systemd creds encrypt/decrypt

Signed-off-by: Thomas Sjögren <[email protected]>

* add __metaclass__

Signed-off-by: Thomas Sjögren <[email protected]>

* Python 2.7 issues

Signed-off-by: Thomas Sjögren <[email protected]>

* update version_added and ci test aliases

Signed-off-by: Thomas Sjögren <[email protected]>

* switch to container

Signed-off-by: Thomas Sjögren <[email protected]>

* run tests in docker as well

Signed-off-by: Thomas Sjögren <[email protected]>

* move tasks into tasks/

Signed-off-by: Thomas Sjögren <[email protected]>

* no need to call echo

Signed-off-by: Thomas Sjögren <[email protected]>

* lint and add become:

Signed-off-by: Thomas Sjögren <[email protected]>

* dont append a newline

Signed-off-by: Thomas Sjögren <[email protected]>

* don't clean newlines

Signed-off-by: Thomas Sjögren <[email protected]>

* only use module name

Signed-off-by: Thomas Sjögren <[email protected]>

* clean

Signed-off-by: Thomas Sjögren <[email protected]>

* change msg to value

Signed-off-by: Thomas Sjögren <[email protected]>

* add return values

Signed-off-by: Thomas Sjögren <[email protected]>

* update attributes and description

Signed-off-by: Thomas Sjögren <[email protected]>

* Update plugins/modules/systemd_creds_decrypt.py

Co-authored-by: Felix Fontein <[email protected]>

* set newline default

Signed-off-by: Thomas Sjögren <[email protected]>

* Update plugins/modules/systemd_creds_encrypt.py

Co-authored-by: Alexei Znamensky <[email protected]>

* Update plugins/modules/systemd_creds_encrypt.py

Co-authored-by: Alexei Znamensky <[email protected]>

* Update plugins/modules/systemd_creds_encrypt.py

Co-authored-by: Alexei Znamensky <[email protected]>

* update required and spelling

Signed-off-by: Thomas Sjögren <[email protected]>

* use single backslash

Signed-off-by: Thomas Sjögren <[email protected]>

---------

Signed-off-by: Thomas Sjögren <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Alexei Znamensky <[email protected]>
(cherry picked from commit 482a90e)

Co-authored-by: Thomas Sjögren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch integration tests/integration module module plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants