diff --git a/roles/wazuh/ansible-wazuh-agent/defaults/main.yml b/roles/wazuh/ansible-wazuh-agent/defaults/main.yml index b1fec61b..56580b75 100644 --- a/roles/wazuh/ansible-wazuh-agent/defaults/main.yml +++ b/roles/wazuh/ansible-wazuh-agent/defaults/main.yml @@ -93,7 +93,7 @@ wazuh_agent_config: ports_no: 'yes' processes: 'yes' cis_cat: - disable: 'no' + disable: 'yes' install_java: 'yes' timeout: 1800 interval: '1d' @@ -103,7 +103,7 @@ wazuh_agent_config: content: - type: 'xccdf' path: 'benchmarks/CIS_Ubuntu_Linux_16.04_LTS_Benchmark_v1.0.0-xccdf.xml' - profile: 'xccdf_org.cisecurity.benchmarks_profile_Level_1_-_Server' + profile: 'xccdf_org.cisecurity.benchmarks_profile_Level_1_-_Server' vuls: disable: 'yes' interval: '1d' @@ -115,23 +115,34 @@ wazuh_agent_config: - 'nvd-year 2016' - 'autoupdate' localfiles: - - format: 'syslog' - location: '/var/ossec/logs/active-responses.log' - - format: 'syslog' - location: '/var/log/auth.log' - - format: 'syslog' - location: '/var/log/syslog' - - format: 'syslog' - location: '/var/log/dpkg.log' - - format: 'syslog' - location: '/var/log/kern.log' - - format: 'command' - command: 'df -P' - frequency: '360' - - format: 'full_command' - command: netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d - alias: 'netstat listening ports' - frequency: '360' - - format: 'full_command' - command: 'last -n 20' - frequency: '360' + debian: + - format: 'syslog' + location: '/var/log/auth.log' + - format: 'syslog' + location: '/var/log/syslog' + - format: 'syslog' + location: '/var/log/dpkg.log' + - format: 'syslog' + location: '/var/log/kern.log' + centos: + - format: 'syslog' + location: '/var/log/messages' + - format: 'syslog' + location: '/var/log/secure' + - format: 'syslog' + location: '/var/log/maillog' + - format: 'audit' + location: '/var/log/audit/audit.log' + common: + - format: 'syslog' + location: '/var/ossec/logs/active-responses.log' + - format: 'command' + command: 'df -P' + frequency: '360' + - format: 'full_command' + command: netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d + alias: 'netstat listening ports' + frequency: '360' + - format: 'full_command' + command: 'last -n 20' + frequency: '360' diff --git a/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 b/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 index 6899c5ca..14d34fe3 100644 --- a/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 +++ b/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 @@ -87,13 +87,13 @@ no {% if ansible_system == "Linux" %} - #/var/ossec/etc/shared + /etc,/usr/bin,/usr/sbin /bin,/sbin,/boot {% endif %} {{ wazuh_agent_config.syscheck.auto_ignore }} - #{{ wazuh_agent_config.syscheck.alert_new_files }} + {{ wazuh_agent_config.syscheck.frequency }} {{ wazuh_agent_config.syscheck.scan_on_start }} @@ -245,7 +245,7 @@ {% endif %} - {% for localfile in wazuh_agent_config.localfiles %} + {% for localfile in wazuh_agent_config.localfiles.common %} {{ localfile.format }} {% if localfile.format == 'command' or localfile.format == 'full_command' %} @@ -257,4 +257,31 @@ {% endfor %} + {% if ansible_os_family == "Debian" %} + {% for localfile in wazuh_agent_config.localfiles.debian %} + + {{ localfile.format }} + {% if localfile.format == 'command' or localfile.format == 'full_command' %} + {{ localfile.command }} + {{ localfile.frequency }} + {% else %} + {{ localfile.location }} + {% endif %} + + {% endfor %} + {% endif %} + + {% if ansible_os_family == "RedHat" %} + {% for localfile in wazuh_agent_config.localfiles.centos %} + + {{ localfile.format }} + {% if localfile.format == 'command' or localfile.format == 'full_command' %} + {{ localfile.command }} + {{ localfile.frequency }} + {% else %} + {{ localfile.location }} + {% endif %} + + {% endfor %} + {% endif %} diff --git a/roles/wazuh/ansible-wazuh-manager/defaults/main.yml b/roles/wazuh/ansible-wazuh-manager/defaults/main.yml index 1d91d460..9f42df5e 100644 --- a/roles/wazuh/ansible-wazuh-manager/defaults/main.yml +++ b/roles/wazuh/ansible-wazuh-manager/defaults/main.yml @@ -181,26 +181,36 @@ wazuh_manager_config: log_level: 1 email_level: 12 localfiles: - - format: 'command' - command: 'df -P' - frequency: '360' - - format: 'full_command' - command: netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d - alias: 'netstat listening ports' - frequency: '360' - - format: 'full_command' - command: 'last -n 20' - frequency: '360' - - format: 'syslog' - location: '/var/ossec/logs/active-responses.log' - - format: 'syslog' - location: '/var/log/auth.log' - - format: 'syslog' - location: '/var/log/syslog' - - format: 'syslog' - location: '/var/log/dpkg.log' - - format: 'syslog' - location: '/var/log/kern.log' + common: + - format: 'command' + command: 'df -P' + frequency: '360' + - format: 'full_command' + command: netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d + alias: 'netstat listening ports' + frequency: '360' + - format: 'full_command' + command: 'last -n 20' + - format: 'syslog' + location: '/var/ossec/logs/active-responses.log' + debian: + - format: 'syslog' + location: '/var/log/auth.log' + - format: 'syslog' + location: '/var/log/syslog' + - format: 'syslog' + location: '/var/log/dpkg.log' + - format: 'syslog' + location: '/var/log/kern.log' + centos: + - format: 'syslog' + location: '/var/log/messages' + - format: 'syslog' + location: '/var/log/secure' + - format: 'syslog' + location: '/var/log/maillog' + - format: 'audit' + location: '/var/log/audit/audit.log' globals: - '127.0.0.1' - '192.168.2.1' @@ -209,10 +219,10 @@ wazuh_manager_config: executable: 'disable-account.sh' expect: 'user' timeout_allowed: 'yes' - - name: 'restart-ossec' - executable: 'restart-ossec.sh' - expect: '' - timeout_allowed: 'no' + #- name: 'restart-ossec' + # executable: 'restart-ossec.sh' + # expect: '' + # timeout_allowed: 'no' - name: 'win_restart-ossec' executable: 'restart-ossec.cmd' expect: '' diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 index b20d8f9a..6f6a3615 100644 --- a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 +++ b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 @@ -398,7 +398,7 @@ {% endif %} - + -{% for localfile in wazuh_manager_config.localfiles %} +{% for localfile in wazuh_manager_config.localfiles.common %} {{ localfile.format }} {% if localfile.format == 'command' or localfile.format == 'full_command' %} @@ -450,6 +451,82 @@ {% endfor %} +{% if ansible_os_family == "Debian" %} +{% for localfile in wazuh_manager_config.localfiles.debian %} + + {{ localfile.format }} + {% if localfile.format == 'command' or localfile.format == 'full_command' %} + {{ localfile.command }} + {% if localfile.alias is defined %} + {{ localfile.alias }} + {% endif %} + {% if localfile.frequency is defined %} + {{ localfile.frequency }} + {% endif %} + {% else %} + {{ localfile.location }} + {% if localfile.format == 'eventchannel' %} + {% if localfile.only_future_events is defined %} + {{ localfile.only_future_events }} + {% endif %} + {% if localfile.query is defined %} + {{ localfile.query }} + {% endif %} + {% endif %} + {% endif %} + {% if localfile.format == 'json' and localfile.labels is defined %} + {% for key, value in localfile.labels.iteritems() %} + + {% endfor %} + {% endif %} + {% if localfile.target is defined %} + {{ localfile.target }} + {% endif %} + {% if localfile.out_format is defined %} + {{ localfile.out_format }} + {% endif %} + +{% endfor %} +{% endif %} + +{% if ansible_os_family == "RedHat" %} +{% for localfile in wazuh_manager_config.localfiles.centos %} + + {{ localfile.format }} + {% if localfile.format == 'command' or localfile.format == 'full_command' %} + {{ localfile.command }} + {% if localfile.alias is defined %} + {{ localfile.alias }} + {% endif %} + {% if localfile.frequency is defined %} + {{ localfile.frequency }} + {% endif %} + {% else %} + {{ localfile.location }} + {% if localfile.format == 'eventchannel' %} + {% if localfile.only_future_events is defined %} + {{ localfile.only_future_events }} + {% endif %} + {% if localfile.query is defined %} + {{ localfile.query }} + {% endif %} + {% endif %} + {% endif %} + {% if localfile.format == 'json' and localfile.labels is defined %} + {% for key, value in localfile.labels.iteritems() %} + + {% endfor %} + {% endif %} + {% if localfile.target is defined %} + {{ localfile.target }} + {% endif %} + {% if localfile.out_format is defined %} + {{ localfile.out_format }} + {% endif %} + +{% endfor %} +{% endif %} + {% if wazuh_manager_config.syslog_outputs is defined %} {% for syslog_output in wazuh_manager_config.syslog_outputs %} {% if syslog_output.server is not none %}