{"id":194356,"date":"2013-09-19T12:01:02","date_gmt":"2013-09-19T08:01:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=194356"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=194356","title":{"rendered":"<span class=\"post_title\">\u041b\u0451\u0433\u043a\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Asterisk + Fail2Ban<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0430 security \u0432 asterisk 10 fail2ban \u043d\u0435 \u043c\u043e\u0433 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u0449\u0438\u0449\u0430\u0442\u044c asterisk \u043e\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u0430\u0442\u0430\u043a \u2014 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 sip \u043f\u0430\u0440\u043e\u043b\u044f \u043a \u044d\u043a\u0441\u0442\u0435\u043d\u0448\u0435\u043d\u0430\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 Asterisk 10 \u0438 \u043d\u043e\u0432\u0435\u0435 \u0435\u0433\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0430\u0440\u0443 \u0441 fail2ban. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  1. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a \/etc\/asterisk\/logger.conf <\/p>\n<pre><code>[general] dateformat=%F %T<\/code><\/pre>\n<p>  \u0438 \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 [logfiles]<\/p>\n<pre><code>security =&gt; security<\/code><\/pre>\n<p>  2. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \/etc\/fail2ban\/jail.conf<\/p>\n<pre><code>[asterisk-iptables] enabled  = true filter   = asterisk action   = iptables-allports[name=ASTERISK, protocol=all]            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org] logpath  = \/var\/log\/asterisk\/security maxretry = 5 bantime = 259200 <\/code><\/pre>\n<p>  3. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \/etc\/fail2ban\/filter.d\/asterisk.conf \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code># Fail2Ban configuration file # # # $Revision: 250 $ #  [INCLUDES]  # Read common prefixes. If any customizations available -- read them from # common.local #before = common.conf   [Definition]  #_daemon = asterisk  # Option:  failregex # Notes.:  regex to match the password failures messages in the logfile. The #          host must be matched by a group named &quot;host&quot;. The tag &quot;&quot; can #          be used for standard IP\/hostname matching and is only an alias for #          (?:::f{4,6}:)?(?P\\S+) # Values:  TEXT #  failregex = SECURITY.* SecurityEvent=&quot;FailedACL&quot;.*RemoteAddress=&quot;.+?\/.+?\/\/.+?&quot;.*             SECURITY.* SecurityEvent=&quot;InvalidAccountID&quot;.*RemoteAddress=&quot;.+?\/.+?\/\/.+?&quot;.*             SECURITY.* SecurityEvent=&quot;ChallengeResponseFailed&quot;.*RemoteAddress=&quot;.+?\/.+?\/\/.+?&quot;.*             SECURITY.* SecurityEvent=&quot;InvalidPassword&quot;.*RemoteAddress=&quot;.+?\/.+?\/\/.+?&quot;.*  # Option:  ignoreregex # Notes.:  regex to ignore. If this regex matches, the line is ignored. # Values:  TEXT # ignoreregex =<\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e! fail2ban \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438 \u043f\u043e \u043f\u043e\u0434\u0431\u043e\u0440\u0443 SIP \u043f\u0430\u0440\u043e\u043b\u0435\u0439.    \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\/194356\/\"> http:\/\/habrahabr.ru\/post\/194356\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0430 security \u0432 asterisk 10 fail2ban \u043d\u0435 \u043c\u043e\u0433 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u0449\u0438\u0449\u0430\u0442\u044c asterisk \u043e\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u0430\u0442\u0430\u043a \u2014 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 sip \u043f\u0430\u0440\u043e\u043b\u044f \u043a \u044d\u043a\u0441\u0442\u0435\u043d\u0448\u0435\u043d\u0430\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 Asterisk 10 \u0438 \u043d\u043e\u0432\u0435\u0435 \u0435\u0433\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0430\u0440\u0443 \u0441 fail2ban. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f.<\/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-194356","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/194356","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=194356"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/194356\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}