{"id":277359,"date":"2016-03-31T12:49:02","date_gmt":"2016-03-31T08:49:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=277359"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=277359","title":{"rendered":"\u041a\u0430\u043a \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 ufw"},"content":{"rendered":"<p>       \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043a\u0430\u043a \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 IP \u0430\u0434\u0440\u0435\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 ufw.<\/p>\n<p>  UFW (Uncomplicated Firewall) \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0436\u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 iptables \u0434\u043b\u044f \u041e\u0421 Ubuntu Linux. \u041e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. UFW \u2014 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430 IPv4 \u0438\u043b\u0438 IPv6, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ed5\/830\/e11\/ed5830e1154a44ef8bad05d8b728378f.jpeg\"\/><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 IP \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 ufw<\/h4>\n<p>  \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:<\/p>\n<pre><code class=\"html\">sudo ufw deny from {ip-address-here} to any <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0438\u043b\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0441 192.168.1.5, \u0432\u0432\u043e\u0434\u0438\u043c: <\/p>\n<pre><code class=\"html\">sudo ufw deny from 192.168.1.5 to any <\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u0444\u0430\u0435\u0440\u0432\u043e\u043b\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b, \u0432\u0432\u043e\u0434\u0438\u043c:<\/p>\n<pre><code class=\"html\">$ sudo ufw status numbered <\/code><\/pre>\n<p>  \u0438\u043b\u0438<\/p>\n<pre><code class=\"html\">$ sudo ufw status <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/393\/0ac\/c44\/3930acc44696484fb14353727946af04.png\"\/><\/p>\n<h4>\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 IP \u0438 \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u043e\u0440\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 ufw<\/h4>\n<p>  \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:<\/p>\n<pre><code class=\"html\">ufw deny from {ip-address-here} to any port {port-number-here} <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0438\u043b\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u00ab\u0441\u043f\u0430\u043c\u0435\u0440\u0441\u043a\u0438\u0445\u00bb IP \u0430\u0434\u0440\u0435\u0441\u043e\u0432 202.54.1.5 \u043f\u043e\u0440\u0442\u0430 80, \u0432\u0432\u043e\u0434\u0438\u043c:<\/p>\n<pre><code class=\"html\">sudo ufw deny from 202.54.1.5 to any port 80 <\/code><\/pre>\n<p>  \u0417\u0430\u043d\u043e\u0432\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: <\/p>\n<pre><code class=\"html\">$ sudo ufw status numbered <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/39a\/2ce\/b91\/39a2ceb913f44a3b815238949b8b15bc.png\"\/><\/p>\n<h4>\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 IP, \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u0440\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 ufw<\/h4>\n<p>  \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:<\/p>\n<pre><code class=\"html\">sudo ufw deny proto {tcp|udp} from {ip-address-here} to any port {port-number-here} <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u044b\u0445 IP \u0430\u0434\u0440\u0435\u0441\u043e\u0432 202.54.1.1 tcp \u043f\u043e\u0440\u0442\u0430 22, \u0432\u0432\u043e\u0434\u0438\u043c:<\/p>\n<pre><code class=\"html\">$ sudo ufw deny proto tcp from 202.54.1.1 to any port 22 $ sudo ufw status numbered <\/code><\/pre>\n<p>  \u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 ufw. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0442\u043e\u0442 \u0436\u0435:<\/p>\n<pre><code class=\"html\">$ sudo ufw deny proto tcp from sub\/net to any port 22 $ sudo ufw deny proto tcp from 202.54.1.0\/24 to any port 22 <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041a\u0430\u043a \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0438 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441\u043e\u0432<\/h4>\n<p>  \u0421\u0438\u0442\u0430\u043a\u0441\u0438\u0441:<\/p>\n<pre><code class=\"html\">$ sudo ufw status numbered $ sudo ufw delete NUM <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430 # 4, \u0432\u0432\u043e\u0434\u0438\u043c:<\/p>\n<pre><code class=\"html\">$ sudo ufw delete 4 <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"html\"> deny from 202.54.1.5 to any port 80 Proceed with operation (y|n)? y Rule deleted <\/code><\/pre>\n<p>  <b>\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430:<\/b> UFW, \u041d\u0415 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 IP-\u0430\u0434\u0440\u0435\u0441<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c the\/etc\/ufw\/before.rules \u0444\u0430\u0439\u043b \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b \u201cBlock an IP Address\u201d \u043f\u043e\u0441\u043b\u0435 \u201c# End required lines\u201d.<\/p>\n<pre><code class=\"html\">$ sudo vi \/etc\/ufw\/before.rules <\/code><\/pre>\n<pre><code class=\"html\"># End required lines <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0432\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0430 \u043e\u0442 \u0441\u043f\u0430\u043c\u0430 \u0438\u043b\u0438 \u0445\u0430\u043a\u0435\u0440\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d08\/3c7\/07f\/d083c707f03f4e0f9d4a56c3f0c61eba.png\"\/><\/p>\n<p>  \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0438 \u0437\u0430\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b. \u0418 \u2014 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440:<\/p>\n<pre><code class=\"html\">$ sudo ufw reload <\/code><\/pre>\n<div class=\"clear\"><\/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=\"https:\/\/habrahabr.ru\/post\/230201\/\"> https:\/\/habrahabr.ru\/post\/230201\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043a\u0430\u043a \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 IP \u0430\u0434\u0440\u0435\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 ufw.<\/p>\n<p>  UFW (Uncomplicated Firewall) \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0436\u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 iptables \u0434\u043b\u044f \u041e\u0421 Ubuntu Linux. \u041e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. UFW \u2014 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430 IPv4 \u0438\u043b\u0438 IPv6, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ed5\/830\/e11\/ed5830e1154a44ef8bad05d8b728378f.jpeg\"\/><\/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-277359","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/277359","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=277359"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/277359\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=277359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=277359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=277359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}