{"id":444039,"date":"2025-01-04T15:00:06","date_gmt":"2025-01-04T15:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=444039"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=444039","title":{"rendered":"<span>\u041a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440: \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043e\u0442 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435\u0440\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0427\u0430\u0441\u0442\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u043f\u043e\u0437\u0430\u0434\u0438: \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u0438\u0440\u0443. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u0434 \u0443\u0433\u0440\u043e\u0437\u043e\u0439? <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e fullstack-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041e\u0442 SSH \u0434\u043e SSL \u0438 \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u2014 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e, \u043a\u0430\u043a \u044f \u0437\u0430\u0449\u0438\u0442\u0438\u043b \u0441\u0432\u043e\u0439 SaaS-\u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/transcriber.egorfing.com\/\" rel=\"noopener noreferrer nofollow\">Transcribator<\/a>.<\/p>\n<h4>\u0428\u0430\u0433 1: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 IP-\u0430\u0434\u0440\u0435\u0441 \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043b\u0438\u0447\u043d\u043e\u043c \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">ssh root@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">sudo adduser admin<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2014 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 sudo:<\/p>\n<p>\u0427\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u043c\u0443 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044f\u043c\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u044f \u043f\u043e\u0434 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e <code>root<\/code>. \u042d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>root<\/code>-\u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c<\/p>\n<pre><code class=\"bash\">sudo usermod -aG sudo admin<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0432 \u043d\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">ssh admin@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<h4>\u0428\u0430\u0433 2: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 nano<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 nano. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438.<\/p>\n<pre><code class=\"bash\">sudo apt install nano -y<\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b nano:<\/p>\n<ul>\n<li>\n<p><code>Ctrl+O<\/code> \u2013 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p><code>Ctrl+X<\/code> \u2013 \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><code>Ctrl+K<\/code> \u2013 \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0428\u0430\u0433 3: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 SSH<\/h4>\n<p>SSH (Secure Shell) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b. \u0415\u0441\u043b\u0438 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0435\u0449\u0451 \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b SSH-\u043a\u043b\u044e\u0447\u0438, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0438\u0445:<\/p>\n<ol>\n<li>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f SSH-\u043a\u043b\u044e\u0447\u0435\u0439 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e):<\/strong><\/p>\n<pre><code class=\"bash\">ssh-keygen -t rsa -b 4096<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 (\u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e).<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e):<\/strong><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0430\u0448 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"bash\">ssh-copy-id admin@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>~\/.ssh\/id_rsa.pub<\/code> \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b <code>~\/.ssh\/authorized_keys<\/code> \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"bash\">cat ~\/.ssh\/id_rsa.pub | ssh admin@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441 \"mkdir -p ~\/.ssh &amp;&amp; cat &gt;&gt; ~\/.ssh\/authorized_keys\"<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e root \u0438 \u043f\u0430\u0440\u043e\u043b\u044e:<\/strong><\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 SSH:<\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u0412\u043d\u043e\u0441\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>PermitRootLogin no PasswordAuthentication no<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c SSH:<\/strong><\/p>\n<pre><code class=\"bash\">sudo systemctl restart ssh<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0412 \u043d\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f:<\/strong><\/p>\n<\/li>\n<\/ol>\n<pre><code>ssh -i ~\/.ssh\/id_rsa admin@&lt;\u0432\u0430\u0448 IP&gt;<\/code><\/pre>\n<h4>\u0428\u0430\u0433 4: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430<\/h4>\n<p>\u0411\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440 (ufw) \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c ufw:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt update sudo apt install ufw -y<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0440\u0442 22 \u2014 \u0434\u043b\u044f SSH (\u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0440\u0442 80 \u2014 \u0434\u043b\u044f HTTP (\u043d\u0435\u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0440\u0442 443 \u2014 \u0434\u043b\u044f HTTPS (\u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"bash\">sudo ufw allow 22 sudo ufw allow 80 sudo ufw allow 443<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440:<\/strong><\/p>\n<pre><code class=\"bash\">sudo ufw enable<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441:<\/strong><\/p>\n<pre><code class=\"bash\">sudo ufw status<\/code><\/pre>\n<p>\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b (22, 80, 443).<\/p>\n<\/li>\n<\/ol>\n<h4>\u0428\u0430\u0433 5: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Fail2ban<\/h4>\n<p>Fail2ban \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442 \u0430\u0442\u0430\u043a \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044f IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt install fail2ban -y<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/strong><\/p>\n<pre><code class=\"bash\">sudo cp \/etc\/fail2ban\/jail.conf \/etc\/fail2ban\/jail.local sudo nano \/etc\/fail2ban\/jail.local<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p><code>bantime<\/code> \u2014 \u0432\u0440\u0435\u043c\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 IP-\u0430\u0434\u0440\u0435\u0441\u0430 (30 \u043c\u0438\u043d\u0443\u0442).<\/p>\n<\/li>\n<li>\n<p><code>findtime<\/code> \u2014 \u043f\u0435\u0440\u0438\u043e\u0434, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><code>maxretry<\/code> \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u0435\u0440\u0435\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<pre><code>[DEFAULT] bantime = 30m findtime = 10m maxretry = 5  [sshd] enabled = true<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Fail2ban:<\/strong><\/p>\n<pre><code class=\"bash\">sudo systemctl restart fail2ban<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>Fail2ban \u0431\u0443\u0434\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438 SSH \u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u0428\u0430\u0433 6: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 SSL<\/h4>\n<p>SSL (Secure Sockets Layer) \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0430\u043c\u0438. \u0411\u0435\u0437 SSL \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438, \u0447\u0442\u043e \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u043e\u043f\u044b\u0442\u0435.<\/p>\n<p>\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0445 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Certbot:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt install certbot python3-certbot-nginx -y<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SSL-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442:<\/strong><\/p>\n<pre><code class=\"bash\">sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432:<\/strong><\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c crontab:<\/p>\n<pre><code class=\"bash\">sudo crontab -e<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code>0 0 * * * certbot renew --quiet<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<h4>\u0428\u0430\u0433 7: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/h4>\n<p>\u0414\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0430\u0449\u0438\u0442\u044b, \u0442\u0440\u0435\u0431\u0443\u044f \u0432\u0432\u043e\u0434\u0430 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Google Authenticator.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Google Authenticator:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt install libpam-google-authenticator -y google-authenticator<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e:<\/strong><\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c PAM:<\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/pam.d\/sshd<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code>auth required pam_google_authenticator.so<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 SSH:<\/strong><\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b Google \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">KbdInteractiveAuthentication yes ChallengeResponseAuthentication yes PasswordAuthentication no PubkeyAuthentication yes UsePAM yes Match Address &lt;IP1&gt;,&lt;IP2&gt;,&lt;IP3&gt;     AuthenticationMethods publickey  Match all     AuthenticationMethods keyboard-interactive<\/code><\/pre>\n<p>Match Address &#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u043e\u043b\u044c.<br \/>Match all &#8212; \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u0437 google \u0438 \u043f\u043e\u0442\u043e\u043c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f admin \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0432\u0445\u043e\u0434\u0438\u043c.<br \/>IP &#8212; \u0432\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/pr-cy.ru\/browser-details\/\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0439 IP<\/a><\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c SSH:<\/strong><\/p>\n<pre><code class=\"bash\">sudo systemctl restart ssh<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u0445\u043e\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u043a\u043e\u0434 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Google Authenticator.<\/p>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>\u042d\u0442\u0438 \u0448\u0430\u0433\u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0438\u0434\u0435\u0438 \u043a\u0430\u043a \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0448\u0430\u0433\u0438, \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0438\u043c\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<p>P.S. \u041c\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u0447\u0435\u0440\u0435\u0437 Docker Compose, \u0433\u0434\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b Nginx, PostgreSQL, Redis, \u0431\u044d\u043a\u0435\u043d\u0434, \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0438 \u043b\u0435\u043d\u0434\u0438\u043d\u0433. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u2014 \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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:\/\/habr.com\/ru\/articles\/871374\/\"> https:\/\/habr.com\/ru\/articles\/871374\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0427\u0430\u0441\u0442\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u043f\u043e\u0437\u0430\u0434\u0438: \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u0438\u0440\u0443. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u0434 \u0443\u0433\u0440\u043e\u0437\u043e\u0439? <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e fullstack-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041e\u0442 SSH \u0434\u043e SSL \u0438 \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u2014 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e, \u043a\u0430\u043a \u044f \u0437\u0430\u0449\u0438\u0442\u0438\u043b \u0441\u0432\u043e\u0439 SaaS-\u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/transcriber.egorfing.com\/\" rel=\"noopener noreferrer nofollow\">Transcribator<\/a>.<\/p>\n<h4>\u0428\u0430\u0433 1: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 IP-\u0430\u0434\u0440\u0435\u0441 \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043b\u0438\u0447\u043d\u043e\u043c \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">ssh root@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">sudo adduser admin<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2014 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 sudo:<\/p>\n<p>\u0427\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u043c\u0443 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044f\u043c\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u044f \u043f\u043e\u0434 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e <code>root<\/code>. \u042d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>root<\/code>-\u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c<\/p>\n<pre><code class=\"bash\">sudo usermod -aG sudo admin<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0432 \u043d\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">ssh admin@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<h4>\u0428\u0430\u0433 2: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 nano<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 nano. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438.<\/p>\n<pre><code class=\"bash\">sudo apt install nano -y<\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b nano:<\/p>\n<ul>\n<li>\n<p><code>Ctrl+O<\/code> \u2013 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p><code>Ctrl+X<\/code> \u2013 \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><code>Ctrl+K<\/code> \u2013 \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0428\u0430\u0433 3: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 SSH<\/h4>\n<p>SSH (Secure Shell) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b. \u0415\u0441\u043b\u0438 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0435\u0449\u0451 \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b SSH-\u043a\u043b\u044e\u0447\u0438, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0438\u0445:<\/p>\n<ol>\n<li>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f SSH-\u043a\u043b\u044e\u0447\u0435\u0439 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e):<\/strong><\/p>\n<pre><code class=\"bash\">ssh-keygen -t rsa -b 4096<\/code><\/pre>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 (\u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e).<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e):<\/strong><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0430\u0448 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"bash\">ssh-copy-id admin@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>~\/.ssh\/id_rsa.pub<\/code> \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b <code>~\/.ssh\/authorized_keys<\/code> \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"bash\">cat ~\/.ssh\/id_rsa.pub | ssh admin@\u0432\u0430\u0448_IP_\u0430\u0434\u0440\u0435\u0441 \"mkdir -p ~\/.ssh &amp;&amp; cat &gt;&gt; ~\/.ssh\/authorized_keys\"<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e root \u0438 \u043f\u0430\u0440\u043e\u043b\u044e:<\/strong><\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 SSH:<\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u0412\u043d\u043e\u0441\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>PermitRootLogin no PasswordAuthentication no<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c SSH:<\/strong><\/p>\n<pre><code class=\"bash\">sudo systemctl restart ssh<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0412 \u043d\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f:<\/strong><\/p>\n<\/li>\n<\/ol>\n<pre><code>ssh -i ~\/.ssh\/id_rsa admin@&lt;\u0432\u0430\u0448 IP&gt;<\/code><\/pre>\n<h4>\u0428\u0430\u0433 4: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430<\/h4>\n<p>\u0411\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440 (ufw) \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c ufw:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt update sudo apt install ufw -y<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0440\u0442 22 \u2014 \u0434\u043b\u044f SSH (\u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0440\u0442 80 \u2014 \u0434\u043b\u044f HTTP (\u043d\u0435\u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0440\u0442 443 \u2014 \u0434\u043b\u044f HTTPS (\u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"bash\">sudo ufw allow 22 sudo ufw allow 80 sudo ufw allow 443<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440:<\/strong><\/p>\n<pre><code class=\"bash\">sudo ufw enable<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441:<\/strong><\/p>\n<pre><code class=\"bash\">sudo ufw status<\/code><\/pre>\n<p>\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b (22, 80, 443).<\/p>\n<\/li>\n<\/ol>\n<h4>\u0428\u0430\u0433 5: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Fail2ban<\/h4>\n<p>Fail2ban \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442 \u0430\u0442\u0430\u043a \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044f IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt install fail2ban -y<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/strong><\/p>\n<pre><code class=\"bash\">sudo cp \/etc\/fail2ban\/jail.conf \/etc\/fail2ban\/jail.local sudo nano \/etc\/fail2ban\/jail.local<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p><code>bantime<\/code> \u2014 \u0432\u0440\u0435\u043c\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 IP-\u0430\u0434\u0440\u0435\u0441\u0430 (30 \u043c\u0438\u043d\u0443\u0442).<\/p>\n<\/li>\n<li>\n<p><code>findtime<\/code> \u2014 \u043f\u0435\u0440\u0438\u043e\u0434, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><code>maxretry<\/code> \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u0435\u0440\u0435\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<pre><code>[DEFAULT] bantime = 30m findtime = 10m maxretry = 5  [sshd] enabled = true<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Fail2ban:<\/strong><\/p>\n<pre><code class=\"bash\">sudo systemctl restart fail2ban<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>Fail2ban \u0431\u0443\u0434\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438 SSH \u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u0428\u0430\u0433 6: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 SSL<\/h4>\n<p>SSL (Secure Sockets Layer) \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0430\u043c\u0438. \u0411\u0435\u0437 SSL \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438, \u0447\u0442\u043e \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u043e\u043f\u044b\u0442\u0435.<\/p>\n<p>\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0445 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Certbot:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt install certbot python3-certbot-nginx -y<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SSL-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442:<\/strong><\/p>\n<pre><code class=\"bash\">sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432:<\/strong><\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c crontab:<\/p>\n<pre><code class=\"bash\">sudo crontab -e<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code>0 0 * * * certbot renew --quiet<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<h4>\u0428\u0430\u0433 7: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/h4>\n<p>\u0414\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0430\u0449\u0438\u0442\u044b, \u0442\u0440\u0435\u0431\u0443\u044f \u0432\u0432\u043e\u0434\u0430 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Google Authenticator.<\/p>\n<ol>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Google Authenticator:<\/strong><\/p>\n<pre><code class=\"bash\">sudo apt install libpam-google-authenticator -y google-authenticator<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e:<\/strong><\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c PAM:<\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/pam.d\/sshd<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code>auth required pam_google_authenticator.so<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 SSH:<\/strong><\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b Google \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">KbdInteractiveAuthentication yes ChallengeResponseAuthentication yes PasswordAuthentication no PubkeyAuthentication yes UsePAM yes Match Address &lt;IP1&gt;,&lt;IP2&gt;,&lt;IP3&gt;     AuthenticationMethods publickey  Match all     AuthenticationMethods keyboard-interactive<\/code><\/pre>\n<p>Match Address &#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u043e\u043b\u044c.<br \/>Match all &#8212; \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u0437 google \u0438 \u043f\u043e\u0442\u043e\u043c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f admin \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0432\u0445\u043e\u0434\u0438\u043c.<br \/>IP &#8212; \u0432\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/pr-cy.ru\/browser-details\/\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0439 IP<\/a><\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c SSH:<\/strong><\/p>\n<pre><code class=\"bash\">sudo systemctl restart ssh<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u0445\u043e\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u043a\u043e\u0434 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Google Authenticator.<\/p>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>\u042d\u0442\u0438 \u0448\u0430\u0433\u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0438\u0434\u0435\u0438 \u043a\u0430\u043a \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0448\u0430\u0433\u0438, \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0438\u043c\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<p>P.S. \u041c\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u0447\u0435\u0440\u0435\u0437 Docker Compose, \u0433\u0434\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b Nginx, PostgreSQL, Redis, \u0431\u044d\u043a\u0435\u043d\u0434, \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0438 \u043b\u0435\u043d\u0434\u0438\u043d\u0433. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u2014 \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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:\/\/habr.com\/ru\/articles\/871374\/\"> https:\/\/habr.com\/ru\/articles\/871374\/<\/a><br \/><\/br><\/br><\/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-444039","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444039","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=444039"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444039\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}