Skip to content

Fix KICS findings #356

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

Merged
merged 7 commits into from
Dec 3, 2024
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
2 changes: 1 addition & 1 deletion molecule/elasticstack_default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
elasticstack_full_stack: true
elasticstack_no_log: false
logstash_pipeline_unsafe_shutdown: true
logstash_redis_password: "ThisIsMyRedisTest"
logstash_redis_password: "{{ lookup('ansible.builtin.password', '/tmp/redispassword', chars=['ascii_letters'], length=15) }}"
redis_requirepass: "{{ logstash_redis_password }}"
beats_filebeat_syslog_udp: true
beats_filebeat_syslog_tcp: true
Expand Down
5 changes: 5 additions & 0 deletions molecule/elasticstack_default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@
- unzip
- systemd

# KICS complains about packages being updated.
# In this case, a mere test scenario it is OK, though.

- name: Update all installed packages RHEL
ansible.builtin.yum:
name: '*'
# kics-scan ignore-line
state: latest
update_cache: yes
update_only: yes
Expand All @@ -46,6 +50,7 @@
- name: Update all installed packages Debian
ansible.builtin.apt:
name: '*'
# kics-scan ignore-line
state: latest
update_cache: yes
when: ansible_os_family == "Debian"
3 changes: 3 additions & 0 deletions roles/beats/tasks/auditbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@
when:
- ansible_os_family == "Debian"

# KICS complains about "latest" package but this is a dedicated update task

- name: Install Auditbeat latest version - rpm - full stack
ansible.builtin.package:
name: auditbeat
# kics-scan ignore-line
state: latest
enablerepo:
- "elastic-{{ elasticstack_release }}.x"
Expand All @@ -56,7 +59,7 @@
- name: Install Auditbeat latest version - rpm - standalone
ansible.builtin.package:
name: auditbeat
state: latest

Check warning on line 62 in roles/beats/tasks/auditbeat.yml

View workflow job for this annotation

GitHub Actions / kics

[LOW] Unpinned Package Version

Setting state to latest performs an update and installs additional packages possibly resulting in performance degradation or loss of service
notify:
- Restart Auditbeat
when:
Expand All @@ -68,7 +71,7 @@
- name: Install Auditbeat latest version - deb
ansible.builtin.package:
name: auditbeat
state: latest

Check warning on line 74 in roles/beats/tasks/auditbeat.yml

View workflow job for this annotation

GitHub Actions / kics

[LOW] Unpinned Package Version

Setting state to latest performs an update and installs additional packages possibly resulting in performance degradation or loss of service
notify:
- Restart Auditbeat
when:
Expand Down
5 changes: 5 additions & 0 deletions roles/elasticsearch/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,16 @@
enabled: yes
register: elasticsearch_freshstart

# The comment in the following task will disable KICS security checks for this
# very line. In this state of the system we can only communicate without https
# so the finding is a false positive

- name: Handle cluster setup without security
when: not elasticsearch_security | bool
block:
- name: Check for cluster status without security
ansible.builtin.uri:
# kics-scan ignore-line
url: "http://{{ elasticsearch_api_host }}:{{ elasticstack_elasticsearch_http_port }}/_cluster/health?pretty"
register: elasticsearch_cluster_status
ignore_errors: "{{ ansible_check_mode }}"
Expand Down
Loading