<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Information Security, Privacy and Regulatory Compliance - Intrusion Detection</title>
    <link>http://keithpachulski.securitytactics.com/</link>
    <description>Keith A. Pachulski - http://keithpachulski.securitytactics.com</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    <pubDate>Mon, 02 Aug 2010 13:07:14 GMT</pubDate>

    <image>
        <url>http://keithpachulski.securitytactics.com/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Information Security, Privacy and Regulatory Compliance - Intrusion Detection - Keith A. Pachulski - http://keithpachulski.securitytactics.com</title>
        <link>http://keithpachulski.securitytactics.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>BART (Basic Audit and Reporting Tool) on Solaris 10/OpenSolaris</title>
    <link>http://keithpachulski.securitytactics.com/index.php?/archives/36-BART-Basic-Audit-and-Reporting-Tool-on-Solaris-10OpenSolaris.html</link>
            <category>Intrusion Detection</category>
            <category>System Administration</category>
            <category>System Hardening</category>
    
    <comments>http://keithpachulski.securitytactics.com/index.php?/archives/36-BART-Basic-Audit-and-Reporting-Tool-on-Solaris-10OpenSolaris.html#comments</comments>
    <wfw:comment>http://keithpachulski.securitytactics.com/wfwcomment.php?cid=36</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://keithpachulski.securitytactics.com/rss.php?version=2.0&amp;type=comments&amp;cid=36</wfw:commentRss>
    

    <author>nospam@example.com (Keith Pachulski)</author>
    <content:encoded>
    As a follow-up to a conversation regarding this; BART is one of those integrated features that is often overlooked in the Solaris 10/OpenSolaris distributions. BART at it&#039;s core function similar to other host file integrity check systems. While it is a nice tool for small shops, it is by no means well suited for large scale deployments. For mid to large scale system integrity verification and host level intrusion detection/prevention systems I`m of course still an advocate of OSSEC&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt;. For clarification, BART only performs file integrity checking and does not monitor log files or system processes etc...&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Creating the BART Manifest&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
This would be an example of a simple manifest recording the attributes of all files within the /etc, /boot, /sbin and /usr directories and generate an md5 hash for each file.&lt;br /&gt;
&lt;br /&gt;
bart create -R /etc /boot /sbin /usr &gt; /bart/control&lt;br /&gt;
&lt;br /&gt;
Included in the control file would contain single line entries for each file, link, etc&lt;br /&gt;
&lt;br /&gt;
/X11/fontpath.d/misc:unscaled:pri=15 L 35 120777 - 4c50ebb0 0 0 ../../../usr/X11/lib/X11/fonts/misc&lt;br /&gt;
/X11/gdm/Init/Default F 2640 100755 owner@::deny,owner@:read_data/write_data/append_data/write_xattr/execute/write_attributes/write_&lt;br /&gt;
acl/write_owner:allow,group@:write_data/append_data:deny,group@:read_data/execute:allow,everyone@:write_data/append_data/write_xattr&lt;br /&gt;
/write_attributes/write_acl/write_owner:deny,everyone@:read_data/read_xattr/execute/read_attributes/read_acl/synchronize:allow 4a0c3&lt;br /&gt;
e11 0 3 bf7503995330dc79b078bdba2171d657&lt;br /&gt;
&lt;br /&gt;
Each line will contain a notation defining what each entry is, these are as follows:&lt;br /&gt;
&lt;br /&gt;
# Format:&lt;br /&gt;
#fname D size mode acl dirmtime uid gid&lt;br /&gt;
#fname P size mode acl mtime uid gid&lt;br /&gt;
#fname S size mode acl mtime uid gid&lt;br /&gt;
#fname F size mode acl mtime uid gid contents&lt;br /&gt;
#fname L size mode acl lnmtime uid gid dest&lt;br /&gt;
#fname B size mode acl mtime uid gid devnode&lt;br /&gt;
#fname C size mode acl mtime uid gid devnode&lt;br /&gt;
&lt;br /&gt;
- B for a block device node&lt;br /&gt;
- C for a character device node&lt;br /&gt;
- D for a directory&lt;br /&gt;
- F for a file&lt;br /&gt;
- L for a symbolic link&lt;br /&gt;
- P for a pipe&lt;br /&gt;
- S for a socket&lt;br /&gt;
&lt;br /&gt;
Further available attributes are as follows:&lt;br /&gt;
&lt;br /&gt;
size - File size in bytes.&lt;br /&gt;
mode - Octal number that represents the permissions of the file.&lt;br /&gt;
acl - ACL attributes for the file. For a file with ACL attributes, this contains the output from acltotext().&lt;br /&gt;
uid - Numerical user ID of the owner of this entry.&lt;br /&gt;
gid - Numerical group ID of the owner of this entry.&lt;br /&gt;
dirmtime - Last modification time, in seconds, since 00:00:00 UTC, January 1, 1970, for directories.&lt;br /&gt;
lnmtime - Last modification time, in seconds, since 00:00:00 UTC, January 1, 1970, for links.&lt;br /&gt;
mtime - Last modification time, in seconds, since 00:00:00 UTC January 1, 1970, for files.&lt;br /&gt;
contents - Checksum value of the file. This attribute is only specified for regular files. If you turn off context checking, or if checksums cannot be computed, the value of this field is –.&lt;br /&gt;
dest - Destination of a symbolic link.&lt;br /&gt;
devnode - Value of the device node. This attribute is for character device files and block device files only.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Create the diff manifest and check for changes&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
To verify BART is functioning correctly, we&#039;ll create a test file in the /etc directory&lt;br /&gt;
&lt;br /&gt;
keithp@opensolaris:/bart# touch /etc/thisisatest&lt;br /&gt;
&lt;br /&gt;
Once the test file has been created we now need to run BART again to generate the differential manifest&lt;br /&gt;
&lt;br /&gt;
keithp@opensolaris:/bart# bart create -R /etc /boot /sbin /usr &gt; /bart/control-diff&lt;br /&gt;
&lt;br /&gt;
After the diff manifest has generated, we then verify that any changes that have occurred, as well as checking for the test file being created.&lt;br /&gt;
&lt;br /&gt;
keithp@opensolaris:/bart# bart compare control control-diff &gt; bart-modifications&lt;br /&gt;
keithp@opensolaris:/bart# more bart-modifications &lt;br /&gt;
/thisisatest:&lt;br /&gt;
  add&lt;br /&gt;
&lt;br /&gt;
The test file we created was detected. No other modifications were found. The downside to BART is that if any changes were discovered that were legitimate. BART does not automatically update the control file. The control-diff would now become the primary file from which future checks are performed against. To automate the BART checks, add a cronjob to perform the creation of the new differential file as well as performing the compare jobs.&lt;br /&gt;
&lt;br /&gt;
0 7,14,21 &lt;strong&gt; &lt;/strong&gt; bart create -R /etc /boot /sbin /usr &gt; /bart/control-diff&lt;br /&gt;
30 7,14,21 &lt;strong&gt; &lt;/strong&gt; bart compare control control-diff &gt; bart-modifications&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Centralized BART Monitoring&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
With some creativity, through the NFS/automount, you can create a hub and spoke type design where the spoke systems individually create the control and diff files. The control files can be moved to the central server and the diff files remain on the spoke systems. Additional cronjobs would be created that would compare the manifest on the central server to the diff manifest located on the spoke systems. Bearing in mind of course that NFS is not encrypted by default but with some simple tweaks you can implement service level encryption to secure the NFS traffic between the central and spoke systems. But again, why recreate the wheel?&lt;br /&gt;
&lt;br /&gt;
Again, it&#039;s nice to tinker with or act as a second line of auditing. But I would strongly urge a system like OSSEC be implemented to perform the centralized monitoring and reporting.  
    </content:encoded>

    <pubDate>Fri, 30 Jul 2010 23:57:08 -0400</pubDate>
    <guid isPermaLink="false">http://keithpachulski.securitytactics.com/index.php?/archives/36-guid.html</guid>
    
</item>
<item>
    <title>OSSEC - Part 2 - The OSSEC Configuration (ossec.conf)</title>
    <link>http://keithpachulski.securitytactics.com/index.php?/archives/22-OSSEC-Part-2-The-OSSEC-Configuration-ossec.conf.html</link>
            <category>Intrusion Analysis</category>
            <category>Intrusion Detection</category>
            <category>Regulatory Compliance</category>
    
    <comments>http://keithpachulski.securitytactics.com/index.php?/archives/22-OSSEC-Part-2-The-OSSEC-Configuration-ossec.conf.html#comments</comments>
    <wfw:comment>http://keithpachulski.securitytactics.com/wfwcomment.php?cid=22</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://keithpachulski.securitytactics.com/rss.php?version=2.0&amp;type=comments&amp;cid=22</wfw:commentRss>
    

    <author>nospam@example.com (Keith Pachulski)</author>
    <content:encoded>
    In previous posts we&#039;ve reviewed the basic server and client configuration as well as how to, using the external parser, insert the alerts into BASE. At this point we&#039;re going to delve a bit deeper into the server side configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Email Alerting&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
This is really personal preference, if you like receiving a ton of email with events that are also being inserted into the database, feel free to make use of this.&lt;br /&gt;
&lt;br /&gt;
At the top of the ossec&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt; configuration file located in /var/ossec/etc/ossec.conf, the first container specifies what types of alerts you want to receive as well as where the you want the specified alerts being sent to. This container may already be populated if you enabled email notification during setup.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;global&amp;gt;&lt;br /&gt;
    &amp;lt;email_notification&amp;gt;yes&amp;lt;/email_notification&amp;gt;&lt;br /&gt;
    &amp;lt;email_to&amp;gt;you@yourdomain.com&amp;lt;/email_to&amp;gt;&lt;br /&gt;
    &amp;lt;smtp_server&amp;gt;someserverhere&amp;lt;/smtp_server&amp;gt;&lt;br /&gt;
    &amp;lt;email_from&amp;gt;ossecm@yourdomain.com&amp;lt;/email_from&amp;gt;&lt;br /&gt;
  &amp;lt;/global&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While this is the base configuration, there are a few additional options you may want to use here.&lt;br /&gt;
