-
Notifications
You must be signed in to change notification settings - Fork 39
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
Ansible Node - Enforce private key permission and bind permissions to scylla user #141
base: master
Are you sure you want to change the base?
Conversation
ansible-scylla-node/tasks/ssl.yml
Outdated
- "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem" | ||
|
||
- name: Secure local OpenSSL private key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? Don't we want to cleanup after ourselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Updated to delete private key. Do notice we must still keep the private CA key for add-node operations, for instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
- "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem" | ||
|
||
- name: Delete local OpenSSL private key | ||
file: | ||
path: "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of keeping any file under .ssl on the localhost?
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 #139