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

ossec: set permissions on gpg homedir and contents #3943

Merged
merged 1 commit into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions install_files/ansible-base/roles/ossec/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ ossec_is_client: False
journalist_alert_gpg_public_key: ""
journalist_gpg_fpr: ""
journalist_alert_email: ""

# These files should be created once an OSSEC key is imported.
gpg_keyring_files:
- pubring.gpg
- secring.gpg
- trustdb.gpg
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,44 @@
tags:
- gpg

- name: Check if GPG homedir already exists.
stat:
path: /var/ossec/.gnupg
register: gpg_homedir_status
tags:
- gpg

- name: Ensure correct permissions on OSSEC GPG homedir if it exists.
file:
state: directory
path: /var/ossec/.gnupg
mode: "0700"
owner: ossec
group: "{{ ossec_group }}"
when: gpg_homedir_status.stat.exists
tags:
- gpg

- name: Check if .gpg files have been created yet in the GPG homedir.
stat:
path: "/var/ossec/.gnupg/{{ item }}"
with_items: "{{ gpg_keyring_files }}"
register: gpg_keyring_status
tags:
- gpg

- name: Ensure correct permissions on contents of OSSEC GPG homedir.
file:
state: file
path: "/var/ossec/.gnupg/{{ item.item }}"
mode: "0600"
owner: ossec
group: "{{ ossec_group }}"
with_items: "{{ gpg_keyring_status.results }}"
when: item.stat.exists
tags:
- gpg

- name: Add the OSSEC GPG public key to the OSSEC manager keyring.
# multiline format for command module, since this is a long command
command: >
Expand Down