&lt;br /&gt;
Enable throttling, this is highly recommended. If the systems you are monitoring become targeted by a high rate attack and ossec is configured to generate an email on every alarm. You can effectively cause a denial of service condition on your own systems. This is set with the following:&lt;br /&gt;
&lt;br /&gt;
- &amp;lt;email_maxperhour&amp;gt;X&amp;lt;/email_maxperhour&amp;gt; &lt;br /&gt;
&lt;br /&gt;
X would be the maximum number of emails that ossec will generate in a given hour. Keep in mind, by setting this option, if you are relying on email alerts you may miss events with the high level threshold you set. The events are queued however once they reach the X limit you set, the queue is cleared 20 alerts at a time until cleared.&lt;br /&gt;
&lt;br /&gt;
In addition to the global email alerting, we can also create targeted email groups based on server names, as they have been named when the client was configured when using ./manage_agents&lt;br /&gt;
&lt;br /&gt;
&amp;lt;email_alerts&amp;gt;&lt;br /&gt;
 &amp;lt;email_to&amp;gt;null@protectors.cc&amp;lt;/email_to&amp;gt;&lt;br /&gt;
 &amp;lt;event_location&amp;gt;servers1|server2&amp;lt;/event_location&amp;gt;&lt;br /&gt;
&amp;lt;/email_alerts&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Tweaking the email alerts&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
The default email alert configuration within OSSEC&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt; is as follows:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;alerts&amp;gt;&lt;br /&gt;
    &amp;lt;log_alert_level&amp;gt;1&amp;lt;/log_alert_level&amp;gt;&lt;br /&gt;
    &amp;lt;email_alert_level&amp;gt;7&amp;lt;/email_alert_level&amp;gt;&lt;br /&gt;
  &amp;lt;/alerts&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The alert levels are based on severity of the events ranging from 0 to 15. With 0 being information and 15 being high severity. The alert levels themselves are defined within the ossec rule files located in /var/ossec/rules. When modifying this log and email alert levels, ensure events you deem as important are not going to be missed during this tuning process. An example of the alert level in an ossec definition would be as follows:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;rule id=&quot;12109&quot; &amp;lt;strong&amp;gt;level=&quot;12&quot;&amp;lt;/strong&amp;gt;&amp;gt;&lt;br /&gt;
    &amp;lt;if_sid&amp;gt;12100&amp;lt;/if_sid&amp;gt;&lt;br /&gt;
    &amp;lt;match&amp;gt;exiting (due to fatal error)&amp;lt;/match&amp;gt;&lt;br /&gt;
    &amp;lt;description&amp;gt;Named fatal error. DNS service going down.&amp;lt;/description&amp;gt;&lt;br /&gt;
    &amp;lt;group&amp;gt;service_availability,&amp;lt;/group&amp;gt;&lt;br /&gt;
  &amp;lt;/rule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, OSSEC will log all events level 1 and higher. Level 0 alerts are those that we have defined that we are not interested in being reported on. In the above example of email_alert_level, only events level 7 or higher would generate email alerts. This is only applicable if you have enabled email alerting that is.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Receiving and Processing Alerts from Remote System/Devices&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
With this portion, we are concerned with the receipt and processing of events from remote systems. We will receive these events in one of two manners. The first is syslog being configured on the remote device to send events to the OSSEC server, these will typically be networking devices or servers with syslog support. The second method is using the ossec agent on a remote system to send log events via a secure channel to the ossec server.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Configuring Standard Syslog and OSSEC to Monitor&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
In this example, we have our OSSEC server also running as a central log collector. All events received from remote system are received on Local6.info and are inserted into /var/log/messages.&lt;br /&gt;
&lt;br /&gt;
The typical syslog configuration will appear as follows in /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
local6.* /var/log/messages&lt;br /&gt;
&lt;br /&gt;
For the OSSEC configuration on the server, we define the following:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;localfile&amp;gt;&lt;br /&gt;
    &amp;lt;log_format&amp;gt;syslog&amp;lt;/log_format&amp;gt;&lt;br /&gt;
    &amp;lt;location&amp;gt;/var/log/messages&amp;lt;/location&amp;gt;&lt;br /&gt;
  &amp;lt;/localfile&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, on networking equipment such as switches and routers, we need to define the logging facility and host to log events to. The following would be an example for a Cisco Router:&lt;br /&gt;
&lt;br /&gt;
logging facility local6&lt;br /&gt;
logging source-interface &amp;lt;interface facing the ossec server&amp;gt;&lt;br /&gt;
logging &amp;lt;ip address of the ossec server&amp;gt;&lt;br /&gt;
do wr&lt;br /&gt;
exit&lt;br /&gt;
&lt;br /&gt;
As long as syslog is correctly configured on the server, messages from the device will begin to populate the /var/log/messages file. To start OSSEC processing the events, restart ossec after adding the above (note: /var/log/messages is typically added to most configuration by default on linux based systems).&lt;br /&gt;
&lt;br /&gt;
OSSEC has the ability to monitor several including syslog, snort, squid, IIS, Windows event logs, mysql, postgresql and apache. However, the important thing to to remember with OSSEC is that the log formatting is completely customizable and can support nearly any type of logging.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Syscheck Configuration Options&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
My typical Linux syscheck template is along these lines depending on the installation and the purpose of the server:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syscheck&amp;gt;&lt;br /&gt;
    &amp;lt;frequency&amp;gt;14400&amp;lt;/frequency&amp;gt;&lt;br /&gt;
    &amp;lt;directories realtime=&quot;yes&quot; &amp;gt;/var/www&amp;lt;/directories&amp;gt;&lt;br /&gt;
    &amp;lt;directories check_all=&quot;yes&quot;&amp;gt;/opt,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin,/sbin,/boot,/etc,/home&amp;lt;/directories&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;alert_new_files&amp;gt;yes&amp;lt;/alert_new_files&amp;gt;&lt;br /&gt;
    &amp;lt;scan_on_start&amp;gt;no&amp;lt;/scan_on_start&amp;gt;&lt;br /&gt;
    &amp;lt;auto_ignore&amp;gt;no&amp;lt;/auto_ignore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- Files/directories to ignore --&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/mtab&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/mnttab&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/hosts.deny&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/mail/statistics&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/random-seed&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/adjtime&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/httpd/logs&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/utmpx&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/wtmpx&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/cups/certs&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/dumpdates&amp;lt;/ignore&amp;gt;&lt;br /&gt;
    &amp;lt;ignore&amp;gt;/etc/svc/volatile&amp;lt;/ignore&amp;gt;&lt;br /&gt;
  &amp;lt;/syscheck&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Breaking this down piece by piece; when we specify the directory to monitor we have the following options available to us:&lt;br /&gt;
&lt;br /&gt;
- realtime - provides realtime monitoring of the specified directories&lt;br /&gt;
- check_all -  performs all of the below checks on the specified directories&lt;br /&gt;
- check_sum - checks for changes to the md5/sha1 hash of the files&lt;br /&gt;
- check_size - checks for changes to the sizes of the files&lt;br /&gt;
- check_owner - check for changes to the owner of the files&lt;br /&gt;
- check_group - check for changes to the group ownership&lt;br /&gt;
- check_perm - check for changes to the permissions&lt;br /&gt;
&lt;br /&gt;
It would be my recommendation that either check_all by the default with realtime as the alternate option for those highly critical directories.&lt;br /&gt;
&lt;br /&gt;
Frequency defines the amount of time, in seconds, that OSSEC will fire to perform the checks on the specified directories. Makes sure to tune this to an acceptable level. While 100 seconds may seem sexy, it&#039;s not realistic and may end up crushing your servers.&lt;br /&gt;
&lt;br /&gt;
Alert_new_files - by default this is  not in the configuration. I strongly recommend this be added and set to yes. When ossec makes its run, anything new it finds it will generate an alarm on, otherwise you`ll never know when someone uploads the c99.php file if you&#039;re not doing realtime checking of /var/www/html&lt;br /&gt;
&lt;br /&gt;
Scan_on_start - by default this is set to yes, I would recommend this be set to no and let it run on against the frequency setting. I`m not sure if its a feature of a bug but on some rare occasions when I&#039;ve restarted ossec it&#039;s caused scans an hosts to restart and when making several changes to the local_rules and restarting several times..it brought a system to a dead halt for a short time period.&lt;br /&gt;
&lt;br /&gt;
auto_ignore - by default this is set to yes, this meaning after the 3rd time the file has changed in some way and you have not acknowledged the change it will simply ignore it. Not the best approach in my opinion for a noisy system that requires monitoring.&lt;br /&gt;
&lt;br /&gt;
As for the ignores, those are some general noisy files, feel free to add more to the list as you see fit.&lt;br /&gt;
&lt;br /&gt;
Additional options include scanning specific directories on certain days or at specific times if you do not want to rely on the general frequency directive.&lt;br /&gt;
&lt;br /&gt;
scan_day - specifies the day or days you want the scan to run (scan_day sunday, wednesday, friday)&lt;br /&gt;
&lt;br /&gt;
scan_time - specifies the time of the day you want the scan to run ( scan_time 12pm)&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Ignoring sub-directories with syscheck&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
There may be on occasion you want to monitor for example /var/www/html and all directories contained with it, but you do not want to monitor sarg/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;directories check_all=&quot;yes&quot;&amp;gt;/var/www/html&amp;lt;directories&amp;gt;&lt;br /&gt;
&amp;lt;ignore&amp;gt;/var/www/html/sarg&amp;lt;/ignore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will effectively ignore all files and directories contained within the /var/www/html/sarg directory.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Rootcheck Configuration Options&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Again, my typical linux template..feel free to customize it as you see fit Something to bear in mind though, the rootcheck portion can be very resource intensive. This module will scan the entire operating system by default looking for both rootkits as well as common system configuration issues. While I personally let it scan the entire system, it can be disabled with the scanall no option.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;rootcheck&amp;gt;&lt;br /&gt;
    &amp;lt;frequency&amp;gt;86400&amp;lt;/frequency&amp;gt;&lt;br /&gt;
    &amp;lt;rootkit_files&amp;gt;/var/ossec/etc/shared/rootkit_files.txt&amp;lt;/rootkit_files&amp;gt;&lt;br /&gt;
    &amp;lt;rootkit_trojans&amp;gt;/var/ossec/etc/shared/rootkit_trojans.txt&amp;lt;/rootkit_trojans&amp;gt;&lt;br /&gt;
    &amp;lt;system_audit&amp;gt;/var/ossec/etc/shared/system_audit_rcl.txt&amp;lt;/system_audit&amp;gt;&lt;br /&gt;
    &amp;lt;system_audit&amp;gt;/var/ossec/etc/shared/cis_rhel5_linux_rcl.txt&amp;lt;/system_audit&amp;gt;&lt;br /&gt;
  &amp;lt;/rootcheck&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Frequency I define as daily, and as I use CentOS5 I leave in the rhel5 file and remove the cis_rhel_linux_rcl.txt. If you are running a non 5 release, feel free to add or replace cis_rhel_linux_rcl.txt as needed.&lt;br /&gt;
