{"id":84,"date":"2015-08-17T19:24:01","date_gmt":"2015-08-17T19:24:01","guid":{"rendered":"http:\/\/www.ilovesecure.com\/?p=84"},"modified":"2016-02-02T12:44:15","modified_gmt":"2016-02-02T12:44:15","slug":"monitor-traffic-with-snort-intrusion-detection","status":"publish","type":"post","link":"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/","title":{"rendered":"Monitor traffic with Snort &#8211; intrusion detection"},"content":{"rendered":"<p>What is Snort<\/p>\n<p>As described in its site:<\/p>\n<div class=\"linux-command\"><a href=\"https:\/\/snort.org\"><strong>Snort<\/strong><\/a> is an open source network intrusion prevention system, capable of performing real-time traffic analysis and packet logging on IP networks. It can perform protocol analysis, content searching\/matching, and can be used to detect a variety of attacks and probes, such as buffer overflows, stealth port scans, CGI attacks, SMB probes, OS fingerprinting attempts, and much more.<\/div>\n<p>This is a really powerful<\/p>\n<p>Prerequisite:<\/p>\n<ul>\n<li>any Centos 6.x, fully updated<\/li>\n<li>root access (in this document all commands are executed as root)<\/li>\n<li>Epel repo ready<\/li>\n<\/ul>\n<p><strong>1 &#8211; install all packages you needed<\/strong><\/p>\n<div class=\"linux-command\">yum install gcc make rpm-build autoconf automake flex libpcap-devel bison libdnet libdnet-devel mysql-devel pcre-devel php-mysql<\/div>\n<p><strong>2 &#8211; get the last sources<\/strong><\/p>\n<p>go to <a class=\"external-link\" href=\"http:\/\/www.snort.org\/\" rel=\"nofollow\">www.snort.org<\/a> and take a look to the last version available to download<br \/>\nin our case<br \/>\ndaq-2.0.6-1<br \/>\nsnort-2.9.7.6-1<\/p>\n<div class=\"linux-command\">cd \/root<br \/>\nwget https:\/\/www.snort.org\/downloads\/snort\/daq-2.0.6-1.src.rpm<br \/>\nwget https:\/\/www.snort.org\/downloads\/snort\/snort-2.9.7.6-1.src.rpm<\/div>\n<p><strong>3 &#8211; Compile daq<\/strong><\/p>\n<div class=\"linux-command\">rpmbuild\u00a0&#8211;rebuild daq-2.0.6-1.src.rpm<br \/>\nrpm\u00a0-Uvh .\/rpmbuild\/RPMS\/x86_64\/daq-2.0.6-1.x86_64.rpm<\/div>\n<p>(NB in case it is a i686 processor, like my howe fw, it is a little different path like .\/rpmbuild\/RPMS\/i686\/daq-2.0.6-1.i686.rpm)<\/p>\n<p><strong>4 &#8211; Compile Snort<\/strong><br \/>\nBefore compiling Snort we are going to change a little the configuration file to make it able to manage more features like zipped connections, IPv6, etc<br \/>\nExtract files:<\/p>\n<div class=\"linux-command\">rpm\u00a0-Uvh snort-2.9.7.6-1.src.rpm<br \/>\nvi\u00a0.\/rpmbuild\/SPECS\/snort.spec<\/div>\n<p>around line 133 change the configuration files adding red lines<\/p>\n<div class=\"linux-command\">SNORT_BASE_CONFIG=&#8221;&#8211;prefix=%{_prefix} \\<br \/>\n&#8211;bindir=%{_sbindir} \\<br \/>\n&#8211;sysconfdir=%{_sysconfdir}\/snort \\<br \/>\n&#8211;with-libpcap-includes=%{_includedir} \\<br \/>\n&#8211;enable-targetbased \\<br \/>\n<strong><span style=\"color: #ff0000;\">&#8211;enable-zlib \\<\/span><\/strong><br \/>\n<strong><span style=\"color: #ff0000;\"> &#8211;enable-ipv6 \\<\/span><\/strong><br \/>\n<strong><span style=\"color: #ff0000;\"> &#8211;enable-normalizer \\<\/span><\/strong><br \/>\n<strong><span style=\"color: #ff0000;\"> &#8211;enable-sourcefire \\<\/span><\/strong><br \/>\n&#8211;enable-control-socket&#8221;<\/div>\n<p>save and compile<\/p>\n<div class=\"linux-command\">rpmbuild -bb \/root\/rpmbuild\/SPECS\/snort.spec\u00a0 -D &#8216;debug_package %{nil}&#8217;<br \/>\nrpm -Uvh \/root\/rpmbuild\/RPMS\/x86_64\/snort-2.9.7.6-1.x86_64.rpm<\/div>\n<p>DONE!! Compiled and installed<br \/>\n<strong>5 &#8211; Configuration<\/strong><\/p>\n<p>Snort is based on rules that needs to be regular updated. Let&#8217;s go for the first setup.<br \/>\nComplete rules are released to registered people, so you need to go to <a class=\"external-link\" href=\"http:\/\/www.snort.org\/\">www.snort.org<\/a> register yourself, confirm your email and download the snort rules.<br \/>\nThere is a subscription too, rules for subscribers are immediately updated, 30 days later are released to registered people.<br \/>\nLast rules I downloaded are snortrules-snapshot-2976.tar.gz.and I moved to \/root<\/p>\n<div class=\"linux-command\">mkdir \/root\/snortrules<br \/>\ncd \/root\/snortrules<br \/>\ntar -xvf ..\/snortrules-snapshot-2976.tar.gz<br \/>\nmv -f rules so_rules preproc_rules \/etc\/snort\/<\/div>\n<p>#not to do if an update<\/p>\n<div class=\"linux-command\">cd etc<br \/>\nmv -f * \/etc\/snort\/<\/div>\n<p>Let&#8217;s go to edit \/etc\/snort\/snort.conf<\/p>\n<div class=\"linux-command\">vi \/etc\/snort\/snort.conf<\/div>\n<p># line 45: change to your own local network<\/p>\n<div class=\"linux-command\">ipvar HOME_NET 10.0.0.0\/24<\/div>\n<p># line 48: change<\/p>\n<div class=\"linux-command\">ipvar EXTERNAL_NET !$HOME_NET<\/div>\n<p># line 105:<\/p>\n<div class=\"linux-command\">changevar RULE_PATH\u00a0 \/etc\/snort\/rules<br \/>\nvar SO_RULE_PATH \/etc\/snort\/so_rules<br \/>\nvar PREPROC_RULE_PATH \/etc\/snort\/preproc_rules# line 113: change<br \/>\nvar WHITE_LIST_PATH \/etc\/snort\/rules<br \/>\nvar BLACK_LIST_PATH \/etc\/snort\/rules#in dynamic part (check your path)# path to dynamic preprocessor libraries<br \/>\ndynamicpreprocessor directory \/usr\/lib64\/snort-2.9.7.6_dynamicpreprocessor\/# path to base preprocessor engine<br \/>\ndynamicengine \/usr\/lib64\/snort-2.9.7.6_dynamicengine\/libsf_engine.so# path to dynamic rules libraries<br \/>\ndynamicdetection directory \/usr\/local\/lib\/snort_dynamicrules<\/div>\n<p><strong>IMPORTANT<\/strong>: default generic configuration for IP is quite wide and can generate false positive. So for a long time monitoring is suggested to put your network, so SNORT will monitor for attacks OUT -&gt; IN.<br \/>\nBut in case you want to check if there is malicious software even inside, better to leave the standard configuration<\/p>\n<div class=\"linux-command\"># Setup the network addresses you are protecting<br \/>\nipvar HOME_NET any# Set up the external network addresses. Leave as &#8220;any&#8221; in most situations<br \/>\nipvar EXTERNAL_NET any<\/div>\n<p>Then you need to tell the network card you want to monitor. Possible values are All or the name of the network card\/s. In case of multiple name they must be inserted with quotation markes: &#8220;eth0, eth1&#8221;<\/p>\n<div class=\"linux-command\">vi \/etc\/sysconfig\/snort<\/div>\n<p># line 15: change to the interface for monitoring (use your external interface)<\/p>\n<div class=\"linux-command\">INTERFACE=eth0<\/div>\n<p>ATTENTION: take the name of the interface from your ifconfig<\/p>\n<div class=\"linux-command\">mkdir \/usr\/local\/lib\/snort_dynamicrules<br \/>\nchown snort. \/usr\/local\/lib\/snort_dynamicrules<br \/>\ntouch \/etc\/snort\/rules\/white_list.rules \/etc\/snort\/rules\/black_list.rules<\/div>\n<p><strong>6 &#8211; start Snort<\/strong><\/p>\n<div class=\"linux-command\">service snortd start<\/div>\n<p><strong>7 &#8211; what to see and where<\/strong><\/p>\n<p>Snort logs any problem in<\/p>\n<p>\/var\/log\/snort\/eth0\/alert.log<\/p>\n<p>you will be able to find problem like<\/p>\n<div class=\"linux-command\">10\/07-00:24:40.384156\u00a0 [**] [1:25459:12] FILE-PDF Adobe Acrobat Reader incomplete JP2K image geometry exploit attempt [**] [Classification: Misc activity] [Priority: 3] {TCP} xx.xx.xx.xx:80 -&gt; xx.xx.xx.xx:51334<\/div>\n","protected":false},"excerpt":{"rendered":"<p>What is Snort As described in its site: Snort is an open source network intrusion prevention system, capable of performing real-time traffic analysis and packet logging on IP networks. It can perform protocol analysis, content searching\/matching, and can be used to detect a variety of attacks and probes, such as buffer overflows, stealth port scans, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,31,2],"tags":[44,43,42,41],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-linux","category-local-network","category-server","tag-detection","tag-intrusion","tag-linux","tag-snort","no-thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Monitor traffic with Snort - intrusion detection - I Love Secure<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Monitor traffic with Snort - intrusion detection - I Love Secure\" \/>\n<meta property=\"og:description\" content=\"What is Snort As described in its site: Snort is an open source network intrusion prevention system, capable of performing real-time traffic analysis and packet logging on IP networks. It can perform protocol analysis, content searching\/matching, and can be used to detect a variety of attacks and probes, such as buffer overflows, stealth port scans, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/\" \/>\n<meta property=\"og:site_name\" content=\"I Love Secure\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-17T19:24:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-02-02T12:44:15+00:00\" \/>\n<meta name=\"author\" content=\"secureadm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"secureadm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/\",\"url\":\"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/\",\"name\":\"Monitor traffic with Snort - intrusion detection - I Love Secure\",\"isPartOf\":{\"@id\":\"https:\/\/www.ilovesecure.com\/#website\"},\"datePublished\":\"2015-08-17T19:24:01+00:00\",\"dateModified\":\"2016-02-02T12:44:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.ilovesecure.com\/#\/schema\/person\/4f0f645b7843e70f478415155f2b0b07\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.ilovesecure.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Monitor traffic with Snort &#8211; intrusion detection\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.ilovesecure.com\/#website\",\"url\":\"https:\/\/www.ilovesecure.com\/\",\"name\":\"I Love Secure\",\"description\":\"Security step by step\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.ilovesecure.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.ilovesecure.com\/#\/schema\/person\/4f0f645b7843e70f478415155f2b0b07\",\"name\":\"secureadm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.ilovesecure.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7ae680ceca3544c8a37149e6254db758ee7c1ecefd5c6ad34aa972b9c5bfd1d0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7ae680ceca3544c8a37149e6254db758ee7c1ecefd5c6ad34aa972b9c5bfd1d0?s=96&d=mm&r=g\",\"caption\":\"secureadm\"},\"url\":\"https:\/\/www.ilovesecure.com\/index.php\/author\/secureadm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Monitor traffic with Snort - intrusion detection - I Love Secure","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/","og_locale":"en_US","og_type":"article","og_title":"Monitor traffic with Snort - intrusion detection - I Love Secure","og_description":"What is Snort As described in its site: Snort is an open source network intrusion prevention system, capable of performing real-time traffic analysis and packet logging on IP networks. It can perform protocol analysis, content searching\/matching, and can be used to detect a variety of attacks and probes, such as buffer overflows, stealth port scans, [&hellip;]","og_url":"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/","og_site_name":"I Love Secure","article_published_time":"2015-08-17T19:24:01+00:00","article_modified_time":"2016-02-02T12:44:15+00:00","author":"secureadm","twitter_card":"summary_large_image","twitter_misc":{"Written by":"secureadm","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/","url":"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/","name":"Monitor traffic with Snort - intrusion detection - I Love Secure","isPartOf":{"@id":"https:\/\/www.ilovesecure.com\/#website"},"datePublished":"2015-08-17T19:24:01+00:00","dateModified":"2016-02-02T12:44:15+00:00","author":{"@id":"https:\/\/www.ilovesecure.com\/#\/schema\/person\/4f0f645b7843e70f478415155f2b0b07"},"breadcrumb":{"@id":"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.ilovesecure.com\/index.php\/2015\/08\/17\/monitor-traffic-with-snort-intrusion-detection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.ilovesecure.com\/"},{"@type":"ListItem","position":2,"name":"Monitor traffic with Snort &#8211; intrusion detection"}]},{"@type":"WebSite","@id":"https:\/\/www.ilovesecure.com\/#website","url":"https:\/\/www.ilovesecure.com\/","name":"I Love Secure","description":"Security step by step","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.ilovesecure.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.ilovesecure.com\/#\/schema\/person\/4f0f645b7843e70f478415155f2b0b07","name":"secureadm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ilovesecure.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7ae680ceca3544c8a37149e6254db758ee7c1ecefd5c6ad34aa972b9c5bfd1d0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7ae680ceca3544c8a37149e6254db758ee7c1ecefd5c6ad34aa972b9c5bfd1d0?s=96&d=mm&r=g","caption":"secureadm"},"url":"https:\/\/www.ilovesecure.com\/index.php\/author\/secureadm\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":12,"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":96,"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/posts\/84\/revisions\/96"}],"wp:attachment":[{"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ilovesecure.com\/index.php\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}