{"id":2133,"date":"2011-12-26T16:17:21","date_gmt":"2011-12-26T14:17:21","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=2133"},"modified":"2026-02-20T10:17:54","modified_gmt":"2026-02-20T08:17:54","slug":"sshit-%d1%83%d0%b4%d0%be%d0%b1%d0%bd%d1%8b%d0%b9-%d0%b1%d0%bb%d0%be%d0%ba%d0%b8%d1%80%d0%be%d0%b2%d1%89%d0%b8%d0%ba-%d0%b4%d0%bb%d1%8f-pf","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=2133","title":{"rendered":"sshit: \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0434\u043b\u044f pf"},"content":{"rendered":"<p>\u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0435\u0449\u0451 \u043f\u0440\u043e \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0435 \u0441 <strong>pf<\/strong>. \u0421\u0430\u043c <strong>sshit<\/strong> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 <strong>perl<\/strong> \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u043e\u0442\u0441\u044e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c\u0438. \u0422\u043e \u0435\u0441\u0442\u044c, \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u044f\u0437\u044b\u043a\u0430 <strong>perl<\/strong> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435\u043b\u0435\u0442\u0443 (\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043e\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442) \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442. \u042d\u0442\u043e \u0436\u0435 (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043b\u0435\u0442\u0443) \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/span><\/strong><\/em>: \u0434\u043b\u044f <strong>OpenBSD<\/strong> \u0435\u0433\u043e \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442, \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0435\u0433\u043e \u043d\u0435\u0442 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u044f\u0445. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 <strong>perl&#8217;<\/strong>e &#8211; \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0435\u0431\u0435 \u044d\u0442\u043e\u0442 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a \u0438 \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 &#8211; \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432 <strong>OpenBSD<\/strong> \u0432 <strong>syslogd<\/strong> \u043d\u0435\u0442\u0443 \u0444\u043b\u0430\u0433\u0430<strong> &#8216;-c&#8217;<\/strong>.<\/p>\n<p><!--more--><\/p>\n<p>\u0418 \u0442\u0430\u043a. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0443\u0441\u0430\u043d\u043e\u0432\u043a\u0435. \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0440\u0442\u044b \u0438 \u0441\u0442\u0430\u0432\u0438\u043c <strong>sshit<\/strong>:<\/p>\n<p><code>cd \/usr\/ports\/security\/sshit\/ &amp;&amp; make install clean<br \/>\n<\/code><br \/>\n\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 <strong>sshit.conf<\/strong> \u0432 \u043f\u0430\u043f\u043a\u0435 <strong>\/usr\/local\/etc<\/strong>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0437\u0430\u0442\u043e\u0447\u0435\u043d \u043f\u043e\u0434 <strong>pf<\/strong> \u0438 \u0433\u043e\u0442\u043e\u0432 \u0441\u0440\u0430\u0437\u0443 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e (\u0432\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u043e\u043d \u0442\u0430\u043a \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0441 <strong>ipfw<\/strong>, \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u043e\u043c <strong>pf<\/strong>). \u041d\u043e \u044f \u0431\u044b \u043b\u0438\u0447\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0435\u0431\u044b\u0432\u0430\u043d\u0438\u044f ip \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445. \u041f\u043e \u0443\u043c\u043b\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044d\u0442\u043e<strong> 5<\/strong> \u043c\u0438\u043d\u0443\u0442, \u043d\u043e \u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0442\u0430\u0432\u043b\u044e <strong>2<\/strong> \u0441\u0443\u0442\u043e\u043a. \u0418 \u0442\u0430\u043a, \u043c\u0435\u043d\u044f\u0435\u043c:<\/p>\n<p><code>RESET_IP \u00a0 \u00a0 \u00a0 \u00a0= 172800<\/code><\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0444\u0430\u0439\u043b <strong>\/etc\/ssh\/sshd_config<\/strong><\/p>\n<p><code>UseDNS no<\/code><\/p>\n<p>\u0417\u0430\u0447\u0435\u043c \u043c\u044b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c? \u0417\u0430\u0442\u0435\u043c, \u0447\u0442\u043e \u0431\u044b \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0434\u0435\u043c\u043e\u043d <strong>ssh<\/strong> \u043d\u0435 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c IP \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0438\u043c\u044f. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <strong>sshit<\/strong> \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0435\u0441\u0442\u0438 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0447\u0451\u0440\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432<\/strong> \u0432 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e &#8220;\u043f\u0440\u043e\u043f\u0430\u0442\u0447\u0438\u0442\u044c&#8221; \u0441\u0430\u043c <strong>sshit<\/strong>. \u0421\u0442\u0440\u043e\u043a\u0443:<\/p>\n<p><code>if (\/(failed|error|Invalid user) .*from (\\d+\\.\\d+\\.\\d+\\.\\d+|[\\da-f:]*:[\\da-f:]+|([\\da-z-]+\\.)+[a-z]{2,4})\/i ) { # IPv4 &amp; IPv6<\/code><\/p>\n<p>\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430<\/p>\n<p><code>if (\/(failed|error|Invalid user|User) .*from (\\d+\\.\\d+\\.\\d+\\.\\d+|[\\da-f:]*:[\\da-f:]+|([\\da-z-]+\\.)+[a-z]{2,4})\/i ) { # IPv4 &amp; IPv6<\/code><\/p>\n<p>\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 <strong>regexp<\/strong> \u0441\u043b\u043e\u0432\u043e <strong>User<\/strong>. \u0418\u043d\u0430\u0447\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438:<\/p>\n<p><code>User root from 61.174.51.231 not allowed because not listed in AllowUsers<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430 <strong>pf<\/strong>. \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 2 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: \u043e\u0434\u043d\u0430 \u0434\u043b\u044f \u043f\u043b\u043e\u0445\u0438\u0445 <strong>IP<\/strong>, \u0434\u0440\u0443\u0433\u0430\u044f \u0436\u0435 &#8211; \u0434\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u0445. \u0412\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435, \u0437\u0430\u0447\u0435\u043c \u0432\u0442\u043e\u0440\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430? \u041e\u0442\u0432\u0435\u0447\u0430\u044e. \u0423 \u043c\u0435\u043d\u044f \u043f\u0430\u0440\u0443 \u0440\u0430\u0437 \u0431\u044b\u0432\u0430\u043b\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u043e \u043e\u0448\u0438\u0431\u043a\u0435 \u0432\u0432\u043e\u0434\u0438\u043b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043c\u0435\u043d\u044f \u0431\u0430\u043d\u0438\u043b\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0440\u0443\u0447\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0438\u0434\u043d\u043e. \u041d\u043e \u0447\u0442\u043e \u043f\u043e\u0434\u0435\u043b\u0430\u0435\u0448\u044c, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u044d\u0442\u043e \u044f \u0438\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0438\u0448\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0434\u043b\u044f &#8220;\u0431\u0435\u043b\u044b\u0445&#8221; <strong>IP<\/strong>, \u0447\u0442\u043e \u0431\u044b \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0439 \u0432 \u0447\u0451\u0440\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u043d\u0438\u043a\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b.<\/p>\n<p>\u0418 \u0442\u0430\u043a, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0441\u0430\u043c\u044b\u0439 \u0432\u0432\u0435\u0440\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446:<\/p>\n<p><code>table &lt;whitelist&gt; const {IP1\/32, IP2\/32}<br \/>\ntable &lt;badhosts&gt; persist<br \/>\n<\/code><br \/>\n\u0412\u043e\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0430\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446:<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">const<\/span><\/strong><\/em> &#8211; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430. \u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, <strong>pfctl(8)<\/strong> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 <strong>securelevel(7)<\/strong> \u0440\u0430\u0432\u043d\u043e\u043c\u0443 \u0434\u0432\u0443\u043c \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">persist<\/span><\/strong><\/em> &#8211; \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044f\u0434\u0440\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u043a \u043d\u0435\u0439 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u044f\u0434\u0440\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441\u0441\u044b\u043b\u0430\u044e\u0449\u0435\u0435\u0441\u044f \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0438\u0449\u0435\u043d\u043e.<\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p><code>#allow safenet<br \/>\npass quick on $ext_if from &lt;whitelist&gt; to $extip<br \/>\npass quick on $ext_if from $extip to &lt;whitelist&gt;<\/code><\/p>\n<p><code>#bad guys<br \/>\nblock quick on $ext_if from &lt;badhosts&gt; to any<br \/>\nblock quick on $ext_if from any to &lt;badhosts&gt;<br \/>\n<\/code><br \/>\n\u041a\u0443\u0434\u0430 \u0438\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c? \u041b\u0438\u0447\u043d\u043e \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0448\u0435. \u042f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <strong>quick<\/strong>, \u0447\u0442\u043e \u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0441\u0440\u0430\u0437\u0443 (\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043e \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 <strong>ipfw<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e).<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 <strong>syslog&#8217;a<\/strong>.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 <strong>\/etc\/syslog.conf<\/strong> \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0432\u0442\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<p><code>auth.info;authpriv.info \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0| exec \/usr\/local\/sbin\/sshit<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <strong>\/etc\/rc.conf<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u043a\u043e\u0435:<\/p>\n<p><code>syslogd_flags=\"-c\"<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0430 <strong>syslogd_flags<\/strong>, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0442\u0443\u0434\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<strong> &#8216;-c&#8217;<\/strong>. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0442\u043e \u0432 \u043b\u043e\u0433\u0430\u0445 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430:<\/p>\n<p><code>Apr 17 18:32:16 srv-test last message repeated 2 times<\/code><\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043c \u043a \u0444\u0438\u043d\u0430\u043b\u0443: \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0435\u043c <strong>syslogd<\/strong>:<\/p>\n<p><code>#\/etc\/rc.d\/syslog restart<\/code><\/p>\n<p>\u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c. \u041f\u043e\u0441\u043b\u0435 <strong>4<\/strong> \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0430\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443:<\/p>\n<p><code>Apr 17 18:38:09 srv-test sshit: BLOCKING 10.0.3.185 with pf<\/code><\/p>\n<p>\u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e <strong>ip=10.0.3.185<\/strong> \u0443 \u043d\u0430\u0441 \u043f\u043e\u043f\u0430\u043b \u0432 \u0447\u0451\u0440\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u0431\u043e\u0438 \u0438\u043b\u0438 sshit \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0435\u0441\u0442\u0438 <strong>ip<\/strong> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443\u00a0\u0438\u043b\u0438 \u0436\u0435 ip \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0435\u043b\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0438 \u0441 \u043d\u0435\u0433\u043e \u0438\u0434\u0451\u0442 \u043f\u043e\u0434\u0431\u043e\u0440 \u043f\u0430\u0440\u043e\u043b\u0435\u0439, \u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443:<\/p>\n<p><code>Apr 17 18:40:26 srv-test sshit: block for 10.0.3.185 not working!<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0442\u043e \u0436\u0435 \u0437\u0430\u043d\u0435\u0441\u0451\u043d \u0432 \u0447\u0451\u0440\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0430\u043a\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p><code>#pfctl -t badhosts -T show<br \/>\n1.1.1.1<br \/>\n2.2.2.2<\/code><\/p>\n<p>\u0427\u0442\u043e \u0431\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0434\u0430\u043b\u0438\u0442\u044c <strong>IP<\/strong> \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p><code>#pfctl -t badhosts -T delete 1.1.1.1<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435\u0441\u044c \u043a \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u043c\u0443 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430 <strong>pf<\/strong>.<\/p>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <strong>sysctl<\/strong>:<\/p>\n<pre><code>net.pf.request_maxcount=500000<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0435\u0449\u0451 \u043f\u0440\u043e \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0435 \u0441 pf. \u0421\u0430\u043c sshit \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 perl \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u043e\u0442\u0441\u044e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c\u0438. \u0422\u043e \u0435\u0441\u0442\u044c, \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u044f\u0437\u044b\u043a\u0430 perl \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435\u043b\u0435\u0442\u0443 (\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043e\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442) \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442. \u042d\u0442\u043e \u0436\u0435 (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043b\u0435\u0442\u0443) \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,25,13],"tags":[],"class_list":["post-2133","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-openbsd","category-security"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2133"}],"version-history":[{"count":7,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2133\/revisions"}],"predecessor-version":[{"id":6686,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2133\/revisions\/6686"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}