&lt;br /&gt;
While most of this specifically addresses the server side configuration, the syscheck, rootcheck, and localfile parameters are portable to the client side ossec.conf configuration files.&lt;br /&gt;
&lt;br /&gt;
Going to wrap it up with this, next section will likely be on OSSEC Reporting as I&#039;m on a reporting and metrics kick as of late..&lt;br /&gt;
&lt;br /&gt;
Any questions feel free to shoot me an email..  
    </content:encoded>

    <pubDate>Mon, 24 May 2010 20:16:00 -0400</pubDate>
    <guid isPermaLink="false">http://keithpachulski.securitytactics.com/index.php?/archives/22-guid.html</guid>
    
</item>
<item>
    <title>Integrating OSSEC into BASE</title>
    <link>http://keithpachulski.securitytactics.com/index.php?/archives/11-Integrating-OSSEC-into-BASE.html</link>
            <category>Intrusion Analysis</category>
            <category>Intrusion Detection</category>
            <category>Regulatory Compliance</category>
    
    <comments>http://keithpachulski.securitytactics.com/index.php?/archives/11-Integrating-OSSEC-into-BASE.html#comments</comments>
    <wfw:comment>http://keithpachulski.securitytactics.com/wfwcomment.php?cid=11</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://keithpachulski.securitytactics.com/rss.php?version=2.0&amp;type=comments&amp;cid=11</wfw:commentRss>
    

    <author>nospam@example.com (Keith Pachulski)</author>
    <content:encoded>
    This is the quick and dirty for integrating OSSEC&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt; alerting into BASE so you can have your snort and OSSEC alerts alarms residing in the same interface.&lt;br /&gt;
&lt;br /&gt;
Install snort and BASE, if you`re not sure how to do this refer to the previous posting on this topic &lt;a href=&quot;http://keithpachulski.securitytactics.com/index.php?/archives/12-Quick-Reference-Guide-Snort-and-BASE-Installation-and-Setup.html&quot; title=&quot;Snort/BASE&quot; target=&quot;_blank&quot;&gt;found here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Once you have snort and base installed, have imported the sql schema&#039;s for both snort and acid, import the OSSEC schema into the snort and snort_archive databases; the mysql schema files for ossec&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt; can be found in the contrib directory:&lt;br /&gt;
&lt;br /&gt;
# mysql -u snort &lt; ossec2mysql.sql snort&lt;br /&gt;
# mysql -u snort &lt; ossec2mysql.sql snort_archive&lt;br /&gt;
&lt;br /&gt;
Move the following three files from the contrib directory to /usr/local/bin/&lt;br /&gt;
&lt;br /&gt;
# mv ossec2mysql.pl /usr/local/bin/&lt;br /&gt;
# mv ossec2mysqld.pl /usr/local/bin/&lt;br /&gt;
# mv compile_alerts.pl /usr/local/bin/&lt;br /&gt;
&lt;br /&gt;
Modify ossec2mysql.conf adding the correct database information, chmod the file 600, chown the file root.root then move it to /etc/&lt;br /&gt;
&lt;br /&gt;
If you do not already have a signatures directory under BASE, create it now (I`ll be bringing this up again during the initial snort/BASE install for those who do not have it yet).&lt;br /&gt;
&lt;br /&gt;
# mkdir /var/www/html/secure/base/signatures &amp;&amp;amp; chown apache.apache /var/www/html/secure/base/signatures&lt;br /&gt;
&lt;br /&gt;
At this point you want to import all current OSSEC alarms into the snort database which BASE is querying from:&lt;br /&gt;
&lt;br /&gt;
# zcat /var/ossec/logs/alerts/2010/Feb/ossec-alerts-*.gz | /usr/local/bin/ossec2mysql.pl --conf /etc/ossec2mysql.conf --interface manualfeed&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve imported all the current events manually into the snort database, launch the ossec process to continuously monitor and import OSSEC events into the snort database:&lt;br /&gt;
&lt;br /&gt;
# /usr/local/bin/ossec2mysqld.pl --conf /etc/ossec2mysql.conf -d&lt;br /&gt;
&lt;br /&gt;
Now log into BASE and you should have all your archived OSSEC alerts, as well as all future alarms being inserted into BASE.  
    </content:encoded>

    <pubDate>Thu, 25 Feb 2010 22:21:00 -0500</pubDate>
    <guid isPermaLink="false">http://keithpachulski.securitytactics.com/index.php?/archives/11-guid.html</guid>
    
</item>
<item>
    <title>Introduction to OSSEC - Server/Client and OSSEC WUI</title>
    <link>http://keithpachulski.securitytactics.com/index.php?/archives/13-Introduction-to-OSSEC-ServerClient-and-OSSEC-WUI.html</link>
            <category>Intrusion Analysis</category>
            <category>Intrusion Detection</category>
            <category>Regulatory Compliance</category>
    
    <comments>http://keithpachulski.securitytactics.com/index.php?/archives/13-Introduction-to-OSSEC-ServerClient-and-OSSEC-WUI.html#comments</comments>
    <wfw:comment>http://keithpachulski.securitytactics.com/wfwcomment.php?cid=13</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://keithpachulski.securitytactics.com/rss.php?version=2.0&amp;type=comments&amp;cid=13</wfw:commentRss>
    

    <author>nospam@example.com (Keith Pachulski)</author>
    <content:encoded>
    In this episode we&#039;ll be reviewing the OSSEC&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt; Host Intrusion Detection System (HIDS&lt;sup&gt;&lt;span title=&quot;host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt;). We will cover the basic steps to installing and configuring both the server and client applications. Additionally, we&#039;ll be covering installing and configuring the OSSEC Web User Interface (WUI). We will not be covering how to integrate OSSEC into the BASE management console. That will be addressed in another blog post, to be released shortly.&lt;br /&gt;
