Ansible Node - Enforce private key permission and bind permissions to scylla user#141
Open
fee-mendes wants to merge 1 commit intoscylladb:masterfrom
Open
Ansible Node - Enforce private key permission and bind permissions to scylla user#141fee-mendes wants to merge 1 commit intoscylladb:masterfrom
fee-mendes wants to merge 1 commit intoscylladb:masterfrom
Conversation
vladzcloudius
requested changes
Jul 5, 2022
ansible-scylla-node/tasks/ssl.yml
Outdated
| loop: | ||
| - "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem" | ||
|
|
||
| - name: Secure local OpenSSL private key |
Collaborator
There was a problem hiding this comment.
Why is this needed? Don't we want to cleanup after ourselves?
Member
Author
There was a problem hiding this comment.
Makes sense. Updated to delete private key. Do notice we must still keep the private CA key for add-node operations, for instance.
Collaborator
There was a problem hiding this comment.
I'm not following why would you need to keep any key after you copied it to remote nodes?
We are going to re-generate all keys from scratch every time we execute the Role anyway, don't we?
… scylla user When the source playbook is executed with `become: True` its relevant TLS certificates will be owned by root. This causes a problem, because later on when trying to copy we are unable to read the resulting private key file, as it is (correctly) created by default with mode 0600. This commit let Ansible generate each PKI component with mode 0644. Then, ensure these are copied to the remote machine's with strict permissions to scylla user/group. Finally, ensure that the private key is only readable by its target user - both locally and remotely. Fixes scylladb#139
vladzcloudius
requested changes
Aug 25, 2022
|
|
||
| - name: Delete local OpenSSL private key | ||
| file: | ||
| path: "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem" |
Collaborator
There was a problem hiding this comment.
What's the point of keeping any file under .ssl on the localhost?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the source playbook is executed with
become: Trueits relevant TLS certificates will be owned by root. This causes a problem, because later on when trying to copy we are unable to read the resulting private key file, as it is (correctly) created by default with mode 0600.This commit let Ansible generate each PKI component with mode 0644. Then, ensure these are copied to the remote machine's with strict permissions to scylla user/group. Finally, ensure that the private key is only readable by its target user - both locally and remotely.
Fixes #139