Skip to content

Commit

Permalink
Set passphrase for beats tls key
Browse files Browse the repository at this point in the history
Side effect: Includes extra changes for listing names of pipelines in
task names

fixes #291
  • Loading branch information
widhalmt committed Nov 10, 2023
1 parent 60115d1 commit e7adf8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion roles/logstash/tasks/logstash-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
-topk8
-passin pass:{{ logstash_tls_key_passphrase }}
-out {{ logstash_certs_dir }}/{{ inventory_hostname }}-pkcs8.key
-nocrypt
-passout pass:{{ logstash_tls_key_passphrase }}
args:
creates: "{{ logstash_certs_dir }}/{{ inventory_hostname }}-pkcs8.key"
no_log: "{{ elasticstack_no_log }}"
Expand Down
14 changes: 7 additions & 7 deletions roles/logstash/tasks/manage_pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---

- name: Check if Logstash pipeline already exists
- name: Check if Logstash pipeline {{ pipelinename.name }} already exists

Check failure on line 3 in roles/logstash/tasks/manage_pipeline.yml

View workflow job for this annotation

GitHub Actions / lint_full / lint

name[template]

Jinja templates should only be at the end of 'name'

Check failure on line 3 in roles/logstash/tasks/manage_pipeline.yml

View workflow job for this annotation

GitHub Actions / lint_logstash / lint

name[template]

Jinja templates should only be at the end of 'name'
ansible.builtin.stat:
path: "/etc/logstash/conf.d/{{ pipelinename.name }}"
register: "logstash_pipeline_stat"

- name: Check who managed pipeline in last run # noqa: risky-shell-pipe
- name: Check who managed pipeline {{ pipelinename.name }} in last run # noqa: risky-shell-pipe

Check failure on line 8 in roles/logstash/tasks/manage_pipeline.yml

View workflow job for this annotation

GitHub Actions / lint_full / lint

name[template]

Jinja templates should only be at the end of 'name'

Check failure on line 8 in roles/logstash/tasks/manage_pipeline.yml

View workflow job for this annotation

GitHub Actions / lint_logstash / lint

name[template]

Jinja templates should only be at the end of 'name'
ansible.builtin.shell: >
if test -n "$(ps -p $$ | grep bash)"; then set -o pipefail; fi;
grep -e '^# source:{{ pipelinename.name }}' /etc/logstash/pipelines.yml |
Expand All @@ -16,7 +16,7 @@
- logstash_pipeline_stat.stat.exists | bool
- logstash_pipeline_stat.stat.isdir | bool

- name: Delete directory if changing manager
- name: Delete directory if changing manager of pipeline {{ pipelinename.name }}
ansible.builtin.file:
path: "/etc/logstash/conf.d/{{ pipelinename.name }}"
state: absent
Expand All @@ -25,15 +25,15 @@
- logstash_pipeline_manager.stdout == "local"
- pipelinename.source is defined

- name: Create Logstash pipeline directories
- name: Create Logstash pipeline {{ pipelinename.name }} directory

Check failure on line 28 in roles/logstash/tasks/manage_pipeline.yml

View workflow job for this annotation

GitHub Actions / lint_full / lint

name[template]

Jinja templates should only be at the end of 'name'

Check failure on line 28 in roles/logstash/tasks/manage_pipeline.yml

View workflow job for this annotation

GitHub Actions / lint_logstash / lint

name[template]

Jinja templates should only be at the end of 'name'
ansible.builtin.file:
path: "/etc/logstash/conf.d/{{ pipelinename.name }}"
state: directory
owner: root
group: root
mode: 0755

- name: Check out pipeline configuration
- name: Check out pipeline configuration for {{ pipelinename.name }}
ansible.builtin.git:
repo: "{{ pipelinename.source }}"
dest: "/etc/logstash/conf.d/{{ pipelinename.name }}"
Expand All @@ -42,7 +42,7 @@
notify:
- Restart Logstash noauto

- name: Create simple input
- name: Create simple input for {{ pipelinename.name }}
ansible.builtin.template:
src: simple-input.conf.j2
dest: "/etc/logstash/conf.d/{{ pipelinename.name }}\
Expand All @@ -54,7 +54,7 @@
notify:
- Restart Logstash noauto

- name: Create simple output
- name: Create simple output for {{ pipelinename.name }}
ansible.builtin.template:
src: simple-output.conf.j2
dest: "/etc/logstash/conf.d/{{ pipelinename.name }}\
Expand Down
1 change: 1 addition & 0 deletions roles/logstash/templates/beats-input.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ input {
ssl_verify_mode => force_peer
ssl_certificate_authorities => ["{{ logstash_certs_dir }}/ca.crt"]
ssl_peer_metadata => false
ssl_key_passphrase => "{{ logstash_tls_key_passphrase }}"
{% endif %}

}
Expand Down

0 comments on commit e7adf8e

Please sign in to comment.