{{http://www.ossec.net/wp-content/uploads/2012/06/ossec-hids.png|}} ====== OSSEC Tips & Tricks ======
**[[http://www.ossec.net/|OSSEC]]** is an Open Source Host-based Intrusion Detection System that performs log analysis, file integrity checking, policy monitoring, rootkit detection, real-time alerting and active response.
===== Installation =====
==== Database support ====
Enable database support:
cd src
make setdb
Error: PostgreSQL client libraries not installed.
Info: Compiled with MySQL support.
then ran ./install.sh
===== GNU/Debian (Ubuntu)=====
See: [[http://www.ossec.net/?page_id=19|OSSEC Download]]
# wget -O - http://ossec.alienvault.com/repos/apt/conf/ossec-key.gpg.key | apt-key add -
# echo "deb http://ossec.alienvault.com/repos/apt/debian wheezy main" >> /etc/apt/sources.list
(change wheezy for your Debian distribution)
# apt-get update
# apt-get install ossec-hids (or ossec-hids-agent)
**change "wheezy" to "jessie" to use with Ubuntu LTS 12.04 (14.04)**
===== Ansible deploy =====
FIXME
===== Windows (Agent) =====
FIXME
===== Configuration =====
==== Add new agent ====
=== Server side ===
Make sure you have port **1514/udp** (default) open for agents
# ./manage_agents
'''(A)dd new Agent''' and copy agent key from '''(E)xtract key for an agent'''
****************************************
* OSSEC HIDS v2.7.1 Agent manager. *
* The following options are available: *
****************************************
(A)dd an agent (A).
(E)xtract key for an agent (E).
(L)ist already added agents (L).
(R)emove an agent (R).
(Q)uit.
Choose your action: A,E,L,R or Q:
=== Agent side ===
./manage_agents
paste agent key into '''(I)mport key from the server'''
****************************************
* OSSEC HIDS v2.8 Agent manager. *
* The following options are available: *
****************************************
(I)mport key from the server (I).
(Q)uit.
Choose your action: I or Q:
==== Local/master configuration (Debian) ====
yes
root@xxxx
YOUR-SMTP-SERVER
MAILFROM-EMAIL
# List of IP addresses that should never be blocked by the
# active response (one per element). This option is only valid in server and local installs.
127.0.0.1
# If set, “X-IDS-OSSEC: ” will be added to the email headers with the specified value.
OSSEC
rules_config.xml
pam_rules.xml
sshd_rules.xml
telnetd_rules.xml
syslog_rules.xml
arpwatch_rules.xml
symantec-av_rules.xml
symantec-ws_rules.xml
pix_rules.xml
named_rules.xml
smbd_rules.xml
vsftpd_rules.xml
pure-ftpd_rules.xml
proftpd_rules.xml
ms_ftpd_rules.xml
ftpd_rules.xml
hordeimp_rules.xml
roundcube_rules.xml
wordpress_rules.xml
cimserver_rules.xml
vpopmail_rules.xml
vmpop3d_rules.xml
courier_rules.xml
web_rules.xml
web_appsec_rules.xml
apache_rules.xml
nginx_rules.xml
php_rules.xml
mysql_rules.xml
postgresql_rules.xml
ids_rules.xml
squid_rules.xml
firewall_rules.xml
cisco-ios_rules.xml
netscreenfw_rules.xml
sonicwall_rules.xml
postfix_rules.xml
sendmail_rules.xml
imapd_rules.xml
mailscanner_rules.xml
dovecot_rules.xml
ms-exchange_rules.xml
racoon_rules.xml
vpn_concentrator_rules.xml
spamd_rules.xml
msauth_rules.xml
mcafee_av_rules.xml
trend-osce_rules.xml
ms-se_rules.xml
zeus_rules.xml
solaris_bsm_rules.xml
vmware_rules.xml
ms_dhcp_rules.xml
asterisk_rules.xml
ossec_rules.xml
attack_rules.xml
openbsd_rules.xml
clam_av_rules.xml
bro-ids_rules.xml
dropbear_rules.xml
local_rules.xml
79200
/etc,/usr/bin,/usr/sbin
/bin,/sbin
/etc/mtab
/etc/mnttab
/etc/hosts.deny
/etc/mail/statistics
/etc/random-seed
/etc/adjtime
/etc/httpd/logs
/etc/utmpx
/etc/wtmpx
/etc/cups/certs
/etc/dumpdates
/etc/svc/volatile
C:\WINDOWS/System32/LogFiles
C:\WINDOWS/Debug
C:\WINDOWS/WindowsUpdate.log
C:\WINDOWS/iis6.log
C:\WINDOWS/system32/wbem/Logs
C:\WINDOWS/system32/wbem/Repository
C:\WINDOWS/Prefetch
C:\WINDOWS/PCHEALTH/HELPCTR/DataColl
C:\WINDOWS/SoftwareDistribution
C:\WINDOWS/Temp
C:\WINDOWS/system32/config
C:\WINDOWS/system32/spool
C:\WINDOWS/system32/CatRoot
/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_debian_linux_rcl.txt
/var/ossec/etc/shared/cis_rhel_linux_rcl.txt
/var/ossec/etc/shared/cis_rhel5_linux_rcl.txt
#
# 10.0.0.1
# 514
#
# Format of alert output. The default format is “default”, or full syslog output.
# CEF is the ArcSight Common Event Format.
# json can be used with a variety of tools.
# The splunk option is for sending data to a Splunk server.
# Allowed default, cef, splunk, json
# default
#
yes
1
7
syslog
/var/log/auth.log
syslog
/var/log/syslog
syslog
/var/log/dpkg.log
apache
/var/log/apache2/error.log
apache
/var/log/apache2/access.log
command
df -h
full_command
netstat -tan |grep LISTEN |grep -v 127.0.0.1 | sort
full_command
last -n 5
==== Agent configuration (Debian) ====
SERVER-IP
79200
/etc,/usr/bin,/usr/sbin
/bin,/sbin
/etc/mtab
/etc/mnttab
/etc/hosts.deny
/etc/mail/statistics
/etc/random-seed
/etc/adjtime
/etc/httpd/logs
/etc/utmpx
/etc/wtmpx
/etc/cups/certs
/etc/dumpdates
/etc/svc/volatile
C:\WINDOWS/System32/LogFiles
C:\WINDOWS/Debug
C:\WINDOWS/WindowsUpdate.log
C:\WINDOWS/iis6.log
C:\WINDOWS/system32/wbem/Logs
C:\WINDOWS/system32/wbem/Repository
C:\WINDOWS/Prefetch
C:\WINDOWS/PCHEALTH/HELPCTR/DataColl
C:\WINDOWS/SoftwareDistribution
C:\WINDOWS/Temp
C:\WINDOWS/system32/config
C:\WINDOWS/system32/spool
C:\WINDOWS/system32/CatRoot
/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_debian_linux_rcl.txt
/var/ossec/etc/shared/cis_rhel_linux_rcl.txt
/var/ossec/etc/shared/cis_rhel5_linux_rcl.txt
syslog
/var/log/messages
syslog
/var/log/auth.log
syslog
/var/log/syslog
syslog
/var/log/mail.info
syslog
/var/log/dpkg.log
command
df -h
full_command
netstat -tan |grep LISTEN |grep -v 127.0.0.1 | sort
full_command
last -n 5