(System Event Correlator)

There is a nice two-part article on SEC which describes how it works and what it provides. I encourage you to look it over.

The latest distribution can be found on SourceForge at SEC at SourceForge.

The homepage also has pointers to information.

SEC is very simple to setup and is really just a Perl script. The distribution includes example startup files for various common UNIX flavors.

We run it as a separate service on which reads from the syslog-ng output pipe at /var/log/sec. The tricky part about SEC is getting the right configuration files (rulesets) configured for your needs. Fortunately there is a community repository of rulesets that make it much easier to find and customize rules for your SEC installation.

Installation on ATGRID

First thing to do was to download and unpack the gzipped tarball. I copied the to /usr/local/bin/ and renamed the file to, gzipped it and copied it to /usr/share/man/man1/ so that man works.

The startup script in the contrib area was copied to /etc/init.d/sec, made executable ('chmod a+x') and edited to work with our setup. The changes are shown here:
[atgrid:contrib]# diff /etc/init.d/sec ./startup.redhat
<         if [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sec ; then
>         if [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensors ; then
<         if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sec ; then
>         if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sensors ; then
<         [ -e /var/lock/subsys/sec ] && restart || :
>         [ -e /var/lock/subsys/sensors ] && restart || :
< # Config to monitor output of AGLT2 syslog-ng
< -detach -conf=/usr/local/etc/sec/*.sec -input=/var/log/sec -log=/var/log/sec.log
> # Config to monitor local1
> -detach -conf=/usr/local/etc/sec/local1.sec -input=/var/log/local1 -log=/var/log/sec.log

NOTE: the 'service sec status' command is broken because the script was copied from an lm_sensors example script. This needs fixing.

The already existing /var/log/sec file on atgrid was just a regular file. I stopped syslog-ng, removed the existing /var/log/sec, created a new pipe via 'mkfifo /var/log/sec' and restarted syslog-ng.

Configuration of SEC

This task is the most critical part of getting SEC setup on AGLT2. As you can see from the init script above, we use all SEC configuration files found at /usr/local/etc/sec/*.sec.

Since we are running SNORT I grabbed an example ruleset for it. The list of examples rulesets I got from the community repository is:

The basic changes to the above scripts were to substitute for any destination email address and to replace any occurence of mail or mailx commands with the specific command /bin/mail.

As of January 28th around 1 PM Eastern the script was running on atgrid and processing the output of syslog-ng. You can check status and output by looking at /var/log/sec.log.

-- ShawnMcKee - 28 Jan 2009
Topic revision: r1 - 28 Jan 2009, ShawnMcKee
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback