Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
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
12 changes: 12 additions & 0 deletions roles/debian/rkhunter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
when: item.stat.exists
loop: "{{ _rkhunter_existing_scripts_to_whitelist.results }}"

- name: Check paths for portpath existence
ansible.builtin.stat:
path: "{{ item.split(':')[0] }}"
register: _rkhunter_existing_portpaths_to_whitelist
loop: "{{ rkhunter.portpathwhitelist }}"

- name: Filter existing portpath
set_fact:
existing_portpaths: "{{ existing_portpaths | default([]) + [item.item] }}"
when: item.stat.exists
loop: "{{ _rkhunter_existing_portpaths_to_whitelist.results }}"

- name: Copy rkhunter configuration.
ansible.builtin.template:
src: rkhunter.conf.j2
Expand Down
4 changes: 3 additions & 1 deletion roles/debian/rkhunter/templates/rkhunter.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,11 @@ SUSPSCAN_THRESH={{ rkhunter.supscan_threshold }}
#
#PORT_WHITELIST=""
#PORT_PATH_WHITELIST=""
{% for item in rkhunter.portpathwhitelist %}
{% if existing_portpaths is defined and existing_portpaths | length > 0 %}
{% for item in existing_portpaths %}
PORT_PATH_WHITELIST={{ item }}
{% endfor %}
{% endif %}

#
# The following option can be used to tell rkhunter where the operating system
Expand Down
Loading