dj-wasabi.ossec-server
ansible-ossec-server
This role installs the OSSEC server on a host.
Build Status:
Requirements
This role works on:
- Red Hat
- Debian
- Ubuntu
- Amazon Linux (2)
So, you need one of these operating systems. :-)
Role Variables
This role has some variables that you can change or need to set.
ossec_server_atomic_release: 1.0-21
ossec_server_config: []
ossec_agent_configs: []
Example Setup
Edit the vars file for the host running the OSSEC server:
host_vars/ossec-server
install_postfix: true
postfix_mydomain: email-smtp.us-west-1.amazonaws.com
postfix_sasl_passwds:
- "[email-smtp.us-west-1.amazonaws.com]:587 USERNAME:PASSWORD"
postfix_relayhost: false
postfix_mynetworks: false
postfix_myhostname: localhost
postfix_domain: localhost
postfix_additional_settings:
relayhost: "[email-smtp.us-west-1.amazonaws.com]:587"
ossec_server_config:
mail_to:
- [email protected]
mail_smtp_server: localhost
mail_from: [email protected]
frequency_check: 72000
ignore_files:
- /etc/mtab
- /etc/mnttab
- /etc/hosts.deny
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'
globals:
- '127.0.0.1'
- '192.168.2.1'
connection: 'secure'
log_level: 1
email_level: 7
commands:
- name: 'host-deny'
executable: 'host-deny.sh'
expect: 'srcip'
timeout_allowed: 'yes'
active_responses:
- command: 'host-deny'
location: 'local'
level: 6
timeout: 600
ossec_agent_configs:
- type: os
type_value: linux
frequency_check: 79200
ignore_files:
- /etc/mtab
- /etc/mnttab
- /etc/hosts.deny
- /etc/mail/statistics
- /etc/svc/volatile
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: 'syslog'
location: '/var/log/maillog'
- format: 'apache'
location: '/var/log/httpd/error_log'
- format: 'apache'
location: '/var/log/httpd/access_log'
- format: 'apache'
location: '/var/ossec/logs/active-responses.log'
ossec_server_config:
This section contains the server settings. Please adjust these for your needs, as the default settings may not work for you.
ossec_agent_configs:
Refer to the OSSEC documentation for agent configuration: http://ossec-docs.readthedocs.org/en/latest/manual/agent/agent-configuration.html
There are three "types":
- os
- name
- profile
In this setup, the type is "os" for "linux." You can add multiple types in the host_vars file for different configurations.
Find more information about the OSSEC shared agent configuration here: http://ossec-docs.readthedocs.org/en/latest/manual/syscheck/
<_role_>/vars/main.yml
nil
Dependencies
No dependencies.
Example Playbook
Here’s an example of how to use this role, including variable parameters:
- hosts: ossec-server.example.com
roles:
- { role: dj-wasabi.ossec-server }
Molecule
This role is set up for testing with Molecule. More information about Molecule can be found here: https://werner-dijkerman.nl/2016/07/10/testing-ansible-roles-with-molecule-testinfra-and-docker/
Molecule will run 2 Docker containers with the following operating systems:
- Debian 8
- CentOS 7
License
GPLv3
Author Information
Please send suggestions or pull requests to improve this role.
Github: https://github.com/dj-wasabi/ansible-ossec-server
Email: ikben [ at ] werner-dijkerman . nl
ansible-galaxy install dj-wasabi.ossec-server