&lt;br /&gt;
OSSEC, for those of you who aren&#039;t aware of what it is exactly, is a software based system that monitors the host operating system. Like traditional integrity check based systems (tripwire, aide, osiris), ossec&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt; performs file and user/group monitoring. One of the major differences between OSSEC and other traditional systems, is that OSSEC can perform the monitoring in real time on designated files and directories. In addition to the file monitoring capabilities, OSSEC has the ability to monitor the registry on Windows systems for alteration to registry keys.&lt;br /&gt;
&lt;br /&gt;
OSSEC also monitors log files in real time, this functionality is typically referred to as a Log Based Intrusion Detection (LIDS&lt;sup&gt;&lt;span title=&quot;log based intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt;) system. The LIDS portion of the application is enabled by default as part of the basic server and client installation. OSSEC exports the client system logs to the central OSSEC server via a secure channel. The server OSSEC then analyzes all entries for questionable entries or known designated &quot;bad&quot; entries.  This includes Windows Security, Event and Application logs, IIS logs, database logs, Apache, SQUID, firewalls, routers, switches, snort as well as a slew of others. For a complete list of &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.ossec.net/wiki/Supported-Logs&#039;]);&quot;  href=&quot;http://www.ossec.net/wiki/Supported-Logs&quot; title=&quot;all supported log files&quot; target=&quot;_blank&quot;&gt;all supported log files&lt;/a&gt; please see the OSSEC list, bearing in mind however that you can use the generic module to inspect log files or create your own to monitor custom log files. In addition to monitoring for known and questionable &quot;bad&quot; traffic, it will also generate alarms for anything it does not understand or underlying operating system errors such as process failures, disk full errors, raid failures to name but a few.&lt;br /&gt;
&lt;br /&gt;
But wait...there&#039;s more..&lt;br /&gt;
&lt;br /&gt;
In the typical OSSEC installation, as with most traditional file integrity check based systems, you need to install some type of agent on the client systems. OSSEC has a very useful feature for those systems which may not support a client to be installed. For these you can utilize the agentless configuration for monitoring virtually any type of system, be it a Cisco ASA firewall or an OS/400 system.&lt;br /&gt;
&lt;br /&gt;
The entire OSSEC system is extremely flexible.&lt;br /&gt;
&lt;br /&gt;
In all examples from this point forward, I am basing the installation of both the client and server on the CentOS 5 operating system. The basic setup and design however is generally the same on all *nix based systems. I am also basing the installation on the current version of OSSEC which is v2.3 as of the time I&#039;m writing this. When doing the installation yourself, you may want to refer to the ossec.net website if you are unable to retrieve the packages using the links I&#039;ve provided.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Log Samples for various OSSEC Alerts&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;New User logging into the system&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
** Alert 1267052622.246237:	 mail  - syslog,fts,authentication_success&lt;br /&gt;
2010 Feb 24 18:03:42 keithpachulski -&gt; /var/log/secure&lt;br /&gt;
Rule: 10100 (level 4) -&gt; &#039;First time user logged in.&#039;&lt;br /&gt;
Src IP: (71.185.192.3)&lt;br /&gt;
User: bernie&lt;br /&gt;
Feb 24 18:03:41 keithpachulski sshd[9304]: Accepted password for&lt;br /&gt;
bernie from 71.185.192.3 port 57905 ssh2&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;Yum updates on the system&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
** Alert 1266983791.268245:	 mail  - syslog,yum,config_changed,&lt;br /&gt;
2010 Feb 23 22:56:31 keithpachulski -&gt; /var/log/messages&lt;br /&gt;
Rule: 2933 (level 7) -&gt; &#039;Yum package updated.&#039;&lt;br /&gt;
Src IP: (0.0.0.0)&lt;br /&gt;
User: (none)&lt;br /&gt;
Feb 23 22:56:31 keithpachulski yum: Updated:&lt;br /&gt;
systemtap-runtime-0.9.7-5.el5_4.1.i386&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;Douchebags attempting directory traversal attacks on my server and failing&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
** Alert 1267064964.272533:	 - web,accesslog,attack,&lt;br /&gt;
2010 Feb 24 21:29:24 keithpachulski -&gt; /var/log/httpd/access_log&lt;br /&gt;
Rule: 31104 (level 6) -&gt; &#039;Common web attack.&#039;&lt;br /&gt;
Src IP: (195.93.200.219)&lt;br /&gt;
User: (none)&lt;br /&gt;
195.93.200.219 - - [24/Feb/2010:21:29:23 -0500] &quot;GET&lt;br /&gt;
/%22%20%20target=%22_blank/index.php?option=com_communitypolls&amp;controller=./../../../../../../../../proc/self/environ%00&lt;br /&gt;
HTTP/1.1&quot; 404 235 &quot;-&quot; &quot;-&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Obtain the OSSEC application and the OSSEC WUI&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
$ wget http://www.ossec.net/files/ossec-hids-2.3.tar.gz&lt;br /&gt;
$ wget http://www.ossec.net/files/ui/ossec-wui-0.3.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Untar both the ossec-hids and ossec-wui packages&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
$ tar zxvf ossec-wui-0.3.tar.gz &amp;&amp;amp; tar -zxvf ossec-hids-2.3.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Install the OSSEC HIDS application&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
$ cd ossec-hids-2.3&lt;br /&gt;
$ su &lt;enter your root password&gt; or sudo ./install.sh&lt;br /&gt;
$ Select [en] as the default language&lt;br /&gt;
&lt;br /&gt;
Hit -Enter- after the install script displays the host information&lt;br /&gt;
&lt;br /&gt;
1- What kind of installation do you want (server, agent, local or help)?&lt;br /&gt;
&lt;br /&gt;
Enter &quot;server&quot;&lt;br /&gt;
&lt;br /&gt;
2- Setting up the installation environment.&lt;br /&gt;
&lt;br /&gt;
 - Choose where to install the OSSEC HIDS [/var/ossec]: &lt;br /&gt;
&lt;br /&gt;
Leave it as the default /var/ossec by selecting [Enter]&lt;br /&gt;
&lt;br /&gt;
3- Configuring the OSSEC HIDS.&lt;br /&gt;
&lt;br /&gt;
  3.1- Do you want e-mail notification? (y/n) [y]: &lt;br /&gt;
&lt;br /&gt;
If you want OSSEC to send you emails on alert, select y - if you do not want it to send you emails on alerts select n&lt;br /&gt;
&lt;br /&gt;
If you select yes, you&#039;ll be prompted for your email server information.&lt;br /&gt;
&lt;br /&gt;
  3.2- Do you want to run the integrity check daemon? (y/n) [y]: &lt;br /&gt;
&lt;br /&gt;
Select y as the default as we want the server and agent processes to perform file integrity checking.&lt;br /&gt;
&lt;br /&gt;
  3.3- Do you want to run the rootkit detection engine? (y/n) [y]: &lt;br /&gt;
&lt;br /&gt;
Select y as the default as we want the server and agent processes to check for known malicious software and perform basic checks on our application installations.&lt;br /&gt;
&lt;br /&gt;
  3.4- Active response allows you to execute a specific &lt;br /&gt;
       command based on the events received. For example,&lt;br /&gt;
       you can block an IP address or disable access for&lt;br /&gt;
       a specific user.  &lt;br /&gt;
       More information at:&lt;br /&gt;
       http://www.ossec.net/en/manual.html#active-response&lt;br /&gt;
       &lt;br /&gt;
   - Do you want to enable active response? (y/n) [y]:&lt;br /&gt;
&lt;br /&gt;
If you want the OSSEC software to actively respond to suspected intrusion, enable this. Otherwise select n for it to operate in a passive monitoring and reporting mode.&lt;br /&gt;
&lt;br /&gt;
  3.5- Do you want to enable remote syslog (port 514 udp)? (y/n) [y]: &lt;br /&gt;
&lt;br /&gt;
Enter n here (entering n assumes you already have syslog listening for remote entries - check your syslog conf to be sure), later on in the configuration we&#039;ll be specifying the syslog files we want OSSEC to monitor on both the server and client installations.&lt;br /&gt;
&lt;br /&gt;
After entering y or n on the last entry, OSSEC will scan all default log locations for all system log files and automagically begin tailing those files. While OSSEC tails the files, it will be comparing all entries against known malicious or questionable traffic patterns being entered into the logs.&lt;br /&gt;
&lt;br /&gt;
If there are additional logs you want monitored, simply modify the ossec.conf file after the installation has completed. We&#039;ll cover this more later.&lt;br /&gt;
&lt;br /&gt;
Once the installation has completed, you&#039;ll need to modify the default configuration file to reflect your system configuration and remove some unnecessary lines from the configuration.&lt;br /&gt;
&lt;br /&gt;
If you installed OSSEC to the default location, the configuration file can be found in /var/ossec/etc&lt;br /&gt;
&lt;br /&gt;
To view my sample server configuration template for OSSEC running on CentOS5 or RHEL5, &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/projects.securitytactics.com/boards/1/topics/8&#039;]);&quot;  href=&quot;http://projects.securitytactics.com/boards/1/topics/8&quot; title=&quot;CentOS5/RHEL5 Server Configuration Template&quot; target=&quot;_blank&quot;&gt;go here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The above configuration will enable the following options:&lt;br /&gt;
- file integrity checks to be performed on the server every 14400 seconds&lt;br /&gt;
- file integrity checks for all files located in the following location:&lt;br /&gt;
-- &amp;lt;directories check_all=&quot;yes&quot;&amp;gt;/bin,/usr/bin,/usr/local/bin,/usr/local/sbin,/sbin,/boot,/etc,/home&amp;lt;/directories&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The check_all options tells OSSEC to watch all attributes of the file including permission, owner, group etc. There is an additional option to continuously, in real-time, monitor the specific file or directory by using the &quot;realtime&quot; option.&lt;br /&gt;
&lt;br /&gt;
-- &amp;lt;directories realtime=&quot;yes&quot; check_all=&quot;yes&quot;&amp;gt;/bin,/usr/bin,/usr/local/bin,/usr/local/sbin,/sbin,/boot,/etc,/home&amp;lt;/directories&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other optional fields that are recommended to add are as follows:&lt;br /&gt;
&lt;br /&gt;
- alert_new_files: This is not a default option and designates that when new files are created, OSSEC will generate alerts for each new file created. This option should be set to &quot;yes&quot;.&lt;br /&gt;
&lt;br /&gt;
- scan_on_start: This option should be disabled. It can be disabled by setting the field to &quot;no&quot;. If this option is not disabled, each time OSSEC is restarted on the system, OSSEC will rescan the entire file system.&lt;br /&gt;
&lt;br /&gt;
- auto_ignore: By default OSSEC will auto-ignore files that change often and are not acknowledged. In certain environments, this type of behavior is not acceptable and this should be disabled. Disabling this option is accomplished by setting the field to &quot;no&quot;.&lt;br /&gt;
&lt;br /&gt;
Rootkit checks and system audits, I perform every 86400 seconds. This can be tuned to whatever value you are comfortable with. Bear in mind however that the rootkit and system level audit checks can be resource intensive.&lt;br /&gt;
&lt;br /&gt;
Once the server configuration has been completed, start the OSSEC process: /var/ossec/bin/ossec-control start&lt;br /&gt;
&lt;br /&gt;
With the OSSEC server portion operating, we will configure the OSSEC WUI before moving onto installing, configuring and integrating a client into the OSSEC syste,&lt;br /&gt;
&lt;u&gt;&lt;br /&gt;
Installing and Configuring the OSSEC WUI&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
As root, move, rename and change the owner/group of the ossec-wui-0.3 directory as follows:&lt;br /&gt;
&lt;br /&gt;
# mv ossec-wui-0.3 /var/www/html/ossec &amp;&amp;amp; chown -R ossec.ossec /var/www/html/ossec&lt;br /&gt;
#cd /var/www/html/ossec&lt;br /&gt;
&lt;br /&gt;
Run the setup script in the ossec directory:&lt;br /&gt;
&lt;br /&gt;
# ./setup.sh&lt;br /&gt;
&lt;br /&gt;
Afer entering the requested information during the setup.sh script execution, add the &quot;user&quot; apache runs as to the ossec group&lt;br /&gt;
&lt;br /&gt;
#usermod -G ossec apache&lt;br /&gt;
&lt;br /&gt;
Modify the permission on the tmp/ directory in the ossec directory to allow apache to access the contents of tmp&lt;br /&gt;
&lt;br /&gt;
# chmod 770 /var/www/html/ossec/tmp &amp;&amp;amp; chgrp apache /var/www/html/ossec/tmp&lt;br /&gt;
&lt;br /&gt;
Restart Apache&lt;br /&gt;
&lt;br /&gt;
By default, OSSEC will authenticate access to the OSSEC directory using Basic htaccess authentication. If you have BASE installed and want to use MySQL authentication from the BASE system, modify the .htaccess directory to use the following:&lt;br /&gt;
&lt;br /&gt;
AuthName &quot;Access Restricted to Authorized Users Only&quot;&lt;br /&gt;
AuthType Basic&lt;br /&gt;
AuthMySQLEnable on&lt;br /&gt;
AuthMySQLHost localhost &lt;br /&gt;
AuthMySQLUser snort&lt;br /&gt;
AuthMySQLPassword (yoursnortMySQLpasswordhere)&lt;br /&gt;
AuthMySQLDB snort&lt;br /&gt;
AuthMySQLUserTable base_users&lt;br /&gt;
AuthMySQLNameField usr_login&lt;br /&gt;
AuthMySQLPasswordField usr_pwd&lt;br /&gt;
AuthMySQLPwEncryption md5&lt;br /&gt;
require valid-user&lt;br /&gt;
&lt;br /&gt;
Authenticating users from the BASE MySQL table will allow you to permit access to everyone who has access to the BASE console access to OSSEC, without the need for continuously modifying the .htpasswd file each time you want to add a new user.&lt;br /&gt;
&lt;br /&gt;
The OSSEC WUI configuration is now completed, you should now be able to access it via your web broswer by going to https://ipofserver/ossec&lt;br /&gt;
&lt;br /&gt;
-- Note: If you don&#039;t have this running under HTTPS, it would be in your best interest to do so.&lt;br /&gt;
&lt;br /&gt;
At this point, you should have the OSSEC server operating as well as the OSSEC WUI, we will now add our first client to the system.&lt;br /&gt;
&lt;br /&gt;
Installing the client is exactly the same except that instead of installing it as a server, we&#039;ll be installing it as an agent.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Installing the OSSEC Client&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
$ tar -zxvf ossec-hids-2.3.tar.gz&lt;br /&gt;
$ cd ossec-hids-2.3&lt;br /&gt;
&lt;br /&gt;
su to root to install the software and modify the configuration&lt;br /&gt;
&lt;br /&gt;
# ./install.sh&lt;br /&gt;
&lt;br /&gt;
Select en as the default language and enter agent for the install type.&lt;br /&gt;
&lt;br /&gt;
Once you enter agent, take the default installation location which will be /var/ossec&lt;br /&gt;
&lt;br /&gt;
You will then be asked for the IP address of the OSSEC HIDS Server, enter it and hit enter&lt;br /&gt;
&lt;br /&gt;
3- Configuring the OSSEC HIDS.&lt;br /&gt;
&lt;br /&gt;
  3.1- What&#039;s the IP Address of the OSSEC HIDS server?:&lt;br /&gt;
