-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible-scylla-node: Add support for system resources encryption
System encryption is applied to semi-transient on-disk data, such as commit logs, batch logs, and hinted handoff data. This patch adds support for it by adding the variables system_info_encryption_local and system_info_encryption_kmip. The former should be used for a LocalKeyProvider and the latter for a KMIPKeyProvider. If the user is using a KMIPKeyProvider the variable kmip_hosts, also added in this patch, must be set. The details of how these variables must be used are described in ansible-scylla-node/defaults/main.yml along with the other variables from the node role. Fixes #88
- Loading branch information
1 parent
f7efce8
commit 85c2359
Showing
4 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
- set_fact: | ||
_remote_key_path: "{{ _encryption_vars.key_dir }}/{{ _encryption_vars.key_name }}" | ||
|
||
- set_fact: | ||
_localhost_key_path: "{{ _encryption_vars.localhost_key_dir }}/{{ _encryption_vars.key_name }}" | ||
|
||
- name: Check if the keys already exist in the nodes | ||
stat: | ||
path: "{{ _remote_key_path }}" | ||
become: true | ||
register: remote_key_file | ||
|
||
- name: Check if the user provided a key | ||
stat: | ||
path: "{{ _localhost_key_path }}" | ||
delegate_to: localhost | ||
register: localhost_key_file | ||
|
||
- fail: | ||
msg: "This node already has a key in '{{ _remote_key_path }}'" | ||
when: remote_key_file.stat.exists|bool and localhost_key_file.stat.exists|bool == false | ||
|
||
- fail: | ||
msg: "This node already has a key in '{{ _remote_key_path }}' and it's different from the one provided by the user in '{{ _localhost_key_path }}'" | ||
when: | ||
- remote_key_file.stat.exists|bool and localhost_key_file.stat.exists|bool | ||
- remote_key_file.stat.checksum != localhost_key_file.stat.checksum | ||
|
||
- name: Create keys dir | ||
file: | ||
path: "{{ _encryption_vars.key_dir }}" | ||
state: directory | ||
owner: scylla | ||
group: scylla | ||
mode: '700' | ||
become: true | ||
|
||
- name: Generate key and copy it to localhost | ||
block: | ||
- name: Generate key | ||
shell: "/bin/local_file_key_generator -a {{ _encryption_vars.cipher_algorithm }} -m {{ _encryption_vars.secret_key_block_mode }} -p {{ _encryption_vars.secret_key_padding }} -l {{ _encryption_vars.secret_key_strength }} {{ _remote_key_path }}" | ||
become: true | ||
|
||
- name: Create localhost keys dir | ||
file: | ||
path: "{{ _encryption_vars.localhost_key_dir }}" | ||
state: directory | ||
mode: '700' | ||
delegate_to: localhost | ||
|
||
- name: Copy key from remote to localhost | ||
fetch: | ||
src: "{{ _remote_key_path }}" | ||
dest: "{{ _localhost_key_path }}" | ||
flat: true | ||
validate_checksum: true | ||
become: true | ||
run_once: true | ||
when: localhost_key_file.stat.exists|bool == false | ||
|
||
- name: Copy key from localhost to all nodes | ||
copy: | ||
src: "{{ _localhost_key_path }}" | ||
dest: "{{ _remote_key_path }}" | ||
owner: scylla | ||
group: scylla | ||
mode: '600' | ||
become: true |
This file contains 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