diff --git a/ansible-role-elk/tasks/main.yml b/ansible-role-elk/tasks/main.yml index 4ed89641..0a2962b4 100644 --- a/ansible-role-elk/tasks/main.yml +++ b/ansible-role-elk/tasks/main.yml @@ -56,7 +56,7 @@ command: /bin/bash /usr/share/kibana/bin/kibana-plugin list register: kibanainstalled -- name: Restart Kibana if Wazuh-APP is installed +- name: Install Wazuh-APP (can take a while) shell: /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-2.0_5.2.2.zip && service kibana restart when: kibanainstalled.stdout.find('wazuh') == -1 diff --git a/ansible-wazuh-agent/tasks/Debian.yml b/ansible-wazuh-agent/tasks/Debian.yml index 56ce748b..3c89a952 100644 --- a/ansible-wazuh-agent/tasks/Debian.yml +++ b/ansible-wazuh-agent/tasks/Debian.yml @@ -21,6 +21,11 @@ apt: update_cache=yes when: wazuh_repo.changed +- name: Set Distribution CIS filename for debian + set_fact: + cis_distribution_filename: cis_debian_linux_rcl.txt + when: ansible_os_family == "Debian" + - name: Debian/Ubuntu | Install wazuh-agent apt: pkg={{ item }} state=present diff --git a/ansible-wazuh-agent/tasks/RedHat.yml b/ansible-wazuh-agent/tasks/RedHat.yml index 80e8a177..9d60d9e8 100644 --- a/ansible-wazuh-agent/tasks/RedHat.yml +++ b/ansible-wazuh-agent/tasks/RedHat.yml @@ -14,6 +14,22 @@ gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH gpgcheck: yes + +- name: Set Distribution CIS filename for RHEL5 + set_fact: + cis_distribution_filename: cis_rhel5_linux_rcl.txt + when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "5" + +- name: Set Distribution CIS filename for RHEL6 + set_fact: + cis_distribution_filename: cis_rhel6_linux_rcl.txt + when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6" + +- name: Set Distribution CIS filename for RHEL7 + set_fact: + cis_distribution_filename: cis_rhel7_linux_rcl.txt + when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7" + - name: RedHat | Install Wazuh Agent yum: pkg={{ item }} state=present diff --git a/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 b/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 index 9dd9ef37..f67e889b 100644 --- a/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 +++ b/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 @@ -42,7 +42,7 @@ {% if ansible_distribution_major_version == '7' %} {% elif ansible_distribution_major_version == '6' %} - + {% endif %} xccdf_org.ssgproject.content_profile_pci-dss xccdf_org.ssgproject.content_profile_common @@ -50,4 +50,60 @@ {% endif %} + + no + yes + yes + yes + yes + yes + yes + yes + yes + + + 43200 + + /var/ossec/etc/shared/rootkit_files.txt + /var/ossec/etc/shared/rootkit_trojans.txt + /var/ossec/etc/shared/system_audit_rcl.txt + /var/ossec/etc/shared/{{ cis_distribution_filename }} + + yes + + + + + {{ ossec_agent_config.frequency_check }} + {{ ossec_agent_config.syscheck_scan_on_start }} + + +{% for directory in ossec_agent_config.directories %} + {{ directory.dirs }} +{% endfor %} + + + {% for ignore_file in ossec_agent_config.ignore_files %} + {{ ignore_file }} + {% endfor %} + + + {% for no_diff in ossec_agent_config.no_diff %} + {{ no_diff }} + {% endfor %} + + + +{% for localfile in ossec_agent_config.localfiles %} + + {{ localfile.format }} + {% if localfile.format == 'command' or localfile.format == 'full_command' %} + {{ localfile.command }} + {{ localfile.frequency }} + {% else %} + {{ localfile.location }} + {% endif %} + +{% endfor %} + diff --git a/ansible-wazuh-agent/vars/main.yml b/ansible-wazuh-agent/vars/main.yml index 285e8384..9ceab9e8 100644 --- a/ansible-wazuh-agent/vars/main.yml +++ b/ansible-wazuh-agent/vars/main.yml @@ -1,2 +1,43 @@ --- # vars file for ossec-agent +ossec_agent_config: + frequency_check: 43200 + syscheck_scan_on_start: 'yes' + ignore_files: + - /etc/mtab + - /etc/mnttab + - /etc/hosts.deny + - /etc/mail/statistics + - /etc/random-seed + - /etc/random.seed + - /etc/adjtime + - /etc/httpd/logs + - /etc/utmpx + - /etc/wtmpx + - /etc/cups/certs + - /etc/dumpdates + - /etc/svc/volatile + no_diff: + - /etc/ssl/private.key + directories: + - check_all: 'yes' + dirs: /etc,/usr/bin,/usr/sbin + - check_all: 'yes' + dirs: /bin,/sbin + localfiles: + - format: 'syslog' + location: '/var/log/messages' + - format: 'syslog' + location: '/var/log/secure' + - format: 'command' + command: 'df -P' + frequency: '360' + - format: 'full_command' + command: 'netstat -tln | grep -v 127.0.0.1 | sort' + frequency: '360' + - format: 'full_command' + command: 'last -n 20' + frequency: '360' + globals: + - '127.0.0.1' + - '192.168.2.1' diff --git a/ansible-wazuh-server/templates/var-ossec-rules-local_rules.xml.j2 b/ansible-wazuh-server/templates/var-ossec-rules-local_rules.xml.j2 index 572edd9e..d76ccfb8 100644 --- a/ansible-wazuh-server/templates/var-ossec-rules-local_rules.xml.j2 +++ b/ansible-wazuh-server/templates/var-ossec-rules-local_rules.xml.j2 @@ -18,6 +18,14 @@ + + + 5702 + sshd: Possible breakin attempt + (high number of reverse lookup errors). + pci_dss_11.4, + + - - - + + - + diff --git a/ansible-wazuh-server/vars/main.yml b/ansible-wazuh-server/vars/main.yml index c9b7c2b1..95c8cf27 100644 --- a/ansible-wazuh-server/vars/main.yml +++ b/ansible-wazuh-server/vars/main.yml @@ -1,6 +1,6 @@ ossec_server_config: mail_to: - - me@example.com + - jose@wazuh.com mail_smtp_server: localhost mail_from: ossec@example.com frequency_check: 43200 diff --git a/wazuh-agent.yml b/wazuh-agent.yml index e2ab4aae..db13438f 100644 --- a/wazuh-agent.yml +++ b/wazuh-agent.yml @@ -1,3 +1,3 @@ - hosts: all:!wazuh-manager roles: - - { role: ansible-wazuh-agent, ossec_server_ip: 192.168.33.170 } + - { role: ansible-wazuh-agent, ossec_server_ip: 192.168.33.169 } diff --git a/wazuh-manager.yml b/wazuh-manager.yml index cb37fab0..22139ecf 100644 --- a/wazuh-manager.yml +++ b/wazuh-manager.yml @@ -1,4 +1,4 @@ - hosts: wazuh-manager roles: - role: ansible-wazuh-server - - role: ansible-role-filebeat + - { role: ansible-role-filebeat, filebeat_output_logstash_hosts: '192.168.33.177:5000' }