&lt;br /&gt;
  3.2- Do you want to run the integrity check daemon? (y/n) [y]: &lt;br /&gt;
&lt;br /&gt;
Accept the default of &quot;y&quot; here&lt;br /&gt;
&lt;br /&gt;
  3.3- Do you want to run the rootkit detection engine? (y/n) [y]: &lt;br /&gt;
&lt;br /&gt;
Accept the default of &quot;y&quot; here&lt;br /&gt;
&lt;br /&gt;
  3.4 - Do you want to enable active response? (y/n) [y]: &lt;br /&gt;
&lt;br /&gt;
Select &quot;n&quot; here, at this point OSSEC will now install the agent application on the system.&lt;br /&gt;
&lt;br /&gt;
As with the server side installation, the ossec configuration file needs to be modified. I have made a template available for *nix based systems available by clicking &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/projects.securitytactics.com/boards/1/topics/6&#039;]);&quot;  href=&quot;http://projects.securitytactics.com/boards/1/topics/6&quot; title=&quot;*nix based ossec client template&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve completed the client side configuration we now need to add the client to the server configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Introducing the Client to the Server&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
All communications between the client and server are encrypted. If for whatever reason the communication path between the client and server becomes interrupted, the client side will queue messages until the server becomes reachable again. At which time it will export all queued messages to the server.&lt;br /&gt;
&lt;br /&gt;
On the server we first need to add the client system, export the encryption key for the client, then restart the ossec process. This all needs to be performed as root or via sudo, whichever method you typically use.&lt;br /&gt;
&lt;br /&gt;
# cd /var/ossec/bin&lt;br /&gt;
# ./manage_agents&lt;br /&gt;
&lt;br /&gt;
Select &quot;A&quot; to add an agent&lt;br /&gt;
- enter the name of the agent&lt;br /&gt;
- enter the ip of the agent&lt;br /&gt;
- accept the default value for the ID&lt;br /&gt;
&lt;br /&gt;
Select &quot;E&quot; to extract the key&lt;br /&gt;
- enter the ID of the system&lt;br /&gt;
&lt;br /&gt;
Copy the entire key, if any portion of the key is missing, the client will not be able to connect to the server.&lt;br /&gt;
&lt;br /&gt;
Exit from the manage_agents application and restart OSSEC&lt;br /&gt;
&lt;br /&gt;
# /var/ossec/bin/ossec-control restart&lt;br /&gt;
&lt;br /&gt;
On the client, run the manage_agents application. Unlike the server, you will only have the option to import a key via &quot;I&quot; on the client.&lt;br /&gt;
&lt;br /&gt;
Once you enter the IP and paste in the key, exit from the manage_agents application and start the ossec application:&lt;br /&gt;
&lt;br /&gt;
# /var/ossec/bin/ossec-control start&lt;br /&gt;
&lt;br /&gt;
As long as the agent and the server have a clear communication path, the client will begin its first operating system integrity, audit and rootkit checks as well as beginning to export all system logs designated in the client OSSEC configuration file to the server.&lt;br /&gt;
&lt;br /&gt;
To add more systems, simply repeat the &quot;Installing the OSSEC Client&quot; and &quot;Introducing the Client to the Server&quot; steps.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all for now folks...check back soon for &quot;How to Integrate OSSEC into BASE&quot;  
    </content:encoded>

    <pubDate>Fri, 19 Feb 2010 22:35:28 -0500</pubDate>
    <guid isPermaLink="false">http://keithpachulski.securitytactics.com/index.php?/archives/13-guid.html</guid>
    
