Monday, September 17, 2007

Upgrading Snort

Upgrading Snort is not really that difficult of a procedure, the basics are:
  1. Stop the current snort running
    • Backup the current snort installation
    • mv /usr/local/snort /usr/local/snort.old
  2. Configure Snort
    • ./configure --prefix=/usr/local/snort
  3. Compile & Install
    • make; make install
  4. Now, I usually copy the old configuration files to the new installations.
  5. Run the rc scripts and BAM! good as gold.
Except when you go from such an old version, you will get the following error:

FATAL ERROR: database: The underlying database seems to be running an older version of the DB schema (current version=106, required minimum version= 107). If you have an existing database with events logged by a previous version of snort, this database must first be upgraded to the latest schema (see the snort-users mailing list archive or DB plugin documention for details). If migrating old data is not desired, merely create a new instance of the snort database using the appropriate DB creation script (e.g. create_mysql, create_postgresql, create_oracle, create_mssql) located in the contrib\ directory. See the database documentation for cursory details (doc/README.database). and the URL to the most recent database plugin documentation.

The problem we run into, is that the new version of Snort requires an upgrade to the Database schema. Now, the readme in the distro will point you to the scripts included in the distro's contrib directory. These will build a new snort database.

The problem is that I have 90 days worth of events I don't want to loose. So, the question how to change the schema without loosing the data. The answer is to simply:
  1. ALTER TABLE signature ADD sig_gid INT UNSIGNED;
    • This is the only addition needed by the new version of snort.
  2. INSERT INTO schema (vseq, ctime) VALUES ('107', now());
    • Snort queries the schema version when it starts to make sure the DB is compatible.
  3. DELETE from schema where vseq=;
    • Now we need to remove the previous version from the table
Now, restart Snort...and everything should come up fine.

2 comments:

Anonymous said...

Hey,

I keep coming to this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Lots of good information here bookmarklust.blogspot.com. I am sure due to busy scedules we really do not get time to care about our health. Let me show you one truth. Recent Research displays that about 90% of all U.S. adults are either fat or overweight[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Therefore if you're one of these citizens, you're not alone. Infact many among us need to lose 10 to 20 lbs once in a while to get sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? You can easily lose with with little effort. You need to improve some of you daily habbits to achive weight loss in short span of time.

About me: I am webmaster of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also mentor who can help you lose weight quickly. If you do not want to go under painful training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effective weight loss.

Unknown said...

CONFIRMED.. THIS does not work... database: mysql_error: Duplicate entry '0' for key 1 is what I get