Since dec 2006
1'942'871 Visitors
4'218'042 Pages

Nov 2010 Stats
82'909 Visitors
146'476 Pages
196 countries
Full statistics

Help us translate
our tutorials!

JOIN the
OpenManiak Team.
Blaise Carrera
Tutorials creation:
Blaise Carrera
Giovanni Fredducci
Angel Chraniotis
Moham. H. Karvan
Alexandro Silva
Blaise Carrera
Andrei Chertolyas
Sergiy Uvarov
Nickola Kolev
Łukasz Nowatkowski
Ivo Raisr
Catalin Bivolaru
Bogdan A. Costea
Kirill Simonov
Oliver Mucafir
JaeYoung Jeon
Seungyoon Lee
Jie Yu & Si Cheng
Tao Wei
Fumihito Yoshida
Muhammad Takdir
Çağdaş Tülek
Leslie Luthi
Joe Anderson
Jennifer Ockwell
Nigel Titley
Alison Rees
Blaise Carrera
SNORT_INLINE - The Easy Tutorial - Oinkmaster & The Snort rules

Snort_Inline Snort rules
Last Change : Jun 25 2007 french flagenglish flag


Details What is Snort_Inline?
Oinkmaster - Snort Rules
Oinkmaster - Bleeding Rules
Run Snort_Inline

Please check our page about COVID-19!!
100 Questions and answers about Coronavirus.

Merci de consulter notre page sur la COVID-19 !!
227 questions et réponses sur le Coronavirus.

Once Snort_Inline is installed, you need to install the Snort signature rules and keep them up-to-date.
By chance, there is a perl script that will give us some very useful help: Oinkmaster.

#apt-get install oinkmaster
Install or update the rules.
To download the Snort rules, we need to create a free account on the Snort website.
The Snort rules are made by Sourcefire and you can get them for free a few days after the commercial subscription release.

Once you are logged into your Snort account, you can get a code at the bottom of the page.

snort snort_inline website oinkmaster code
We need this code in the /etc/oinkmaster.conf file.

Modify the "url" settings in the /etc/oinkmaster.conf file as below:

url =
Then we need to change the Snort alert type. So, always in the /etc/oinkmaster.conf file, add the following line:

modifysid * "^alert" | "drop"
Let's create a backup folder.

#mkdir /etc/snort_inline/backup
Let's now update the rules. We must be careful not to run oinkmaster as root particularly if you are not in a test environment.
So let's add a user called oinkmaster.

#useradd oinkmaster
Change some permissions to let oinkmaster user run the Oinkmaster software:

#chown -R oinkmaster /etc/snort_inline/backup
#chown -R oinkmaster /etc/snort_inline/rules
#chown -R oinkmaster /var/run/oinkmaster
#chmod 644 /etc/snort_inline/snort_inline.conf
Now, it's time to test the Oinkmaster perl script under the oinkmaster user.

#su oinkmaster
oinkmaster#oinkmaster -o /etc/snort_inline/rules -b /etc/snort_inline/backup 2>&1
The last instruction means that we call the Oinkmaster perl script, we put the new rules in the /etc/snort_inline/rules folder and, if there is a change in the new rules, the current /etc/snort_inline/rules will be backed up in the /etc/snort_inline/backup folder.

Here is an example of our backup folder after running Oinkmaster:

#dir /etc/snort_inline/backup

The crontab
Since we are quite lazy, we don't want to manually run this script every day.
A little cron job will help us.

#crontab -e -u oinkmaster
30 00 * * * oinkmaster -o /etc/snort_inline/rules -b /etc/snort_inline/backup 2>&1 >> /dev/null 2>&1
This will update the rules each day at 00:30
(The crontab command will update the /var/spool/cron/crontabs/oinkmaster file)

crontab -e will open Nano by default. If you want to open vi instead just type:
#export EDITOR=vi