</item>
<item>
    <title>Quick Reference Guide: Snort and BASE Installation and Setup</title>
    <link>http://keithpachulski.securitytactics.com/index.php?/archives/12-Quick-Reference-Guide-Snort-and-BASE-Installation-and-Setup.html</link>
            <category>Intrusion Analysis</category>
            <category>Intrusion Detection</category>
            <category>Regulatory Compliance</category>
    
    <comments>http://keithpachulski.securitytactics.com/index.php?/archives/12-Quick-Reference-Guide-Snort-and-BASE-Installation-and-Setup.html#comments</comments>
    <wfw:comment>http://keithpachulski.securitytactics.com/wfwcomment.php?cid=12</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://keithpachulski.securitytactics.com/rss.php?version=2.0&amp;type=comments&amp;cid=12</wfw:commentRss>
    

    <author>nospam@example.com (Keith Pachulski)</author>
    <content:encoded>
    This is the quick and dirty guide to compiling, configuring and installing snort to log to a mysql database, then installing BASE to view those alerts. We`ll be using this basic setup again later as we integrate OSSEC&lt;sup&gt;&lt;span title=&quot;open source security, host intrusion detection system&quot; class=&quot;serendipity_glossaryMarkup&quot;&gt;[?]&lt;/span&gt;&lt;/sup&gt; into BASE for centralized reporting of all network and host based intrusion alarms.&lt;br /&gt;
&lt;br /&gt;
For snort you&#039;ll need to obtain the following for this install:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/&quot; title=&quot;PCRE&quot; target=&quot;_blank&quot;&gt;PCRE&lt;/a&gt;&lt;br /&gt;
&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.tcpdump.org/&#039;]);&quot;  href=&quot;http://www.tcpdump.org/&quot; title=&quot;libpcap&quot; target=&quot;_blank&quot;&gt;libpcap&lt;/a&gt;&lt;br /&gt;
&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.snort.org/downloads&#039;]);&quot;  href=&quot;http://www.snort.org/downloads&quot; title=&quot;snort&quot; target=&quot;_blank&quot;&gt;snort&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Compiling and Installing PCRE&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
$ tar zxvf pcre-8.01.tar.gz&lt;br /&gt;
$ ./configure &amp;&amp;amp; make&lt;br /&gt;
&lt;br /&gt;
su to root and install: make install&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Compiling and Installing libpcap&lt;/u&gt;&lt;br /&gt;
$ tar zxvf libpcap-1.0.0.tar.gz &lt;br /&gt;
$ ./configure &amp;&amp;amp; make&lt;br /&gt;
&lt;br /&gt;
su to root and install: make install&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Compiling and Installing Snort&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
If possible, do not have the MySQL server running on the snort sensor server, the two functions should be seperated.&lt;br /&gt;
&lt;br /&gt;
$ tar zxvf snort-2.8.5.2.tar.gz&lt;br /&gt;
$ ./configure --with-mysql --enable-perfprofiling --enable-reload&lt;br /&gt;
&lt;br /&gt;
su to root and install: make install&lt;br /&gt;
&lt;br /&gt;
Create a new user for snort to run under, snort should NOT be run as root&lt;br /&gt;
&lt;br /&gt;
# useradd -c &quot;snort nids&quot; -s /sbin/nologin snort&lt;br /&gt;
&lt;br /&gt;
Create the directory to store the snort signature files&lt;br /&gt;
&lt;br /&gt;
# mkdir /home/snort/sigs&lt;br /&gt;
&lt;br /&gt;
Move the preprocessor rules to the snort directory&lt;br /&gt;
&lt;br /&gt;
[root@cent snort-2.8.5.2]# mv preproc_rules/ /home/snort/sigs/&lt;br /&gt;
&lt;br /&gt;
Move the snort init script and logrotate scripts to their correct locations&lt;br /&gt;
&lt;br /&gt;
# mv rpm/snortd /etc/rc.d/init.d/&lt;br /&gt;
# ln -s /etc/rc.d/init.d/snortd /etc/rc3.d/S99snort&lt;br /&gt;
# chmod 755 /etc/rc.d/init.d/snortd&lt;br /&gt;
# mv rpm/snort.logrotate /etc/logrotate.d/snort&lt;br /&gt;
# mv rpm/snort.sysconfig /etc/sysconfig/snort&lt;br /&gt;
# mv etc/snort.conf /home/snort/&lt;br /&gt;
# mv etc/&lt;strong&gt; /home/snort/sigs/&lt;br /&gt;
&lt;br /&gt;
Add the snort libraries to the ld.so.conf file and run ldconfig&lt;br /&gt;
&lt;br /&gt;
# echo /usr/local/lib/snort_dynamicrules &gt;&gt; /etc/ld.so.conf&lt;br /&gt;
# /usr/bin/ldconfig&lt;br /&gt;
&lt;br /&gt;
We&#039;ll come back configuring the rest of snort once we have BASE running&lt;br /&gt;
&lt;br /&gt;
Create the MySQL database to be used by snort for event logging, to be used later by BASE&lt;br /&gt;
&lt;br /&gt;
mysqladmin create snort&lt;br /&gt;
mysqladmin create snort_archive&lt;br /&gt;
&lt;br /&gt;
From the schema directory, execute the following:&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p &lt; create_mysql snort&lt;br /&gt;
mysql -u root -p &lt; create_mysql snort_archive&lt;br /&gt;
&lt;br /&gt;
Create the snort user and grant permissions on the snort.&lt;/strong&gt; and snort_archive.&lt;strong&gt; databases&lt;br /&gt;
&lt;br /&gt;
$ mysql -u root -p&lt;br /&gt;
mysql&gt; create user &#039;snort&#039;@&#039;localhost&#039; identified by &#039;password_goes_here&#039;;&lt;br /&gt;
mysql&gt; create user &#039;snort&#039;@&#039;ip_of_the_remote_snort_sensor&#039; identified by &#039;password_goes_here&#039;;&lt;br /&gt;
mysql&gt; grant CREATE,INSERT,SELECT,DELETE,UPDATE on snort.&lt;/strong&gt; to &#039;snort&#039;@&#039;localhost&#039;;&lt;br /&gt;
mysql&gt; grant CREATE,INSERT,SELECT,UPDATE on snort.&lt;strong&gt; to &#039;snort&#039;@&#039;ip_of_the_remote_snort_sensor&#039;;&lt;br /&gt;
mysql&gt; flush privileges;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Installing and Configuring BASE&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Upgrade pear and all installed pear packages, this will be needed for some of the BASE modules&lt;br /&gt;
&lt;br /&gt;
If php-gd is not installed, install it now&lt;br /&gt;
&lt;br /&gt;
yum install php-gd&lt;br /&gt;
&lt;br /&gt;
pear upgrade PEAR-1.x.x (whatever the most recent is)&lt;br /&gt;
pear install Image_Color&lt;br /&gt;
pear install --alldeps --force Log&lt;br /&gt;
pear install Numbers_Roman&lt;br /&gt;
pear install --alldeps --force Image_Graph-0.7.2&lt;br /&gt;
pear install --alldeps mail&lt;br /&gt;
pear upgrade-all&lt;br /&gt;
&lt;br /&gt;
Download and install &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/adodb.sourceforge.net/&#039;]);&quot;  href=&quot;http://adodb.sourceforge.net/&quot; title=&quot;adodb&quot; target=&quot;_blank&quot;&gt;adodb&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
$ tar zxvf adodb510.tgz &lt;br /&gt;
&lt;br /&gt;
su to root, change the owner and group then move to /var/www/&lt;br /&gt;
&lt;br /&gt;
# chown -R apache.apache adodb5/ &amp;&amp;amp; mv adodb5/ /var/www/&lt;br /&gt;
&lt;br /&gt;
Download and install &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/sourceforge.net/projects/secureideas/&#039;]);&quot;  href=&quot;http://sourceforge.net/projects/secureideas/&quot; title=&quot;BASE&quot; target=&quot;_blank&quot;&gt;BASE&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
$ tar zxvf base-1.4.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
su to root, change the owner and group then move to /var/www/html/&lt;br /&gt;
&lt;br /&gt;
# chown -R apache.apache base-1.4.4/ &amp;&amp;amp; mv base-1.4.4/ /var/www/html/base&lt;br /&gt;
&lt;br /&gt;
Modify php.ini to not expose php and set the error logging to the recommended level&lt;br /&gt;
&lt;br /&gt;
expose_php = Off&lt;br /&gt;
&lt;br /&gt;
error_reporting = E_ALL &amp;amp; ~E_NOTICE&lt;br /&gt;
&lt;br /&gt;
Modify the BASE configuration file to reflect the username, password and adodb location&lt;br /&gt;
&lt;br /&gt;
# cd /var/www/html/base&lt;br /&gt;
# cp base_conf.php.dist base_conf.php &amp;&amp;amp; chown apache.apache base_conf.php&lt;br /&gt;
&lt;br /&gt;
$BASE_urlpath = &#039;/base&#039;;&lt;br /&gt;
$DBlib_path = &#039;/var/www/adodb5&#039;;&lt;br /&gt;
$alert_dbname   = &#039;snort&#039;;&lt;br /&gt;
$alert_host     = &#039;localhost&#039;;&lt;br /&gt;
$alert_port     = &#039;&#039;;&lt;br /&gt;
$alert_user     = &#039;snort&#039;;&lt;br /&gt;
$alert_password = &#039;mypassword&#039;;&lt;br /&gt;
$archive_exists   = 1;&lt;br /&gt;
$archive_dbname   = &#039;snort_archive&#039;;&lt;br /&gt;
$archive_host     = &#039;localhost&#039;;&lt;br /&gt;
$archive_port     = &#039;&#039;;&lt;br /&gt;
$archive_user     = &#039;snort&#039;;&lt;br /&gt;
$archive_password = &#039;mypassword&#039;;&lt;br /&gt;
$refresh_all_pages = 1;&lt;br /&gt;
$show_previous_alert = 1;&lt;br /&gt;
$refresh_all_pages = 1;&lt;br /&gt;
$show_expanded_query = 1;&lt;br /&gt;
$colored_alerts = 1;&lt;br /&gt;
$IP2CC = &quot;/usr/bin/ip2cc&quot;;&lt;br /&gt;
&lt;br /&gt;
Make sure to set all the correct information in the SMTP portion of the configuration so you can email yourself or others copies of the alerts from BASE.&lt;br /&gt;
&lt;br /&gt;
Install the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/search.cpan.org/~abigail/Geography-Countries-2009041301/lib/Geography/Countries.pm&#039;]);&quot;  href=&quot;http://search.cpan.org/~abigail/Geography-Countries-2009041301/lib/Geography/Countries.pm&quot; title=&quot;Geography:Countries&quot; target=&quot;_blank&quot;&gt;Geography:Countries&lt;/a&gt; Perl module for map generation&lt;br /&gt;
&lt;br /&gt;
tar zxvf Geography-Countries-2009041301.tar.gz &amp;&amp;amp; cd Geography-Countries-2009041301&lt;br /&gt;
perl Makefile.PL &amp;&amp;amp; make&lt;br /&gt;
&lt;br /&gt;
su to root and install the perl module: make install&lt;br /&gt;
&lt;br /&gt;
Install the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/search.cpan.org/dist/IP-Country/&#039;]);&quot;  href=&quot;http://search.cpan.org/dist/IP-Country/&quot; title=&quot;IP-Country&quot; target=&quot;_blank&quot;&gt;IP-Country&lt;/a&gt; Perl module for map generation&lt;br /&gt;
&lt;br /&gt;
tar zxvf IP-Country-2.27.tar.gz &amp;&amp;amp; cd IP-Country-2.27&lt;br /&gt;
perl Makefile.PL &amp;&amp;amp; make&lt;br /&gt;
&lt;br /&gt;
Start apache:&lt;br /&gt;
&lt;br /&gt;
/etc/rc.d/init.d/httpd start&lt;br /&gt;
&lt;br /&gt;
Open your web browser and navigate to the BASE URL:&lt;br /&gt;
&lt;br /&gt;
http://ip.address.here/base&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve modified all fields correctly, you&#039;ll be presented with a page saying:&lt;br /&gt;
&lt;br /&gt;
&quot;The underlying database snort@localhost appears to be incomplete/invalid. &quot;&lt;br /&gt;
&lt;br /&gt;
Click the &quot;setup page&quot; link then click the Create BASE AG button.&lt;br /&gt;
&lt;br /&gt;
Click on the &quot;Main page&quot; link, click on the &quot;Use Archive Database&quot; link&lt;br /&gt;
&lt;br /&gt;
Click the &quot;setup page&quot; link then click the Create BASE AG button.&lt;br /&gt;
&lt;br /&gt;
Return to the primary database by clicking the &quot;Use Alert Database&quot; link.&lt;br /&gt;
&lt;br /&gt;
Now that snort is installed, the mysql schema for snort has been loaded and the ACID AG schema for base has been loaded, we return to the final portion of this which is finalizing the actual snort configuration file, loading the signatures and starting snort while logging alerts to the mysql database.&lt;br /&gt;
&lt;br /&gt;
Download the most recent &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.snort.org/snort-rules/#rules&#039;]);&quot;  href=&quot;http://www.snort.org/snort-rules/#rules&quot; title=&quot;signature file&quot; target=&quot;_blank&quot;&gt;signature file&lt;/a&gt; from snort.org, you`ll need to generate an account to get the file.&lt;br /&gt;
&lt;br /&gt;
mkdir temp&lt;br /&gt;
mv snortrules-snapshot-2.8.tar.gz temp/ &amp;&amp;amp; cd temp/&lt;br /&gt;
tar zxvf snortrules-snapshot-2.8.tar.gz&lt;br /&gt;
&lt;br /&gt;
Move the plain text signature descriptors to the BASE directory, this must be done as root as the BASE directory is owned by apache&lt;br /&gt;
&lt;br /&gt;
# mv doc/signatures /var/www/html/base/ &amp;&amp;amp; chown -R apache.apache /var/www/html/base/signatures&lt;br /&gt;
&lt;br /&gt;
Move the signature files to the snort sigs directory which we created earlier:&lt;br /&gt;
&lt;br /&gt;
# mv rules/&lt;/strong&gt; /home/snort/sigs/ &amp;&amp;amp; chown -R snort.snort /home/snort/sigs/&lt;br /&gt;
&lt;br /&gt;
Modify the snort.conf file to reflect the network to be monitored, the variables noted are ones that should be modified, feel free to experiement though:&lt;br /&gt;
&lt;br /&gt;
$ cd /home/snort&lt;br /&gt;
$ vi snort.conf&lt;br /&gt;
&lt;br /&gt;
var HOME_NET 192.168.0.0/8 (enter the correct network with mask here of the network you are monitoring)&lt;br /&gt;
var DNS_SERVERS [192.168.0.1,192.168.0.2] (enter your actual DNS servers here)&lt;br /&gt;
&lt;br /&gt;
same follows with all the variables, if you can define it please do so..the more specific you are the better the results&lt;br /&gt;
&lt;br /&gt;
var RULE_PATH /home/snort/sigs&lt;br /&gt;
var PREPROC_RULE_PATH /home/snort/sigs/preproc_rules&lt;br /&gt;
&lt;br /&gt;
The snort decoders you&#039;ll have to experiment with, personally I find them very noisy and typically disable them on all installations.&lt;br /&gt;
&lt;br /&gt;
Locate the line containing the following:&lt;br /&gt;
&lt;br /&gt;
   iis_unicode_map unicode.map 1252&lt;br /&gt;
