{"id":349591,"date":"2023-06-30T09:01:24","date_gmt":"2023-06-30T09:01:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=349591"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=349591","title":{"rendered":"<span>\u041a\u0430\u043a \u043f\u043e\u0434\u043d\u044f\u0442\u044c OpenVPN \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 Ubuntu 22.04?<\/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>\u0412 \u044d\u043f\u043e\u0445\u0443 \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u0435\u0442\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0439 \u043e\u043d\u043b\u0430\u0439\u043d \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c. \u0418 \u0437\u0434\u0435\u0441\u044c \u0432\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 OpenVPN \u2013 \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u043e\u0439\u0442\u0438 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0437\u0430\u0449\u0438\u0442\u0443 \u0441\u0432\u043e\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c, \u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0432\u0430\u0441! \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u0430\u043f\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e OpenVPN \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0441\u043b\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u043e\u043c, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043c\u0435\u0441\u0442\u0430 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043a \u043d\u0430\u043c \u0438 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u044d\u0442\u043e\u0442 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0432 \u043c\u0438\u0440 \u0431\u0435\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b \u0432 \u043e\u043d\u043b\u0430\u0439\u043d\u0435!  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f17\/444\/6de\/f174446de5031c159bc12405f9d58efd.png\" width=\"923\" height=\"615\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f17\/444\/6de\/f174446de5031c159bc12405f9d58efd.png\"\/><\/figure>\n<h3>\u0413\u0434\u0435 \u0432\u0437\u044f\u0442\u044c VPS(\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443) \u0438 \u043a\u0430\u043a \u043a \u043d\u0435\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f?<\/h3>\n<p> \u042f \u043b\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b justhost(<a href=\"https:\/\/justhost.ru\/services\/vps?software=ubuntu220464&amp;location=dc116&amp;cpu=1&amp;ram=512&amp;storage_size=5&amp;netbandmb=200&amp;ipv4_count=1&amp;ipv6_count=1&amp;svc_count=1&amp;payment_months=12&amp;storage=ssd&amp;cpu_options=none&amp;ref=167646&amp;promocode=\" rel=\"noopener noreferrer nofollow\">\u0442\u044b\u043a!<\/a>) \u0438 \u0431\u0440\u0430\u043b \u0441\u0430\u043c\u0443\u044e \u0434\u0435\u0448\u0451\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0443 \u0432 \u041d\u0438\u0434\u0435\u0440\u043b\u0430\u043d\u0434\u0430\u0445. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043e\u043f\u043b\u0430\u0442\u0438\u0442\u044c VPS<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043a\u0430 \u0412\u044b \u0436\u0434\u0451\u0442\u0435 \u0435\u0451 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043a\u0430\u0447\u0430\u0439\u0442\u0435 PuTTy(<a href=\"https:\/\/www.putty.org\/\" rel=\"noopener noreferrer nofollow\">\u0442\u044b\u043a!<\/a>,<a href=\"https:\/\/apps.microsoft.com\/store\/detail\/putty\/XPFNZKSKLBP7RJ\" rel=\"noopener noreferrer nofollow\"> \u0442\u044b\u043a!<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 VPS \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430\u0441\u044c, \u0412\u0430\u043c \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u0438\u0441\u044c\u043c\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0438 IPv4 \u0430\u0434\u0440\u0435\u0441, \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u0445<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c PuTTy \u0438 \u0432 \u043f\u043e\u043b\u0435 <em>Host Name (or IP address) <\/em>\u0432\u0432\u043e\u0434\u0438\u043c ip(IPv4) \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b\u0438 \u0438\u0437 \u043f\u0438\u0441\u044c\u043c\u0430 \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c <em>Open<\/em><\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u0441\u044f(Accept) \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438(\u043e\u043d\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f 1 \u0440\u0430\u0437)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u043d\u0430\u0434\u043f\u0438\u0441\u044c <em>login as: <\/em>, \u0442\u043e<em> <\/em>\u0412\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438\u0441\u044c<\/p>\n<\/li>\n<li>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c root \u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u0437 \u043f\u0438\u0441\u044c\u043c\u0430<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c48\/846\/170\/c488461709bbabd4eb0362179215a40b.png\" width=\"936\" height=\"187\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c48\/846\/170\/c488461709bbabd4eb0362179215a40b.png\"\/><\/figure>\n<h3>\u0421\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 \u0438 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434 \u043d\u0438\u043c(\u043f\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438)<\/h3>\n<ol>\n<li>\n<p><code>useradd -m &lt;\u043b\u044e\u0431\u043e\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<li>\n<p><code>passwd &lt;\u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<li>\n<p><code>usermod -aG sudo &lt;\u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<\/ol>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ce8\/737\/11d\/ce873711df3c1e95258b815269115363.png\" width=\"462\" height=\"100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ce8\/737\/11d\/ce873711df3c1e95258b815269115363.png\"\/><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e1a\/339\/c39\/e1a339c3997ac98c24b8814f643d857c.png\" width=\"474\" height=\"22\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e1a\/339\/c39\/e1a339c3997ac98c24b8814f643d857c.png\"\/><\/figure>\n<ol>\n<li>\n<p><code>sudo chsh -s \/bin\/bash &lt;\u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<\/ol>\n<p> \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e \u0438 \u0432\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u0434 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c (\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0443\u043d\u043a\u0442, \u0432\u0441\u0451 \u0441 3 \u0448\u0430\u0433\u0430)\u00a0 <\/p>\n<h3>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432<\/h4>\n<ol>\n<li>\n<p>\u00a0<code>sudo apt install easy-rsa<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo apt install openvpn<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo apt install iptables-persistent<\/code><\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u00a0 FireWall<\/h4>\n<ol>\n<li>\n<p>\u00a0<code>sudo iptables -I INPUT -p udp --dport 1194 -j ACCEPT<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo netfilter-persistent save<\/code><\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 VPN<\/h4>\n<ol>\n<li>\n<p><code>sudo mkdir -p \/etc\/openvpn\/keys<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo mkdir \/etc\/openvpn\/easy-rsa<\/code><\/p>\n<\/li>\n<li>\n<p><code>cd \/etc\/openvpn\/easy-rsa<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo cp -r \/usr\/share\/easy-rsa\/* .<\/code><\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/08a\/526\/67b\/08a52667b79ea744491d59a96d7563c7.png\" width=\"817\" height=\"105\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/08a\/526\/67b\/08a52667b79ea744491d59a96d7563c7.png\"\/><\/figure>\n<ol>\n<li>\n<p><code>sudo mkdir \/etc\/openvpn\/ccd<\/code><\/p>\n<\/li>\n<\/ol>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 VPN<\/h3>\n<h4>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0438<\/h4>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 vars<\/h3>\n<ol>\n<li>\n<p><code>sudo nano vars<\/code><\/p>\n<\/li>\n<li>\n<p>\u00a0\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0438\u0439\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<\/li>\n<\/ol>\n<pre><code>export KEY_COUNTRY=\u00abRU\u00bb  export KEY_PROVINCE=\u00abMoscow\u00bb export KEY_CITY=\u00abMoscow\u00bb export KEY_ORG=\u00absten\u00bb export KEY_ORG=\u00bbfdjgbi@sten.com\u00ab export KEY_CN=\u00absten\u00bb export KEY_OU=\u00absten\u00bb export KEY_NAME=\u00abvpn.StenLi.com\u00bb export KEY_ALTNAMES=\u00abvpn2.StenLi.com\u00bb<\/code><\/pre>\n<p>KEY_ORG, KEY_ORG, KEY_CN, KEY_OU, KEY_NAME, KEY_ALTNAMES \u2014 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e<\/p>\n<ol>\n<li>\n<p>\u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443: ctrl+x, y, enter<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f97\/7ec\/104\/f977ec104fe24974e6a18faac48fb339.png\" width=\"802\" height=\"461\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f97\/7ec\/104\/f977ec104fe24974e6a18faac48fb339.png\"\/><\/figure>\n<h3>\u00a0\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \/etc\/nat(FireWall)<\/h3>\n<ol>\n<li>\n<p><code>sudo nano \/etc\/nat<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0438\u0439\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<\/li>\n<\/ol>\n<pre><code>#!\/bin\/sh  # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward  # \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430 iptables -F iptables -X iptables -t nat -F iptables -t nat -X  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043d\u0435 iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e SSH iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a OpenVPN iptables -A INPUT -i eth0 -p udp --dport 1194 -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0437 tun0 iptables -A INPUT -i tun0 -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0438\u0442\u043d\u044b\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 eth0 \u0438 tun0: iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT iptables -A FORWARD -i tun0 -o eth0 -j ACCEP  # \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0438\u0437\u0432\u043d\u0435 iptables -A INPUT -i eth0 -j DROP  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0442\u0440\u0430\u043d\u0437\u0438\u0442\u043d\u044b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043d\u0435 iptables -A FORWARD -i eth0 -o tun0 -m state --state ESTABLISHED,RELATED -j A  # \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0438\u0442\u043d\u044b\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0437\u0432\u043d\u0435 iptables -A FORWARD -i eth0 -o tun0 -j DROP  # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u0430\u0441\u043a\u0430\u0440\u0430\u0434\u0438\u043d\u0433 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0\/24 -j MASQUERADE<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443: ctrl+x, y, enter<\/p>\n<\/li>\n<li>\n<p><code>sudo chmod 755 \/etc\/nat<\/code><\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9a8\/9a8\/48a\/9a89a848a8e494813343faa8d4a5c47f.png\" width=\"939\" height=\"992\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9a8\/9a8\/48a\/9a89a848a8e494813343faa8d4a5c47f.png\"\/><\/figure>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<ol>\n<li>\n<p><code>sudo .\/easyrsa init-pki<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo .\/easyrsa build-ca<\/code><\/p>\n<\/li>\n<li>\n<p>\u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0435\u0433\u043e(Enter New CA Key Passphrase) <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d1d\/1c7\/eaf\/d1d1c7eaffc7b11dca13e9aeb2562638.png\" width=\"939\" height=\"604\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d1d\/1c7\/eaf\/d1d1c7eaffc7b11dca13e9aeb2562638.png\"\/><\/figure>\n<\/li>\n<li>\n<p><code>sudo\u00a0 .\/easyrsa gen-req server nopass<\/code> <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a49\/ad7\/df6\/a49ad7df6d2fcdef229e560afa8046dc.png\" width=\"937\" height=\"651\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a49\/ad7\/df6\/a49ad7df6d2fcdef229e560afa8046dc.png\"\/><\/figure>\n<\/li>\n<li>\n<p><code>sudo\u00a0 .\/easyrsa sign-req server server<\/code><\/p>\n<\/li>\n<\/ol>\n<p> \u00a0\u041f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0432\u0435\u0434\u044f yes, <\/p>\n<p>\u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/43d\/53e\/2e6\/43d53e2e60ebfaba3b3a073ff217d14d.png\" width=\"937\" height=\"736\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/43d\/53e\/2e6\/43d53e2e60ebfaba3b3a073ff217d14d.png\"\/><\/figure>\n<ol>\n<li>\n<p><code>sudo\u00a0 .\/easyrsa gen-dh<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo\u00a0 openvpn --genkey secret pki\/ta.key<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo\u00a0 cp pki\/ca.crt \/etc\/openvpn\/keys\/<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo\u00a0 cp pki\/issued\/server.crt \/etc\/openvpn\/keys\/<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo\u00a0 cp pki\/private\/server.key \/etc\/openvpn\/keys\/\u00a0<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo\u00a0 cp pki\/dh.pem \/etc\/openvpn\/keys\/<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo\u00a0 cp pki\/ta.key \/etc\/openvpn\/keys\/<\/code> <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/258\/053\/fc1\/258053fc131dfbedc3151e054ae0a405.png\" width=\"934\" height=\"187\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/258\/053\/fc1\/258053fc131dfbedc3151e054ae0a405.png\"\/><\/figure>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<ol>\n<li>\n<p><code>sudo nano \/etc\/openvpn\/server.conf<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0438\u0439\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<\/li>\n<\/ol>\n<pre><code> local 999.999.999.999   port 1194 proto udp dev tun ca keys\/ca.crt cert keys\/server.crt key keys\/server.key dh keys\/dh.pem tls-auth keys\/ta.key 0 server 10.0.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt client-to-client client-config-dir \/etc\/openvpn\/ccd keepalive 10 120 max-clients 32 persist-key persist-tun status \/var\/log\/openvpn\/openvpn-status.log log-append \/var\/log\/openvpn\/openvpn.log verb 4 mute 20 daemon mode server tls-server comp-lzo tun-mtu 1500 mssfix 1620 cipher AES-256-GCM topology subnet  push \u00abredirect-gateway def1\u00bb push \u00abdhcp-option DNS 8.8.8.8\u00bb  up \/etc\/nat<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1ed\/dd0\/1e3\/1eddd01e35ade599b5aac8428c2f8fbc.png\" width=\"386\" height=\"516\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1ed\/dd0\/1e3\/1eddd01e35ade599b5aac8428c2f8fbc.png\"\/><\/figure>\n<ul>\n<li>\n<p><code>client-to-client<\/code> \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u0438 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 <\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><code>client-config-dir \/etc\/openvpn\/ccd<\/code> \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e\u00a0 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0430\u0451\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 ip \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c. \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435<\/p>\n<\/li>\n<\/ul>\n<p>&#8212;\u00a0 \u041c\u0435\u043d\u044f\u0435\u043c <code>local 999.999.999.999<\/code> \u043d\u0430 <code>local &lt;\u0432\u043d\u0435\u0448\u043d\u0438\u0439 ip VPS(IP \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 PuTTy)><\/code><\/p>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h3>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<ol>\n<li>\n<p><code>sudo systemctl start openvpn@server<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo systemctl status openvpn@server<\/code> <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b23\/665\/fae\/b23665fae60556ce7a25ee520fb25e57.png\" width=\"1018\" height=\"370\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b23\/665\/fae\/b23665fae60556ce7a25ee520fb25e57.png\"\/><\/figure>\n<\/li>\n<li>\n<p>\u0412\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440!!!! \u0423\u0420\u0410!!!!<\/p>\n<\/li>\n<\/ol>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432<\/h3>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432<\/h4>\n<p> \u0421\u043e 2 \u043f\u043e 4 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 1 \u0440\u0430\u0437! <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c 1, \u0438 5+ <\/p>\n<ol>\n<li>\n<p><code>cd \/&lt;\u041b\u044e\u0431\u0430\u044f \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0432\u0430\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f><\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo nano gen_sert.sh<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">#!\/bin\/bash  if [ $# -ne 1 ]; then \u00a0\u00a0\u00a0\u00a0echo \u00abUsage: $0 --client-name\u00bb \u00a0\u00a0\u00a0\u00a0exit 1 fi  client_name=$1 password=\u00ab\u00bb rm -r \/tmp\/keys mkdir \/tmp\/keys cd \/etc\/openvpn\/easy-rsa export EASYRSA_CERT_EXPIRE=1460 echo \u00ab$password\u00bb | .\/easyrsa build-client-full $client_name nopass cp pki\/issued\/client_name.key pki\/ca.crt pki\/ta.key \/tmp\/keys\/ chmod -R a+r \/tmp\/keys  cat &lt;&lt; EOF > \/tmp\/keys\/$client_name.ovpn client resolv-retry infinite nobind remote 999.999.999.999 1194 proto udp dev tun comp-lzo ca ca.crt cert $client_name.crt key $client_name.key tls-client tls-auth ta.key 1 float keepalive 10 120 persist-key persist-tun tun-mtu 1500 mssfix 1620 cipher AES-256-GCM verb 0  EOF  echo \u00abOpenVPN client configuration file created: \/tmp\/keys\/$client_name.ovpn\u00bb<\/code><\/pre>\n<ol>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c <code>remote 999.999.999.999 1194<\/code> \u043d\u0430 <code>remote &lt;IP \u0441\u0435\u0440\u0432\u0435\u0440\u0430> 1194<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo bash .\/gen_sert.sh &lt;\u0418\u043c\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430><\/code><\/p>\n<\/li>\n<li>\n<p><code>cd \/tmp\/keys<\/code><\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e winscp \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0438\u0437 \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b(<a href=\"https:\/\/winscp.net\/eng\/docs\/task_download\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432<\/a>, <a href=\"https:\/\/winscp.net\/eng\/download.php\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c<\/a>)<\/p>\n<\/li>\n<\/ol>\n<h4>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c<\/h4>\n<ol>\n<li>\n<p><code>cd \/etc\/openvpn\/ccd<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo nano\u00a0 &lt;\u0418\u043c\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438><\/code><\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\"> ifconfig-push 10.0.0.&lt;\u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f> 255.255.255.0 <\/code><\/pre>\n<h2><\/h2>\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\/744974\/\"> https:\/\/habr.com\/ru\/articles\/744974\/<\/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>\u0412 \u044d\u043f\u043e\u0445\u0443 \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u0435\u0442\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0439 \u043e\u043d\u043b\u0430\u0439\u043d \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c. \u0418 \u0437\u0434\u0435\u0441\u044c \u0432\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 OpenVPN \u2013 \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u043e\u0439\u0442\u0438 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0437\u0430\u0449\u0438\u0442\u0443 \u0441\u0432\u043e\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c, \u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0432\u0430\u0441! \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u0430\u043f\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e OpenVPN \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0441\u043b\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u043e\u043c, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043c\u0435\u0441\u0442\u0430 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043a \u043d\u0430\u043c \u0438 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u044d\u0442\u043e\u0442 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0432 \u043c\u0438\u0440 \u0431\u0435\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b \u0432 \u043e\u043d\u043b\u0430\u0439\u043d\u0435!  <\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0413\u0434\u0435 \u0432\u0437\u044f\u0442\u044c VPS(\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443) \u0438 \u043a\u0430\u043a \u043a \u043d\u0435\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f?<\/h3>\n<p> \u042f \u043b\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b justhost(<a href=\"https:\/\/justhost.ru\/services\/vps?software=ubuntu220464&amp;location=dc116&amp;cpu=1&amp;ram=512&amp;storage_size=5&amp;netbandmb=200&amp;ipv4_count=1&amp;ipv6_count=1&amp;svc_count=1&amp;payment_months=12&amp;storage=ssd&amp;cpu_options=none&amp;ref=167646&amp;promocode=\" rel=\"noopener noreferrer nofollow\">\u0442\u044b\u043a!<\/a>) \u0438 \u0431\u0440\u0430\u043b \u0441\u0430\u043c\u0443\u044e \u0434\u0435\u0448\u0451\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0443 \u0432 \u041d\u0438\u0434\u0435\u0440\u043b\u0430\u043d\u0434\u0430\u0445. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043e\u043f\u043b\u0430\u0442\u0438\u0442\u044c VPS<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043a\u0430 \u0412\u044b \u0436\u0434\u0451\u0442\u0435 \u0435\u0451 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043a\u0430\u0447\u0430\u0439\u0442\u0435 PuTTy(<a href=\"https:\/\/www.putty.org\/\" rel=\"noopener noreferrer nofollow\">\u0442\u044b\u043a!<\/a>,<a href=\"https:\/\/apps.microsoft.com\/store\/detail\/putty\/XPFNZKSKLBP7RJ\" rel=\"noopener noreferrer nofollow\"> \u0442\u044b\u043a!<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 VPS \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430\u0441\u044c, \u0412\u0430\u043c \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u0438\u0441\u044c\u043c\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root, \u0438 IPv4 \u0430\u0434\u0440\u0435\u0441, \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u0445<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c PuTTy \u0438 \u0432 \u043f\u043e\u043b\u0435 <em>Host Name (or IP address) <\/em>\u0432\u0432\u043e\u0434\u0438\u043c ip(IPv4) \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b\u0438 \u0438\u0437 \u043f\u0438\u0441\u044c\u043c\u0430 \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c <em>Open<\/em><\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u0441\u044f(Accept) \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438(\u043e\u043d\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f 1 \u0440\u0430\u0437)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u043d\u0430\u0434\u043f\u0438\u0441\u044c <em>login as: <\/em>, \u0442\u043e<em> <\/em>\u0412\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438\u0441\u044c<\/p>\n<\/li>\n<li>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c root \u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u0437 \u043f\u0438\u0441\u044c\u043c\u0430<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0421\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 \u0438 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434 \u043d\u0438\u043c(\u043f\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438)<\/h3>\n<ol>\n<li>\n<p><code>useradd -m &lt;\u043b\u044e\u0431\u043e\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<li>\n<p><code>passwd &lt;\u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<li>\n<p><code>usermod -aG sudo &lt;\u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<\/ol>\n<figure class=\"\"><\/figure>\n<figure class=\"\"><\/figure>\n<ol>\n<li>\n<p><code>sudo chsh -s \/bin\/bash &lt;\u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f><\/code><\/p>\n<\/li>\n<\/ol>\n<p> \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e \u0438 \u0432\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u0434 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c (\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0443\u043d\u043a\u0442, \u0432\u0441\u0451 \u0441 3 \u0448\u0430\u0433\u0430)\u00a0 <\/p>\n<h3>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432<\/h4>\n<ol>\n<li>\n<p>\u00a0<code>sudo apt install easy-rsa<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo apt install openvpn<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo apt install iptables-persistent<\/code><\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u00a0 FireWall<\/h4>\n<ol>\n<li>\n<p>\u00a0<code>sudo iptables -I INPUT -p udp --dport 1194 -j ACCEPT<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo netfilter-persistent save<\/code><\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 VPN<\/h4>\n<ol>\n<li>\n<p><code>sudo mkdir -p \/etc\/openvpn\/keys<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo mkdir \/etc\/openvpn\/easy-rsa<\/code><\/p>\n<\/li>\n<li>\n<p><code>cd \/etc\/openvpn\/easy-rsa<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo cp -r \/usr\/share\/easy-rsa\/* .<\/code><\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<ol>\n<li>\n<p><code>sudo mkdir \/etc\/openvpn\/ccd<\/code><\/p>\n<\/li>\n<\/ol>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 VPN<\/h3>\n<h4>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0438<\/h4>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 vars<\/h3>\n<ol>\n<li>\n<p><code>sudo nano vars<\/code><\/p>\n<\/li>\n<li>\n<p>\u00a0\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0438\u0439\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<\/li>\n<\/ol>\n<pre><code>export KEY_COUNTRY=\u00abRU\u00bb  export KEY_PROVINCE=\u00abMoscow\u00bb export KEY_CITY=\u00abMoscow\u00bb export KEY_ORG=\u00absten\u00bb export KEY_ORG=\u00bbfdjgbi@sten.com\u00ab export KEY_CN=\u00absten\u00bb export KEY_OU=\u00absten\u00bb export KEY_NAME=\u00abvpn.StenLi.com\u00bb export KEY_ALTNAMES=\u00abvpn2.StenLi.com\u00bb<\/code><\/pre>\n<p>KEY_ORG, KEY_ORG, KEY_CN, KEY_OU, KEY_NAME, KEY_ALTNAMES \u2014 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e<\/p>\n<ol>\n<li>\n<p>\u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443: ctrl+x, y, enter<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<h3>\u00a0\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \/etc\/nat(FireWall)<\/h3>\n<ol>\n<li>\n<p><code>sudo nano \/etc\/nat<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0438\u0439\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<\/li>\n<\/ol>\n<pre><code>#!\/bin\/sh  # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward  # \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430 iptables -F iptables -X iptables -t nat -F iptables -t nat -X  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043d\u0435 iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e SSH iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a OpenVPN iptables -A INPUT -i eth0 -p udp --dport 1194 -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0437 tun0 iptables -A INPUT -i tun0 -j ACCEPT  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0438\u0442\u043d\u044b\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 eth0 \u0438 tun0: iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT iptables -A FORWARD -i tun0 -o eth0 -j ACCEP  # \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0438\u0437\u0432\u043d\u0435 iptables -A INPUT -i eth0 -j DROP  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0442\u0440\u0430\u043d\u0437\u0438\u0442\u043d\u044b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043d\u0435 iptables -A FORWARD -i eth0 -o tun0 -m state --state ESTABLISHED,RELATED -j A  # \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0438\u0442\u043d\u044b\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0437\u0432\u043d\u0435 iptables -A FORWARD -i eth0 -o tun0 -j DROP  # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u0430\u0441\u043a\u0430\u0440\u0430\u0434\u0438\u043d\u0433 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0\/24 -j MASQUERADE<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443: ctrl+x, y, enter<\/p>\n<\/li>\n<li>\n<p><code>sudo chmod 755 \/etc\/nat<\/code><\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<ol>\n<li>\n<p><code>sudo .\/easyrsa init-pki<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo .\/easyrsa build-ca<\/code><\/p>\n<\/li>\n<li>\n<p>\u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0435\u0433\u043e(Enter New CA Key Passphrase) <\/p>\n<figure class=\"full-width\"><\/figure>\n<\/li>\n<li>\n<p><code>sudo\u00a0 .\/easyrsa gen-req server nopass<\/code> <\/p>\n<figure class=\"full-width\"><\/figure>\n<\/li>\n<li>\n<p><code>sudo\u00a0 .\/easyrsa sign-req server server<\/code><\/p>\n<\/li>\n<\/ol>\n<p> \u00a0\u041f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0432\u0435\u0434\u044f yes, <\/p>\n<p>\u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430. <\/p>\n<figure class=\"full-width\"><\/figure>\n<ol>\n<li>\n<p><code>sudo\u00a0 .\/easyrsa gen-dh<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo\u00a0 openvpn --genkey secret pki\/ta.key<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo\u00a0 cp pki\/ca.crt \/etc\/openvpn\/keys\/<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo\u00a0 cp pki\/issued\/server.crt \/etc\/openvpn\/keys\/<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo\u00a0 cp pki\/private\/server.key \/etc\/openvpn\/keys\/\u00a0<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo\u00a0 cp pki\/dh.pem \/etc\/openvpn\/keys\/<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo\u00a0 cp pki\/ta.key \/etc\/openvpn\/keys\/<\/code> <\/p>\n<figure class=\"full-width\"><\/figure>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<ol>\n<li>\n<p><code>sudo nano \/etc\/openvpn\/server.conf<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0438\u0439\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<\/li>\n<\/ol>\n<pre><code> local 999.999.999.999   port 1194 proto udp dev tun ca keys\/ca.crt cert keys\/server.crt key keys\/server.key dh keys\/dh.pem tls-auth keys\/ta.key 0 server 10.0.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt client-to-client client-config-dir \/etc\/openvpn\/ccd keepalive 10 120 max-clients 32 persist-key persist-tun status \/var\/log\/openvpn\/openvpn-status.log log-append \/var\/log\/openvpn\/openvpn.log verb 4 mute 20 daemon mode server tls-server comp-lzo tun-mtu 1500 mssfix 1620 cipher AES-256-GCM topology subnet  push \u00abredirect-gateway def1\u00bb push \u00abdhcp-option DNS 8.8.8.8\u00bb  up \/etc\/nat<\/code><\/pre>\n<figure class=\"\"><\/figure>\n<ul>\n<li>\n<p><code>client-to-client<\/code> \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u0438 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 <\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><code>client-config-dir \/etc\/openvpn\/ccd<\/code> \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e\u00a0 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0430\u0451\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 ip \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c. \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435<\/p>\n<\/li>\n<\/ul>\n<p>&#8212;\u00a0 \u041c\u0435\u043d\u044f\u0435\u043c <code>local 999.999.999.999<\/code> \u043d\u0430 <code>local &lt;\u0432\u043d\u0435\u0448\u043d\u0438\u0439 ip VPS(IP \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 PuTTy)><\/code><\/p>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h3>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<ol>\n<li>\n<p><code>sudo systemctl start openvpn@server<\/code><\/p>\n<\/li>\n<li>\n<p><code>\u00a0sudo systemctl status openvpn@server<\/code> <\/p>\n<figure class=\"full-width\"><\/figure>\n<\/li>\n<li>\n<p>\u0412\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440!!!! \u0423\u0420\u0410!!!!<\/p>\n<\/li>\n<\/ol>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432<\/h3>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432<\/h4>\n<p> \u0421\u043e 2 \u043f\u043e 4 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 1 \u0440\u0430\u0437! <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c 1, \u0438 5+ <\/p>\n<ol>\n<li>\n<p><code>cd \/&lt;\u041b\u044e\u0431\u0430\u044f \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0432\u0430\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f><\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo nano gen_sert.sh<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">#!\/bin\/bash  if [ $# -ne 1 ]; then \u00a0\u00a0\u00a0\u00a0echo \u00abUsage: $0 --client-name\u00bb \u00a0\u00a0\u00a0\u00a0exit 1 fi  client_name=$1 password=\u00ab\u00bb rm -r \/tmp\/keys mkdir \/tmp\/keys cd \/etc\/openvpn\/easy-rsa export EASYRSA_CERT_EXPIRE=1460 echo \u00ab$password\u00bb | .\/easyrsa build-client-full $client_name nopass cp pki\/issued\/client_name.key pki\/ca.crt pki\/ta.key \/tmp\/keys\/ chmod -R a+r \/tmp\/keys  cat &lt;&lt; EOF > \/tmp\/keys\/$client_name.ovpn client resolv-retry infinite nobind remote 999.999.999.999 1194 proto udp dev tun comp-lzo ca ca.crt cert $client_name.crt key $client_name.key tls-client tls-auth ta.key 1 float keepalive 10 120 persist-key persist-tun tun-mtu 1500 mssfix 1620 cipher AES-256-GCM verb 0  EOF  echo \u00abOpenVPN client configuration file created: \/tmp\/keys\/$client_name.ovpn\u00bb<\/code><\/pre>\n<ol>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c <code>remote 999.999.999.999 1194<\/code> \u043d\u0430 <code>remote &lt;IP \u0441\u0435\u0440\u0432\u0435\u0440\u0430> 1194<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo bash .\/gen_sert.sh &lt;\u0418\u043c\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430><\/code><\/p>\n<\/li>\n<li>\n<p><code>cd \/tmp\/keys<\/code><\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e winscp \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0438\u0437 \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b(<a href=\"https:\/\/winscp.net\/eng\/docs\/task_download\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432<\/a>, <a href=\"https:\/\/winscp.net\/eng\/download.php\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c<\/a>)<\/p>\n<\/li>\n<\/ol>\n<h4>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c<\/h4>\n<ol>\n<li>\n<p><code>cd \/etc\/openvpn\/ccd<\/code><\/p>\n<\/li>\n<li>\n<p><code>sudo nano\u00a0 &lt;\u0418\u043c\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438><\/code><\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\"> ifconfig-push 10.0.0.&lt;\u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f> 255.255.255.0 <\/code><\/pre>\n<h2><\/h2>\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\/744974\/\"> https:\/\/habr.com\/ru\/articles\/744974\/<\/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-349591","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349591","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=349591"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349591\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=349591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=349591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=349591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}