<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Configure_Snort_to_Log_Packets_to_MySQL</id>
	<title>Configure Snort to Log Packets to MySQL - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Configure_Snort_to_Log_Packets_to_MySQL"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Configure_Snort_to_Log_Packets_to_MySQL&amp;action=history"/>
	<updated>2026-05-18T15:06:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Configure_Snort_to_Log_Packets_to_MySQL&amp;diff=5180&amp;oldid=prev</id>
		<title>PeterHarding: Created page with &quot;Vincent Danen, TechRepublic    Last week, we looked at setting up Snort (http://cgi.cnet.com.au/link/?id=22018), a Network Intrusion Detection System. Now we will look at conf...&quot;</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Configure_Snort_to_Log_Packets_to_MySQL&amp;diff=5180&amp;oldid=prev"/>
		<updated>2021-10-16T19:21:35Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Vincent Danen, TechRepublic    Last week, we looked at setting up Snort (http://cgi.cnet.com.au/link/?id=22018), a Network Intrusion Detection System. Now we will look at conf...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Vincent Danen, TechRepublic&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last week, we looked at setting up Snort&lt;br /&gt;
(http://cgi.cnet.com.au/link/?id=22018), a Network Intrusion Detection&lt;br /&gt;
System. Now we will look at configuring Snort to log packets to a remote&lt;br /&gt;
MySQL server where a graphical Web interface can be used to view captured&lt;br /&gt;
packets and statistics.&lt;br /&gt;
&lt;br /&gt;
To begin with, on the MySQL server, the database must be created. In this&lt;br /&gt;
scenario, the Snort server is &amp;quot;snort.host&amp;quot; and the MySQL server is&lt;br /&gt;
&amp;quot;mysql.host&amp;quot;. Connect to the database as root:&lt;br /&gt;
&lt;br /&gt;
# mysql -u root -p&lt;br /&gt;
&lt;br /&gt;
mysql&amp;gt; create database snort;&lt;br /&gt;
&lt;br /&gt;
mysql&amp;gt; grant INSERT,SELECT,UPDATE,CREATE,DELETE,EXECUTE on snort.* to&lt;br /&gt;
snort@snort.host;&lt;br /&gt;
&lt;br /&gt;
mysql&amp;gt; set password for snort@snort.host=PASSWORD(\&amp;#039;snortpass\&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
mysql&amp;gt; flush privileges;&lt;br /&gt;
&lt;br /&gt;
mysql&amp;gt; q&lt;br /&gt;
&lt;br /&gt;
With the Snort documentation comes a file called create_mysql, which has&lt;br /&gt;
the schema for the database. On a typical Linux install, this file would&lt;br /&gt;
be found in /usr/share/doc/snort-[version]/create_mysql. Load this file as&lt;br /&gt;
root:&lt;br /&gt;
&lt;br /&gt;
# mysql -u root -p snort &amp;lt;/usr/share/doc/snort-doc/create_mysql&lt;br /&gt;
&lt;br /&gt;
Next, on the system where Snort will be running, edit the&lt;br /&gt;
/etc/snort/snort.conf configuration file and tell it to log to the&lt;br /&gt;
database:&lt;br /&gt;
&lt;br /&gt;
output database: log, mysql, user=snort password=snortpass dbname=snort&lt;br /&gt;
host=mysql.host&lt;br /&gt;
&lt;br /&gt;
Finally, make sure that /etc/snort/snort.conf is mode 0640 and owned&lt;br /&gt;
root:snort:&lt;br /&gt;
&lt;br /&gt;
# chown root:snort /etc/snort/snort.conf&lt;br /&gt;
&lt;br /&gt;
# chmod 0640 /etc/snort/snort.conf&lt;br /&gt;
&lt;br /&gt;
The next step is to start Snort; a supplied initscript will start Snort&lt;br /&gt;
monitoring or you can launch it to the background:&lt;br /&gt;
&lt;br /&gt;
# /usr/sbin/snort -c /etc/snort/snort.conf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Starting Snort once without sending it to the background is a good idea to&lt;br /&gt;
ensure the connection takes. You can also look on the MySQL server to&lt;br /&gt;
ensure that logging is active:&lt;br /&gt;
&lt;br /&gt;
# echo &amp;quot;SELECT hostname FROM sensor;&amp;quot; | mysql -u root -p snort&lt;br /&gt;
&lt;br /&gt;
The IP address that Snort is listening on should be displayed. Now that&lt;br /&gt;
Snort is logging data to MySQL, using BASE Basic Analysis and Security&lt;br /&gt;
Engine (http://base.secureideas.net/) is a great way to view the data via&lt;br /&gt;
a Web interface. BASE requires a Web server and PHP. Once you have&lt;br /&gt;
unarchived it where it needs to be, copy the base_conf.php.dist file to&lt;br /&gt;
base_conf.php and edit it, in particular, setting the $alert_dbname and&lt;br /&gt;
related variables to point to the Snort log database.&lt;br /&gt;
&lt;br /&gt;
You will also want to add a snort@localhost user with privileges to the&lt;br /&gt;
MySQL database if you did not do so earlier (i.e., if your Snort and MySQL&lt;br /&gt;
servers are physically separate).&lt;br /&gt;
&lt;br /&gt;
Once that is done, navigate to the BASE install that you just set up and&lt;br /&gt;
follow the instructions presented to set up the caching table for BASE.&lt;br /&gt;
When that is complete, BASE is now available to view and graph the logged&lt;br /&gt;
Snort data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Technet]]&lt;br /&gt;
[[Category:Whitepapers]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>