&lt;br /&gt;
and change it to:&lt;br /&gt;
&lt;br /&gt;
   iis_unicode_map /home/snort/sigs/unicode.map 1252&lt;br /&gt;
&lt;br /&gt;
The ftp_telnet preprocessor works well in some area&#039;s, horrible in others..it requires some heavy tuning outside the scope of this blog post.&lt;br /&gt;
&lt;br /&gt;
Locate the following string, uncomment it and correct the information with your actual database information:&lt;br /&gt;
&lt;br /&gt;
output database: log, mysql, user=snort password=&lt;snort_password_here&gt; dbname=snort host=&lt;sql_ip_here&gt; sensor_name=&lt;name_of_the_sensor&gt;&lt;br /&gt;
&lt;br /&gt;
Locate the following two lines and modify them to appear as follows:&lt;br /&gt;
&lt;br /&gt;
include classification.config&lt;br /&gt;
include reference.config&lt;br /&gt;
&lt;br /&gt;
include $RULE_PATH/classification.config&lt;br /&gt;
include $RULE_PATH/reference.config&lt;br /&gt;
&lt;br /&gt;
Once you`ve modified all the needed fields, test the config with the following string:&lt;br /&gt;
&lt;br /&gt;
# snort -c /home/snort/snort.conf -i eth0 -T&lt;br /&gt;
&lt;br /&gt;
If everything is correct and snort can connect to the database, you`ll be presented with the following:&lt;br /&gt;
&lt;br /&gt;
Snort successfully loaded all rules and checked all rule chains!&lt;br /&gt;
database: Closing connection to database &quot;snort&quot;&lt;br /&gt;
Snort exiting&lt;br /&gt;
&lt;br /&gt;
Now for the final part, modifying the snort sysconfig file so we can actually start/stop/restart/stats the snort process. Modify the following lines as needed:&lt;br /&gt;
&lt;br /&gt;
vi /etc/sysconfig/snort&lt;br /&gt;
CONF=/home/snort/snort.conf&lt;br /&gt;
INTERFACE=eth0 (set the correct interface name of set ALL for snort to listen on all interfaces)&lt;br /&gt;
PRINT_INTERFACE=1&lt;br /&gt;
#PASS_FIRST=) (comment this out, the option no longer exists, the default behavior is pass first now)&lt;br /&gt;
BINARY_LOG=1 (by default snort will generate pcap dumps of all alerts, this will require much disk space and manual/scripted removal of the files as it will chew up disk space, set it to 0 if you do not want pcap generated files of alerts)&lt;br /&gt;
&lt;br /&gt;
Modify the snort init script to remove an option that no longer exists but for whatever reason in 2.8.5.1 the init still references it:&lt;br /&gt;
&lt;br /&gt;
#if [ &quot;$PASS_FIRST&quot;X = &quot;1X&quot; ]; then&lt;br /&gt;
#   PASS_FIRST=&quot;-o&quot;&lt;br /&gt;
#else&lt;br /&gt;
#   PASS_FIRST=&quot;&quot;&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
Create a symlink to snort for the location in the snort init script or edit the snort init script to reflect the actual location:&lt;br /&gt;
&lt;br /&gt;
# ln -s /usr/local/bin/snort /usr/sbin/snort&lt;br /&gt;
&lt;br /&gt;
Now just start snort up:&lt;br /&gt;
&lt;br /&gt;
# /etc/rc.d/init.d/snortd start&lt;br /&gt;
&lt;br /&gt;
Enjoy...  
    </content:encoded>

    <pubDate>Mon, 15 Feb 2010 17:05:20 -0500</pubDate>
    <guid isPermaLink="false">http://keithpachulski.securitytactics.com/index.php?/archives/12-guid.html</guid>
    
