{"id":192884,"date":"2013-09-09T08:29:03","date_gmt":"2013-09-09T04:29:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=192884"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=192884","title":{"rendered":"<span class=\"post_title\">Suricata \u043a\u0430\u043a IPS<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0435\u0441\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440. \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u043d\u0435\u0441\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u044b\u043c\u0438 \u0441\u0430\u043c\u043e\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u043e\u0440\u0433\u0430\u043d\u0430\u043c\u0438 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043a\u043e\u0440\u044b\u0441\u0442\u043d\u044b\u0445, \u043b\u0438\u0447\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0446\u0435\u043b\u044f\u0445.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/0f7\/6ae\/891\/0f76ae891d8b7c570dc2c2a0506edf1c.jpg\"\/><br \/>  <a href=\"http:\/\/suricata-ids.org\/\">Suricata<\/a> \u2014 open source IPS\/IDS \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0443\u0434\u0438\u043b\u0438\u0441\u044c \u043d\u0430\u0434 IPS \u0432\u0435\u0440\u0441\u0438\u0435\u0439 Snort. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 Suricata \u043e\u0442 Snort \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f GPU \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 IDS, \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 IPS, \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0434\u043e 10Gbit \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0438, \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u043b\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043f\u0440\u0430\u0432\u0438\u043b Snort. \u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u043d\u0430 <a href=\"http:\/\/suricata-ids.org\/features\/all-features\/\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>. C\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0440\u0438\u043c \u043e\u0431 IPS.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 Suricata \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 IPS: <b>NFQ<\/b> \u0438 <b>AF_PACKET<\/b><\/p>\n<p>  <b>NFQ<\/b> IPS \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<br \/>  1) \u041f\u0430\u043a\u0435\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 iptables<br \/>  2) \u041f\u0440\u0430\u0432\u0438\u043b\u043e iptables \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c NFQUEUE, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <b>iptables -I INPUT -p tcp -j NFQUEUE<\/b><br \/>  3) \u0418\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 NFQUEUE \u043f\u0430\u043a\u0435\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0447\u0442\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 Suricata<br \/>  4) Suricata \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c (rules) \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0440\u0435\u0445 \u0432\u0435\u0440\u0434\u0438\u043a\u0442\u043e\u0432: <b>NF_ACCEPT<\/b>, <b>NF_DROP<\/b> \u0438 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2014 <b>NF_REPEAT<\/b>.<br \/>  5) \u041f\u0430\u043a\u0435\u0442\u044b, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u0432 NF_REPEAT, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043d\u0430\u0447\u0430\u043b\u043e <b>\u0442\u0435\u043a\u0443\u0449\u0435\u0439<\/b> \u0442\u0430\u0431\u043b\u0438\u0446\u044b iptables, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0434\u043b\u044f \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u043d\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u0441\u0443\u0434\u044c\u0431\u0443 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0430\u0432\u0438\u043b iptables.<\/p>\n<p>  \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 1.4, Suricata \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 IPS, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f zero copy \u0440\u0435\u0436\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b <b>AF_PACKET<\/b>, \u043d\u043e \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u043b\u044e\u0437\u0430 \u0441 \u0434\u0432\u0443\u043c\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u043f\u0430\u043a\u0435\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e\u0434 DROP \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0442\u043e \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u043b\u044e\u0441\u044b zero copy \u2014 \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0447\u0442\u043e \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u043e \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0435\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u0438\u0441\u043a\u0443\u044e\u0442 \u043d\u0430\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0448\u0442\u0440\u0430\u0444\u044b \u0420\u043e\u0441\u043a\u043e\u043c\u043d\u0430\u0434\u0437\u043e\u0440\u0430.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Suricata \u043d\u0430 Ubuntu \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 <a href=\"https:\/\/redmine.openinfosecfoundation.org\/projects\/suricata\/wiki\/Ubuntu_Installation_-_Personal_Package_Archives_(PPA)\">Wiki<\/a><\/p>\n<h4>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 NFQ \u043d\u0430 WEB \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/h4>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e iptables:  <\/p>\n<pre><code class=\"bash\"># \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0434\u0443\u0442 \u043d\u0430 80-\u0439 \u043f\u043e\u0440\u0442 \u0438 &lt;b&gt;\u041d\u0415&lt;\/b&gt; \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043f\u043e\u0434 \u043c\u0430\u0441\u043a\u0443 0x1\/0x1 \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 iptables -t mangle -I PREROUTING -p tcp -m tcp --dport 80 -m mark ! --mark 0x1\/0x1 -j NFQUEUE --queue-num 0 <\/code><\/pre>\n<p>  <i>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c mangle, \u0442.\u043a. \u044d\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u043d\u0430 \u043f\u0443\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/i><br \/>  \u041e\u043f\u0446\u0438\u044f <b>&#8212;queue-bypass<\/b> \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u044f\u0434\u0440\u0435 2.6.38 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043b\u0443\u0448\u0430\u044e\u0449\u0435\u0433\u043e NFQUEUE \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422.\u0435. \u0435\u0441\u043b\u0438 Suricata \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430, \u0442\u043e \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043f\u043e\u0439\u0434\u0443\u0442 \u0434\u0430\u043b\u044c\u0448\u0435 \u043a\u0430\u043a \u043d\u0438 \u0432 \u0447\u0435\u043c \u043d\u0435 \u0431\u044b\u0432\u0430\u043b\u043e.<br \/>  \u041e\u043f\u0446\u0438\u044f <b>&#8212;queue-num<\/b> \u0437\u0430\u0434\u0430\u0451\u0442 \u043d\u043e\u043c\u0435\u0440 \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<br \/>  <b>-m mark! &#8212;mark 0x1\/0x1<\/b> \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b Suricata<\/p>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c Suricata \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 IPS (\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0434\u0435\u0442 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435):  <\/p>\n<pre><code class=\"ruby\">nfq:   mode: repeat # \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u0430\u0441\u043a\u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432   repeat-mark: 1   repeat-mask: 1 ... ... ... default-rule-path: \/etc\/suricata rule-files:  - test.rules # \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <\/code><\/pre>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u043e Suricata, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0442\u0435\u043a\u0441\u0442 TEST \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 (\/etc\/suricata\/test.rules):  <\/p>\n<pre><code>pass tcp any any -&gt; any any (content: &quot;TEST&quot;; msg: &quot;TEST was marked!&quot;; nfq_set_mark:0x2\/0xffffffff; sid:2455;)<\/code><\/pre>\n<p>  <i>sid \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c<\/i><\/p>\n<p>  \u0412 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 Suricata \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c, \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0438 \u043c\u0430\u0441\u043a\u0430 \u00ab\u043f\u043b\u043e\u0445\u043e\u0433\u043e\u00bb \u043f\u0430\u043a\u0435\u0442\u0430 \u0431\u0443\u0434\u0443\u0442: <b>0x02\/0xfe<\/b> (0xff AND 0x01 = 0xfe)<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Suricata:  <\/p>\n<pre><code class=\"bash\">suricata -q 0 -c \/etc\/suricata\/suricata.yaml <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 iptables:  <\/p>\n<pre><code class=\"bash\"># \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u043a\u0435\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e iptables -t mangle -A PREROUTING -p tcp -m tcp --dport 80 -m mark --mark 0x2\/0xfe -j LOG --log-prefix &quot;TEST packet detected&quot; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0435:  <\/p>\n<pre><code class=\"bash\">curl http:\/\/221.141.200.189\/TEST <\/code><\/pre>\n<p>  \u0412 \/var\/log\/syslog \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0438\u0434\u0430:  <\/p>\n<pre><code class=\"bash\">Sep  9 14:23:06 server kernel: [ 2897.581561] TEST packet detectedIN=eth0 OUT= MAC=c5:d5:08:8f:2d:be:ce:df:3e:af:8c:06:08:00 SRC=97.17.34.191 DST=221.141.200.189 LEN=133 TOS=0x00 PREC=0x00 TTL=64 ID=57685 DF PROTO=TCP SPT=33949 DPT=80 WINDOW=115 RES=0x00 ACK PSH URGP=0 MARK=0x3<\/code><\/pre>\n<p>  \u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e Suricata \u043c\u0430\u0440\u043a\u0438\u0440\u0443\u0435\u0442 \u043b\u0438\u0448\u044c \u043f\u0430\u043a\u0435\u0442\u044b. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043d\u0430 \u0432\u0441\u0451 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u043e\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"bash\"># \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432 \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 iptables -t mangle -A PREROUTING -m mark --mark 0x2\/0xfe -j CONNMARK --save-mark # \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e iptables -t mangle -A PREROUTING -m connmark --mark 0x2\/0xfe -j LOG --log-prefix &quot;TEST connection detected&quot; # \u0418 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b iptables -t mangle  -A PREROUTING -m connmark --mark 0x2\/0xfe -j CONNMARK --restore-mark <\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, Suricata \u0443\u043c\u0435\u0435\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u00ab\u043d\u0430 \u043b\u0435\u0442\u0443\u00bb. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code>pass tcp any any -&gt; any any (content: &quot;TEST&quot;; replace:&quot;SETS&quot;; msg: &quot;TEST was marked!&quot;; nfq_set_mark:0x2\/0xffffffff; sid:2455;) <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u043d\u0438\u0442 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 \u0442\u0435\u043a\u0441\u0442 TEST \u043d\u0430 SETS, \u043d\u043e \u043f\u0440\u0438 \u043e\u0434\u043d\u043e\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u2014 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0447\u0442\u043e \u0438 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0430:  <\/p>\n<pre><code class=\"bash\">curl -v http:\/\/221.141.200.189\/TEST <\/code><\/pre>\n<p>  \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u0432 \u043b\u043e\u0433 WEB \u0441\u0435\u0440\u0432\u0435\u0440\u0430:  <\/p>\n<pre><code>97.17.34.191 - - [09\/Sep\/2013:14:51:04 +0400] &quot;GET \/SETS HTTP\/1.1&quot; 200 151 &quot;-&quot; &quot;curl\/7.26.0&quot; <\/code><\/pre>\n<h4>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 AF_PACKET \u043d\u0430 \u0448\u043b\u044e\u0437\u0435<\/h4>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f suricata.yaml \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"ruby\">af-packet:   - interface: eth0     threads: 1     defrag: yes     cluster-type: cluster_flow     cluster-id: 98     copy-mode: ips     copy-iface: eth1     buffer-size: 64535     use-mmap: yes   - interface: eth1     threads: 1     cluster-id: 97     defrag: yes     cluster-type: cluster_flow     copy-mode: ips     copy-iface: eth0     buffer-size: 64535     use-mmap: yes <\/code><\/pre>\n<p>  <i>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u044f\u0434\u0435\u0440 \u0441\u0442\u0430\u0440\u0448\u0435 3.6, \u0438\u043d\u0430\u0447\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b.<\/i><br \/>  <i>MTU \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c.<\/i><\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Suricata:  <\/p>\n<pre><code class=\"bash\">suricata -c \/etc\/suricata\/suricata.yaml --af-packet<\/code><\/pre>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  Suricata \u2014 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430, \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438 \u0438 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435 \u00ab\u043f\u043b\u043e\u0445\u0438\u0445\u00bb \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 DROP&#8217;\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u0434\u043e\u0448\u043b\u0438 \u0434\u043e WEB \u0441\u0435\u0440\u0432\u0435\u0440\u0430). \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 <s>\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e<\/s> \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 Suricata \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 DPI.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0441 <a href=\"http:\/\/home.regit.org\">\u0431\u043b\u043e\u0433\u0430<\/a> \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Suricata \u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f <a href=\"https:\/\/redmine.openinfosecfoundation.org\/projects\/suricata\/wiki\">Wiki<\/a>.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/192884\/\"> http:\/\/habrahabr.ru\/post\/192884\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0435\u0441\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440. \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u043d\u0435\u0441\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u044b\u043c\u0438 \u0441\u0430\u043c\u043e\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u043e\u0440\u0433\u0430\u043d\u0430\u043c\u0438 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043a\u043e\u0440\u044b\u0441\u0442\u043d\u044b\u0445, \u043b\u0438\u0447\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0446\u0435\u043b\u044f\u0445.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/0f7\/6ae\/891\/0f76ae891d8b7c570dc2c2a0506edf1c.jpg\"\/><br \/>  <a href=\"http:\/\/suricata-ids.org\/\">Suricata<\/a> \u2014 open source IPS\/IDS \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0443\u0434\u0438\u043b\u0438\u0441\u044c \u043d\u0430\u0434 IPS \u0432\u0435\u0440\u0441\u0438\u0435\u0439 Snort. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 Suricata \u043e\u0442 Snort \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f GPU \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 IDS, \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 IPS, \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0434\u043e 10Gbit \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0438, \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u043b\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043f\u0440\u0430\u0432\u0438\u043b Snort. \u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u043d\u0430 <a href=\"http:\/\/suricata-ids.org\/features\/all-features\/\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>. C\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0440\u0438\u043c \u043e\u0431 IPS.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-192884","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/192884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=192884"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/192884\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=192884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=192884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=192884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}