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

Set passphrase for beats tls key #292

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion roles/logstash/tasks/logstash-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,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 already exists {{ pipelinename.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 in last run {{ pipelinename.name }} # noqa: risky-shell-pipe
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 directory {{ pipelinename.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 %}
{% if logstash_beats_timeout is defined %}
client_inactivity_timeout => "{{ logstash_beats_timeout }}"
Expand Down
Loading