</item>
<item>
    <title>Squid as a Passive Web Content Filtering System</title>
    <link>http://keithpachulski.securitytactics.com/index.php?/archives/1-Squid-as-a-Passive-Web-Content-Filtering-System.html</link>
            <category>Content Filtering</category>
            <category>Intrusion Analysis</category>
            <category>Intrusion Detection</category>
    
    <comments>http://keithpachulski.securitytactics.com/index.php?/archives/1-Squid-as-a-Passive-Web-Content-Filtering-System.html#comments</comments>
    <wfw:comment>http://keithpachulski.securitytactics.com/wfwcomment.php?cid=1</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://keithpachulski.securitytactics.com/rss.php?version=2.0&amp;type=comments&amp;cid=1</wfw:commentRss>
    

    <author>nospam@example.com (Keith Pachulski)</author>
    <content:encoded>
    The goal here is simple, have a content filtering system in place that is transparent to the end users that will simply terminate their web browsing sessions when they attempt to access sites deemed as malicious or in violation of company policy, or home restrictions. This setup is based on CentOS 5.4 with Squid installed via yum and iptables along with a Cisco Router, though the WCCP configuration could easily be ported over to an ASA with WCCP support.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing, GRE tunneling as needed in this setup is not supported on either OpenSolaris or Solaris 10.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Configuring the Router for WCCP v2&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;? Connect to the device via console/ssh/telnet and enter into configuration mode&lt;br /&gt;o enable&lt;br /&gt;o conf t&lt;br /&gt;&lt;br /&gt;? Define ?interesting traffic? via an extended access list&lt;br /&gt;o ip access-list extended filter&lt;br /&gt;o permit tcp 192.168.1.0 0.0.0.255 any eq 80&lt;br /&gt;o exit&lt;br /&gt;&lt;br /&gt;? Enable WCCP v2 and apply the filter list to WCCP&lt;br /&gt;o ip wccp version 2&lt;br /&gt;o Once you enter this command, WCCP is enabled but doing a show run does not display this command in the configuration&lt;br /&gt;o ip wccp web-cache redirect-list filter&lt;br /&gt;o This command tells the router to forward all traffic to the Squid server once it has connected to the router/switch&lt;br /&gt;o On the outbound interface (the one connected to the internet feed) enter the following&lt;br /&gt;o Interface &lt;hw name&gt;&lt;br /&gt;o ip wccp web-cache redirect out&lt;br /&gt;? This command tells the router to redirect all outbound traffic as defined by the filter access list.&lt;br /&gt;o Write the configuration before moving onto the Squid server configuration&lt;br /&gt;o ctrl+z&lt;br /&gt;o wr mem&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Configuring the Squid Server for WCCP v2&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;By default Squid, if installed from an rpm which it should be, stores its configuration files in /etc/squid/.&lt;br /&gt;&lt;br /&gt;Before beginning the configuration of squid, backup the original configuration file by doing the following:&lt;br /&gt;&lt;br /&gt;? cd /etc/squid&lt;br /&gt;? cp squid.conf squid.conf.original&lt;br /&gt;o This command will rename the original squid.conf to squid.conf.original&lt;br /&gt;&lt;br /&gt;Create the new squid configuration file and insert the base configuration information for Squid to support WCCP v2 content filtering:&lt;br /&gt;&lt;br /&gt;? su&lt;br /&gt;o enter root password&lt;br /&gt;? cd /etc/squid&lt;br /&gt;? vi squid.conf&lt;br /&gt;? Hit the &#039;i&#039; key to enter into insert mode then paste in the following:&lt;br /&gt;&lt;br /&gt;#Enable transparent mode on the default Squid service port of 3128&lt;br /&gt;&lt;br /&gt;http_port 3128 transparent&lt;br /&gt;#Default stuff Squid needs to function&lt;br /&gt;icp_port 0&lt;br /&gt;hierarchy_stoplist cgi-bin ?&lt;br /&gt;acl QUERY urlpath_regex cgi-bin \?&lt;br /&gt;cache deny QUERY&lt;br /&gt;acl apache rep_header Server ^Apache&lt;br /&gt;broken_vary_encoding allow apache&lt;br /&gt;access_log /var/log/squid/access.log squid&lt;br /&gt;ftp_passive on&lt;br /&gt;refresh_pattern ^ftp:           1440    20%     10080&lt;br /&gt;refresh_pattern ^gopher:        1440    0%      1440&lt;br /&gt;refresh_pattern .               0       20%     4320&lt;br /&gt;client_lifetime 1 day&lt;br /&gt;acl all src 0.0.0.0/0.0.0.0&lt;br /&gt;acl manager proto cache_object&lt;br /&gt;acl localhost src 127.0.0.1/255.255.255.255&lt;br /&gt;acl to_localhost dst 127.0.0.0/8&lt;br /&gt;acl SSL_ports port 443 7004&lt;br /&gt;acl CONNECT method CONNECT&lt;br /&gt;http_access allow manager localhost&lt;br /&gt;http_access deny manager&lt;br /&gt;http_access deny !Safe_ports&lt;br /&gt;http_access deny CONNECT !SSL_ports&lt;br /&gt;&lt;br /&gt;#Define the networks to be filtered and the WCCP device which will be using the server&lt;br /&gt;#Define networks here, this MUST mirror the filter access-list created on the router/ASA&lt;br /&gt;acl our_networks src 192.168.1.0/24&lt;br /&gt;&lt;br /&gt;#Add the squid access list files here&lt;br /&gt;acl blocksites dstdomain &quot;/etc/squid/deniedsites.acl&quot;&lt;br /&gt;&lt;br /&gt;#Define how we deny the traffic matching the blocked sites list - Any web traffic matching the destination domains will generate a TCP reset to the client&lt;br /&gt;deny_info TCP_RESET blocksites&lt;br /&gt;http_access deny blocksites&lt;br /&gt;&lt;br /&gt;#Define traffic we will allow which has not been blocked by the previous&lt;br /&gt;http_access allow our_networks&lt;br /&gt;http_access allow localhost&lt;br /&gt;http_access deny all&lt;br /&gt;http_reply_access allow all&lt;br /&gt;icp_access allow all&lt;br /&gt;visible_hostname squid&lt;br /&gt;&lt;br /&gt;#Define WCCP router/switch information here&lt;br /&gt;wccp2_router 192.168.1.254&lt;br /&gt;wccp_version 4&lt;br /&gt;wccp2_rebuild_wait on&lt;br /&gt;wccp2_forwarding_method 1&lt;br /&gt;wccp2_return_method 1&lt;br /&gt;wccp2_assignment_method 1&lt;br /&gt;wccp2_service standard 0&lt;br /&gt;coredump_dir /var/spool/squid&lt;br /&gt;&lt;br /&gt;? Once this has been posted into the configuration file, hit escape then type :wq and hit enter ? this will write and exit from the file&lt;br /&gt;? Type exit and hit enter to leave the root account.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Configuring the CentOS Server for GRE Tunneling and traffic forwarding&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Load the ip_gre module, make sure you load the correct gre module for the current kernel loaded. If the kernel is updated you should remove and reload the updated module&lt;br /&gt;&lt;br /&gt;? insmod /lib/modules/2.6.18-164.11.1.el5/kernel/net/ipv4/ip_gre.ko&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Creating the GRE interface on the server&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;? NOTE: Be careful when manually creating the GRE interface, editing the wrong file or inserting incorrect characters into the interface configuration file may render the system useless.&lt;br /&gt;? su&lt;br /&gt;o Enter the root password&lt;br /&gt;? vi /etc/sysconfig/network-scripts/ifcfg-gre0&lt;br /&gt;o NOTE: This is an example of how the interface is configured, correct the following fields with the IP information reflecting the network where the device is being installed&lt;br /&gt;&lt;br /&gt;#The IP Address of the interface should be the same as the primary interface on the server&lt;br /&gt;DEVICE=gre0&lt;br /&gt;BOOTPROTO=static&lt;br /&gt;BROADCAST=192.168.1.255&lt;br /&gt;IPADDR=192.168.1.1&lt;br /&gt;NETMASK=255.255.255.0&lt;br /&gt;NETWORK=10.5.0.0&lt;br /&gt;ONBOOT=yes&lt;br /&gt;TYPE=Ethernet&lt;br /&gt;&lt;br /&gt;? Once this has been posted into the configuration file, hit escape then type :wq and hit enter ? this will write and exit from the file&lt;br /&gt;? Turn the interface up by typing the following&lt;br /&gt;? ifconfig gre0 up&lt;br /&gt;? Type exit and hit enter to leave the root account.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Enable IP Forwarding within the server operating system&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;? su&lt;br /&gt;o Enter the root password&lt;br /&gt;echo 1 &gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;echo 0 &gt; /proc/sys/net/ipv4/conf/default/rp_filter&lt;br /&gt;echo 0 &gt; /proc/sys/net/ipv4/conf/all/rp_filter&lt;br /&gt;echo 0 &gt; /proc/sys/net/ipv4/conf/eth0/rp_filter&lt;br /&gt;echo 0 &gt; /proc/sys/net/ipv4/conf/lo/rp_filter&lt;br /&gt;echo 0 &gt; /proc/sys/net/ipv4/conf/gre0/rp_filter&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Creating the IP GRE Tunnel from the Squid Server to the WCCP router/switch&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;? su&lt;br /&gt;o Enter the root password&lt;br /&gt;? /usr/sbin/iptunnel add wccp mode gre remote 192.168.1.254 local 192.168.1.1 dev eth0&lt;br /&gt;o Note: correct the remote and local address to reflect the correct IP of the remote WCCP device and the local address of the Squid server.&lt;br /&gt;? vi /etc/rc.local&lt;br /&gt;o hit &#039;i&#039; to enter into insert mode and paste in the following&lt;br /&gt;o /usr/sbin/iptunnel add wccp mode gre remote 192.168.1.254 local 192.168.1.1 dev eth0&lt;br /&gt;? Once this has been posted into the configuration file, hit escape then type :wq and hit enter ? this will write and exit from the file&lt;br /&gt;? Type exit and hit enter to leave the root account.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Modifying the static iptables rule set and adding the port redirection&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;? su&lt;br /&gt;o Enter the root password&lt;br /&gt;? vi /etc/sysconfig/iptables&lt;br /&gt;o hit &#039;i&#039; to enter insert mode and add the following lines into the firewall configuration&lt;br /&gt;o -A RH-Firewall-1-INPUT -p gre -j ACCEPT&lt;br /&gt;o Allows GRE traffic to the Squid server&lt;br /&gt;o -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 2048 -j ACCEPT&lt;br /&gt;o Allows WCCP traffic to the server&lt;br /&gt;o -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3128 -j ACCEPT&lt;br /&gt;o Allows traffic to the Squid service port&lt;br /&gt;? Once this has been posted into the configuration file, hit escape then type :wq and hit enter ? this will write and exit from the file&lt;br /&gt;? Type the following to enable port redirection for traffic coming into the GRE interface to the Squid service&lt;br /&gt;o /usr/bin/iptables -t nat -I PREROUTING -i gre0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128&lt;br /&gt;? vi /etc/rc.local&lt;br /&gt;o hit &#039;i&#039; to enter into insert mode and paste in the following&lt;br /&gt;o /usr/bin/iptables -t nat -I PREROUTING -i gre0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128&lt;br /&gt;? Once this has been posted into the configuration file, hit escape then type :wq and hit enter ? this will write and exit from the file&lt;br /&gt;? Type exit and hit enter to leave the root account.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Starting the Squid service and verifying WCCP connection from the Squid server to the router/switch&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;WCCP Router&lt;br /&gt;? Console/ssh to the WCCP router and enter the following commands&lt;br /&gt;o enable&lt;br /&gt;o conf t&lt;br /&gt;o logging on&lt;br /&gt;o logging monitor debug&lt;br /&gt;o exit&lt;br /&gt;o debug ip wccp event&lt;br /&gt;o debug ip wccp packets&lt;br /&gt;o terminal monitor&lt;br /&gt;Squid Server&lt;br /&gt;? Start the Squid service&lt;br /&gt;? su&lt;br /&gt;o Enter the root password&lt;br /&gt;? /etc/rc.d/init.d/squid start&lt;br /&gt;&lt;br /&gt;Once the squid service has started, you should start seeing messages on the router/switch saying new WCCP router detected and then a flurry of ?Here_I_Am? and ?I_See_You? messages on the console. Once you see these, the squid server has successfully connected to the WCCP service on the router/switch.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Populating the deniedsite.acl&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Sites that you want to deny access to should be added to the file mentioned previously in the configuration at /etc/squid/deniedsites.acl&lt;br /&gt;&lt;br /&gt;These should be added in same top-level structure as the user accessed the site. For example, the user goes to www.playboy.com - We want to deny access to the top level as well as all subdomains of .playboy.com so in the deniedsites.acl file we add the following:  
    </content:encoded>

    <pubDate>Tue, 09 Feb 2010 17:32:00 -0500</pubDate>
    <guid isPermaLink="false">http://keithpachulski.securitytactics.com/index.php?/archives/1-guid.html</guid>
    
</item>

</channel>
</rss>