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

Ansible Node - Enforce private key permission and bind permissions to scylla user #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions ansible-scylla-node/tasks/ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
- name: Generate an OpenSSL private key.
openssl_privatekey:
path: "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem"
mode: 0644
delegate_to: localhost

- name: Generate an OpenSSL Certificate Signing Request
openssl_csr:
path: "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.csr"
privatekey_path: "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem"
common_name: "{{ inventory_hostname }}.{{ scylla_cluster_name }}.internal"
mode: 0644
delegate_to: localhost

- name: Generate an OpenSSL certificate signed with our CA certificate
Expand All @@ -54,21 +56,38 @@
ownca_path: "./ssl/ca/{{scylla_cluster_name }}-ca.crt"
ownca_privatekey_path: "./ssl/ca/{{ scylla_cluster_name }}-ca.pem"
provider: ownca
mode: 0644
delegate_to: localhost

- name: Copy the certificates into their proper locations
copy:
src: "{{ item }}"
dest: "{{ scylla_ssl.cert_path }}/{{ item | basename }}"
owner: root
group: root
owner: scylla
group: scylla
mode: '0644'
become: true
loop:
- "./ssl/ca/{{ scylla_cluster_name }}-ca.crt"
- "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.crt"

- name: Securely copy private key into its proper location
copy:
src: "{{ item }}"
dest: "{{ scylla_ssl.cert_path }}/{{ item | basename }}"
owner: scylla
group: scylla
mode: '0600'
become: true
loop:
- "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem"

- name: Delete local OpenSSL private key
file:
path: "./ssl/{{ inventory_hostname }}/{{ inventory_hostname }}.pem"
Copy link
Collaborator

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?

state: absent
delegate_to: localhost

- name: Generate cqlshrc
template:
src: templates/cqlshrc.j2
Expand Down