From aldeid
Jump to navigation Jump to search


PulledPork is a rule manager for Snort and Suricata. It will help automatizing the process of downloading and installing/updating your VRT Snort rules, SharedObject rules or Emerging Threats rules.

Pulledpork features include:

  • Automatic rule downloads using your Oinkcode
  • MD5 verification prior to downloading new rulesets
  • Full handling of Shared Object (SO) rules
  • Generation of so_rule stub files
  • Modification of ruleset state (disabling rules, etc)

The project is run by JJ Cummings of Sourcefire.



Install these dependencies:

# apt-get install perl subversion

Install dependencies via CPAN:

# perl -MCPAN -e 'install Crypt::SSLeay'
# perl -MCPAN -e 'install LWP::Simple'

or via packages:

# aptitude install libcrypt-ssleay-perl
# aptitude install liblwp-protocol-https-perl

Installation of PulledPork

From Subversion repository

This is the recommended method since it will ensure you have last version.

$ cd /data/src/
$ svn checkout http://pulledpork.googlecode.com/svn/trunk/ pulledpork-read-only

Copy necessary files:

$ cd /data/src/pulledpork-read-only/
# cp pulledpork.pl /usr/local/bin/
# mkdir -p /usr/local/etc/pulledpork/
# cp etc/* /usr/local/etc/pulledpork/

Make pulledpork executable:

# chmod +x /usr/local/bin/pulledpork.pl

From tarball

Download and uncompress:

$ cd /data/src/
$ wget http://pulledpork.googlecode.com/files/pulledpork-0.6.1.tar.gz
$ tar xzvf pulledpork-0.6.1.tar.gz

Copy necessary files:

$ cd /data/src/pulledpork-0.6.1/
# cp pulledpork.pl /usr/local/bin/
# mkdir -p /usr/local/etc/pulledpork/
# cp etc/* /usr/local/etc/pulledpork/

Make pulledpork executable:

# chmod +x /usr/local/bin/pulledpork.pl


Now that we have copied all configuration files in /usr/local/etc/pulledpork/, we must at least configure pulledpork.conf.

Edit the configuration file:

$ sudo vim /usr/local/etc/pulledpork/pulledpork.conf

Provide pulledpork with a URLs depending on your needs (VRT Snort rules and EmergingThreats rules, free and commercial editions). Notice that there is a special configuration for SO rules, that will be explained further in the configuration file.

# get the rule docs!
# THE FOLLOWING URL is for etpro downloads, note the tarball name change!
# and the et oinkcode requirement!
rule_url=https://rules.emergingthreats.net/|etpro.rules.tar.gz|<et oinkcode>

Specify the path of your rules:


If you are running local rules, uncomment this and update the path:


Specify the path where to place map files:

# Where should I put the sid-msg.map file?
# Where do you want me to put the sid changelog?  This is a changelog
# that pulledpork maintains of all new sids that are imported

Everything that follows only concerns SharedObject (SO) rules. If you don't use them, comment out all of these lines.

# What path you want the .so files to actually go to *i.e. where is it
# defined in your snort.conf, needs a trailing slash

# Path to the snort binary, we need this to generate the stub files

# We need to know where your snort.conf file lives so that we can
# generate the stub files

# This is the file that contains all of the shared object rules that pulledpork
# has processed, note that this has changed as of 0.4.0 just like the rules_path!

# Define your distro, this is for the precompiled shared object libs!
# Valid Distro Types=Debian-Lenny, Ubuntu-6.01.1, Ubuntu-8.04
# CentOS-4.6, Centos-4-8, CentOS-5.0, Centos-5-4
# FC-5, FC-9, FC-11, FC-12, RHEL-5.0
# FreeBSD-6.3, FreeBSD-7-2, FreeBSD-7-3, FreeBSD-7.0, FreeBSD-8-0, FreeBSD-8-1
# OpenSUSE-11-3



$ ./pulledpork.pl [options]


