{"id":1365,"date":"2024-04-02T12:43:34","date_gmt":"2024-04-02T04:43:34","guid":{"rendered":"https:\/\/hkc.nasclub.vip\/?p=1365"},"modified":"2024-04-02T12:43:34","modified_gmt":"2024-04-02T04:43:34","slug":"docker%e6%90%ad%e5%bb%baopenvpn","status":"publish","type":"post","link":"https:\/\/hkc.nasclub.vip\/?p=1365","title":{"rendered":"Docker\u642d\u5efaOpenVPN"},"content":{"rendered":"<h1 data-id=\"heading-0\">\u4e00\u3001\u6982\u8ff0<\/h1>\n<p>OpenVPN\u662f\u4e00\u4e2a\u5f00\u6e90\u7684VPN\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u521b\u5efa\u57fa\u4e8eSSL\/TLS\u7684\u5b89\u5168\u7684VPN\u96a7\u9053\uff0c\u652f\u6301\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\u548c\u5e73\u53f0\u3002OpenVPN\u5305\u542b\uff1a\u793e\u533a\u7248\uff08Community Edition\uff09\uff0c\u5546\u4e1a\u7248\uff08Access Server\uff09\u3002<\/p>\n<ul class=\" list-paddingleft-2\">\n<li><strong>openvpn<\/strong><\/li>\n<\/ul>\n<p>\u793e\u533a\u7248\u662f\u5b8c\u5168\u514d\u8d39\u7684\uff0c\u4f46\u662f\u9700\u8981\u7528\u6237\u6709\u4e00\u5b9a\u7684Linux\u548c\u547d\u4ee4\u884c\u7684\u77e5\u8bc6\uff0c\u4ee5\u53ca\u81ea\u5df1\u914d\u7f6e\u548c\u7ba1\u7406VPN\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u3002\u793e\u533a\u7248\u63d0\u4f9b\u4e86OpenVPN Connect\u5ba2\u6237\u7aef\uff0c\u53ef\u4ee5\u5728Windows, macOS, Linux, Android\u548ciOS\u4e0a\u4f7f\u7528\u3002<\/p>\n<ul class=\" list-paddingleft-2\">\n<li><strong>openvpn-as<\/strong><\/li>\n<\/ul>\n<p>\u5546\u4e1a\u7248\u662f\u4e00\u4e2a\u4ed8\u8d39\u7684VPN\u89e3\u51b3\u65b9\u6848\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6613\u4e8e\u4f7f\u7528\u7684Web\u754c\u9762\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u914d\u7f6eVPN\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u3002\u5546\u4e1a\u7248\u8fd8\u63d0\u4f9b\u4e86\u9884\u914d\u7f6e\u7684\u5ba2\u6237\u7aef\u8f6f\u4ef6\uff0c\u4ee5\u53ca\u5728\u591a\u4e2a\u4e91\u5e73\u53f0\u4e0a\u90e8\u7f72\u7684\u9009\u9879\u00b2\u3002\u5546\u4e1a\u7248\u63d0\u4f9b\u4e86\u4e24\u4e2a\u514d\u8d39\u7684VPN\u8fde\u63a5\u6388\u6743\uff0c\u53ef\u4ee5\u7528\u4e8e\u8bd5\u7528\u00b3\u3002<\/p>\n<ul class=\" list-paddingleft-2\">\n<li><strong>CloudConnexa<\/strong><\/li>\n<\/ul>\n<p>CloudConnexa\u662fOpenVPN\u7684\u4e00\u4e2a\u4e91\u7aefVPN\u89e3\u51b3\u65b9\u6848\uff0c\u53ef\u4ee5\u8ba9\u60a8\u8f7b\u677e\u5730\u521b\u5efa\u548c\u7ba1\u7406\u5b89\u5168\u7684\u865a\u62df\u7f51\u7edc\uff0c\u65e0\u9700\u81ea\u5df1\u5b89\u88c5\u548c\u7ef4\u62a4VPN\u670d\u52a1\u5668\u3002CloudConnexa\u63d0\u4f9b\u4e86\u591a\u4e2a\u5168\u7403\u533a\u57df\u7684\u63a5\u5165\u70b9\uff0c\u4ee5\u53ca\u591a\u79cd\u7f51\u7edc\u5b89\u5168\u529f\u80fd\uff0c\u5982\u96f6\u4fe1\u4efb\u8bbf\u95ee\u3001\u5185\u5bb9\u8fc7\u6ee4\u3001\u7075\u6d3b\u7684\u8def\u7531\u7b49\u3002CloudConnexa\u8fd8\u63d0\u4f9b\u4e86\u4e09\u4e2a\u514d\u8d39\u7684VPN\u8fde\u63a5\u6388\u6743\uff0c\u53ef\u4ee5\u7528\u4e8e\u8bd5\u7528\u3002<\/p>\n<h1 data-id=\"heading-1\">\u4e8c\u3001\u5b89\u88c5<\/h1>\n<p>\u4ee5\u4e0b\u6211\u4eec\u6765\u8bb2\u8bb2openvpn\u793e\u533a\u7248\u7684\u5b89\u88c5\uff1a<\/p>\n<p>openvpn\u7684\u5b89\u88c5\u5305\u542b\u4e24\u90e8\u5206\uff0c\u5373openvpn server\u53caopenvpn client\u3002<\/p>\n<h2 data-id=\"heading-2\">2.1\u3001Docker\u642d\u5efaopenvpn server<\/h2>\n<p>\u51c6\u5907\u597d\u4e00\u53f0\u4e3b\u673a\uff0c\u5e76\u5b89\u88c5\u597ddocker\uff08docker\u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u5305\uff09\uff0c\u4e0b\u8f7dopenvpn\u955c\u50cfdocker pull kylemanna\/openvpn:latest\u3002kylemanna\/openvpn\u662f\u76ee\u524d\u4f7f\u7528\u7387\u6700\u9ad8\u7684openvpn\u955c\u50cf\u3002<\/p>\n<p>1\u3001\u4f7f\u7528openvpn\u751f\u6210\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre>mkdir -p \/www\/wwwroot\/openvpn<\/pre>\n<p>&nbsp;<\/p>\n<pre>docker run -v \/www\/wwwroot\/openvpn:\/etc\/openvpn --rm kylemanna\/openvpn:latest ovpn_genconfig -u udp:\/\/xx.xx.xx.xx<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6267\u884c\u5b8c\u547d\u4ee4\u540e\u53ef\u5728\u76ee\u5f55\/www\/wwwroot\/openvpn\u4e2d\u770b\u5230\u76f8\u5e94\u7684\u914d\u7f6e\u6587\u4ef6\uff1b\u6211\u8fd9\u91cc\u4f7f\u7528\u7684\u662fupd\u65b9\u5f0f\uff0c\u5f53\u7136\u4f60\u4e5f\u53ef\u4ee5\u6539\u6210tcp:\/\/<\/p>\n<p>2\u3001\u521d\u59cb\u5316\u5bc6\u94a5\u6587\u4ef6<\/p>\n<pre>docker run -v \/www\/wwwroot\/openvpn:\/etc\/openvpn --rm -it kylemanna\/openvpn:latest ovpn_initpki<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6267\u884c\u8fc7\u7a0b\u4e2d\u9700\u8981\u5148\u8bbe\u7f6eca\u5bc6\u7801\uff08\u5982123456\uff09\uff0cCommon Name\u53ef\u4e0d\u8bbe\u7f6e\u76f4\u63a5\u6309\u56de\u8f66\u7ee7\u7eed\u9ed8\u8ba4\u662fserver\uff0c\u63a5\u7740\u9700\u8981\u8f93\u5165ca\u5bc6\u7801\u66f4\u65b0\u5bc6\u94a5\u5e93\u4ee5\u53ca\u751f\u6210crl\u6587\u4ef6\uff1b<\/p>\n<p>3\u3001\u751f\u6210\u5ba2\u6237\u7aef\u8bc1\u4e66<\/p>\n<pre>docker run -v \/\/www\/wwwroot\/openvpn:\/etc\/openvpn --rm -it kylemanna\/openvpn:latest easyrsa build-client-full openvpn-client nopass<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5176\u4e2dopenvpn-client\u4e3a\u81ea\u5b9a\u4e49\u540d\u79f0\uff0c\u4f60\u4e5f\u53ef\u4fee\u6539\u6210\u81ea\u5df1\u5b9a\u4e49\u7684\u540d\u79f0\uff0c\u751f\u6210\u7684\u8fc7\u7a0b\u9700\u8981\u8f93\u5165ca\u5bc6\u7801\uff1b<\/p>\n<p>4\u3001\u5bfc\u51fa\u5ba2\u6237\u7aef\u7684\u914d\u7f6e\u6587\u4ef6openvpn-client.ovpn<\/p>\n<pre>docker run -v \/www\/wwwroot\/openvpn:\/etc\/openvpn --rm kylemanna\/openvpn:latest ovpn_getclient openvpn-client &gt; \/www\/wwwroot\/openvpn\/openvpn-client.ovpn<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6ce8\u610fopenvpn-client\u540d\u79f0\u9700\u4e0e\u7b2c\u4e09\u6b65\u751f\u6210\u65f6\u547d\u540d\u4e00\u81f4\uff0c\u6b64\u65f6\u751f\u6210\u7684\u914d\u7f6e\u6587\u4ef6openvpn-client.ovpn\u5373\u53ef\u7528\u4e8e\u5ba2\u6237\u7aef\u8fde\u63a5\uff1b<\/p>\n<p>5\u3001\u542f\u52a8openvpn<\/p>\n<pre>docker run -v \/www\/wwwroot\/openvpn:\/etc\/openvpn -d -p 1194:1194\/udp --restart=always --name openvpn --cap-add=NET_ADMIN --sysctl net.ipv6.conf.all.disable_ipv6=0 --sysctl net.ipv6.conf.default.forwarding=1 --sysctl net.ipv6.conf.all.forwarding=1  kylemanna\/openvpn:latest<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6ce8\u610f\u9632\u706b\u5899\u662f\u5426\u5173\u95ed\uff0c\u6ca1\u5173\u95ed\u9700\u8981\u5f00\u653e1194\u4e3audp\u7aef\u53e3\u3002\u5230\u8fd9\u91ccopenvpn\u670d\u52a1\u7aef\u5c31\u5b89\u88c5\u5b8c\u6210\u4e86\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u6982\u8ff0 OpenVPN\u662f\u4e00\u4e2a\u5f00&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4,6],"tags":[],"class_list":["post-1365","post","type-post","status-publish","format-standard","hentry","category-hkc","category-linux","category-synology"],"_links":{"self":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/1365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1365"}],"version-history":[{"count":1,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/1365\/revisions"}],"predecessor-version":[{"id":1366,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/1365\/revisions\/1366"}],"wp:attachment":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}