20.06.2015 Views

Building Collector Plugins 1.1 - AlienVault

Building Collector Plugins 1.1 - AlienVault

Building Collector Plugins 1.1 - AlienVault

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Building</strong> <strong>Collector</strong> <strong>Plugins</strong> - Admin Guide<br />

5.2.5 Restart “rsyslog”<br />

opensourcesim:~# /etc/init.d/rsyslogd restart<br />

5.2.6 Check whether the new entries are written in the new log file<br />

opensourcesim:/etc/ossim/agent/plugins# tail -f /var/log/last_logon.log<br />

Jul 14 19:38:49 dmz01 LOGON_EXAMPLE: > root pts/2 localhost Wed Jul 14 19:38 still logged in<br />

Jul 14 19:38:54 dmz01 LOGON_EXAMPLE: > root pts/2 localhost Wed Jul 14 19:38 - 19:38 (00:00)<br />

Jul 14 19:38:59 dmz01 LOGON_EXAMPLE: > ossim pts/2 localhost Wed Jul 14 19:38 still logged in<br />

Jul 14 19:40:51 dmz01 LOGON_EXAMPLE: > ossim pts/2 localhost Wed Jul 14 19:38 - 19:40 (00:01)<br />

Jul 14 20:15:09 dmz01 LOGON_EXAMPLE: > reboot system boot 2.6.31.6 Wed Jul 14 17:39 - 20:15 (02:35)<br />

5.2.7 Create a plugin file<br />

Copy an existing plugin to build the new one on the existing structure<br />

opensourcesim:/etc/ossim/agent/plugins# cp syslog.cfg example.cfg<br />

Set the new plugin specific parameters<br />

;; <strong>Building</strong> <strong>Plugins</strong> Example<br />

;; plugin_id: 9001<br />

;; type: detector<br />

[DEFAULT]<br />

plugin_id=9001<br />

[config]<br />

type=detector<br />

enable=yes<br />

source=log<br />

# Enable syslog to log everything to one file. Add it to log rotation also.<br />

# echo "*.* /var/log/all.log" >> /etc/syslog.conf; killall -HUP syslogd<br />

#location=/var/log/all.log<br />

location=/var/log/last_logon.log<br />

# create log file if it does not exists,<br />

# otherwise stop processing this plugin<br />

create_file=true<br />

process=<br />

start=no<br />

stop=no<br />

startup=<br />

shutdown=<br />

## rules<br />

[Rule 01 - Console Session Open]<br />

# Jul 14 20:36:47 dmz01 LOGON_EXAMPLE: > root tty1 Wed Jul 14 20:36 still logged in<br />

event_type=event<br />

regexp="^(?P(\S+\s+\d+\s+\d\d:\d\d:\d\d)\s+(?P[^\s]+)\s+LOGON_EXAMPLE:<br />

>\s+(?P[^\s]+)\s+(?Ptty\d+)\s+(?P.*still logged in.*))$"<br />

sensor=\_CFG(plugin-defaults,sensor)<br />

Page 26 Copyright © Alienvault 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!