-b <path_to_dropsid.conf>
Where the dropsid config file lives.
-C <path_to_snort.conf>
Path to your snort.conf
-c <config_file>
Where the pulledpork config file lives.
-D <distro>
What Distro are you running on, for the so_rules
Valid Distro Types:
  • Debian-Lenny, Ubuntu-6.01.1, Ubuntu-8.04
  • CentOS-4.6, Centos-4-8, CentOS-5.0, Centos-5-4
  • FC-5, FC-9, FC-11, FC-12, RHEL-5.0
  • FreeBSD-6.3, FreeBSD-7-2, FreeBSD-7-3, FreeBSD-7.0, FreeBSD-8-0, FreeBSD-8-1
Do not verify signature of rules tarball, i.e. downloading fron non VRT or ET locations.
Write ONLY the enabled rules to the output files.
-e <path_to_enablesid.conf>
Where the enablesid config file lives.
Grabonly (download tarball rule file(s) and do NOT process)
Send a SIGHUP to the pids listed in the config file
-h <path_to_changelog>
path to the sid_changelog if you want to keep one?
Print this help info.
-I <security|connectivity|balanced>
Specify a base ruleset( -I security,connectivity,or balanced, see README.RULESET)
-i <path_to_disablesid.conf>
Where the disablesid config file lives.
-K <directory for separate rules files>
Where (what directory) do you want me to put the separate rules files?
Keep the rules in separate files (using same file names as found when reading)
-L <path_to_local.rules>
Where do you want to read your local.rules for inclusion in sid-msg.map
Log Important Info to Syslog (Errors, Successful run etc, all items logged as WARN or higher)
-M <path to modifysid.conf>
Where the modifysid config file lives.
-m <path_to_sid-msg.map>
Where do you want to put the sid-msg.map file?
Do everything other than download of new files (disablesid, etc)
-O <oinkcode>
What is your Oinkcode?
-o <rule_output_path>
Where do you want to put generic rules file?
-p <path_to_snort>
Path to your Snort binary
When processing enablesid, return the rules to their ORIGINAL state
-r <path to docs folder>
Where do you want to put the reference files (xxxx.txt)
-S <SnortVer>
What version of snort are you using (2.8.6 or 2.9.0) are valid values
-s <so_rule output directory>
Where do you want to put the so_rules?
Process text based rules files only, i.e. DO NOT process so_rules
-t <sostub output path>
Where do you want to put the so_rule stub files?
Thus MUST be uniquely different from the -o option value
-u <path_to_rules_tarball>
Where do you want to pull the rules tarball from (ET, Snort.org, see pulledpork config rule_url option for value ideas)
Print Version and exit
Verbose mode, you know.. for troubleshooting and such nonsense.
EXTRA Verbose mode, you know.. for in-depth troubleshooting and other such nonsense.

Usage Example

Provided you have entered all necessary parameters in /usr/local/etc/pulledpork/pulledpork.conf file, the simplest usage can be as follows:

$ perl /usr/local/bin/pulledpork.pl \
  -c /usr/local/etc/pulledpork/pulledpork.conf \
  -o /usr/local/etc/snort/rules/snort.rules

If you have any error, please refer to this section.

Automatize Pulledpork

Edit your crontab:

$ crontab -e

And add following line (the example automatically checks for the presence of new rules every day at 2:30am):

30 2 * * * /usr/bin/perl /usr/local/bin/pulledpork.pl \
           -c /usr/local/etc/pulledpork/pulledpork.conf \
           -o /usr/local/etc/snort/rules/snort.rules


403 error

If you have such an error, just wait 15 minutes and try again:

A 403 error occurred, please wait for the 15 minute timeout
to expire before trying again or specify the -n runtime switch
You may also wish to verfiy your oinkcode, tarball name, and other
configuration options

500 error

If you have such an error while issuing the command with the -vv parameter:

500 Can't connect to www.snort.org:443 (Crypt-SSLeay can't verify hostnames

Then add this environment variable:

export HTTPS_CA_DIR=/usr/share/ca-certificates/