{"id":19363,"date":"2017-01-04T06:22:17","date_gmt":"2017-01-03T22:22:17","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/01\/04\/openvpn-client-%e7%ab%af%e8%a8%ad%e5%ae%9a\/"},"modified":"2021-03-18T17:24:53","modified_gmt":"2021-03-18T09:24:53","slug":"openvpn-client-%e7%ab%af%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/01\/04\/openvpn-client-%e7%ab%af%e8%a8%ad%e5%ae%9a\/","title":{"rendered":"OpenVPN Client \u7aef\u8a2d\u5b9a"},"content":{"rendered":"<p>\u53c3\u8003\u7db2\u9801\uff1a <br \/><a href=\"http:\/\/dreamtails.pixnet.net\/blog\/post\/30797812-centos-7-install-openvpn\" target=\"_blank\" rel=\"noopener noreferrer\">CentOS 7 install OpenVPN @ \u56de\u61b6&#8230;&#8230;! :: \u75de\u5ba2\u90a6 PIXNET ::<\/a> <br \/> <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-set-up-an-openvpn-server-on-ubuntu-16-04\" target=\"_blank\" rel=\"noopener noreferrer\">How To Set Up an OpenVPN Server on Ubuntu 16.04 | DigitalOcean<\/a><span style=\"color: #666666;font-family: Georgia, Verdana, Arial, serif;font-size: 13px\">\u00a0<\/span> <\/p>\n<p>\u8907\u88fd OpenVPN Server \u4ee5\u4e0b\u7684\u9019\u56db\u500b\u6a94\u6848\u81f3 OpenVPN Client Devices \u4e0a\u3002 <br \/><span style=\"color: #0000ff\">\/etc\/openvpn\/easy-rsa\/keys\/ca.crt <\/span><br \/><span style=\"color: #0000ff\">\/etc\/openvpn\/easy-rsa\/keys\/client.crt <\/span><br \/><span style=\"color: #0000ff\">\/etc\/openvpn\/easy-rsa\/keys\/client.key <\/span><br \/><span style=\"color: #0000ff\">\/etc\/openvpn\/easy-rsa\/keys\/ta.key <\/span><\/p>\n<p>\u56e0\u70ba\u6a94\u6848\u6bd4\u8f03\u591a\uff0c\u70ba\u4e86\u4f7f\u7528\u8005\u8a2d\u5b9a\u7684\u65b9\u4fbf\uff0c\u6240\u4ee5\u6574\u5408\u6210\u4e00\u500b .ovpn \u6a94[@more@]\u5efa\u7acb\u5b58\u653e\u6a94\u6848\u7684\u76ee\u9304<br \/># <span style=\"color: #ff0000\">mkdir ~\/openvpn_client_files<\/span> <br \/>\u5207\u63db\u76ee\u9304<br \/># <span style=\"color: #ff0000\">cd \/etc\/openvpn\/easy-rsa\/keys\/<\/span><br \/> \u8907\u88fd Client \u7aef\u6240\u9700\u6a94\u6848<br \/># <span style=\"color: #ff0000\">cp ca.crt client.crt client.key ta.key ~\/openvpn_client_files<\/span> <\/p>\n<p> \u5efa\u7acb Client \u7aef\u57fa\u672c\u8a2d\u5b9a\u6a94<br \/># <span style=\"color: #ff0000\">vim ~\/openvpn_client_files\/base.conf<\/span> <br \/><span style=\"color: #0000ff\">client <\/span><br \/><span style=\"color: #0000ff\">dev tun <\/span><br \/><span style=\"color: #0000ff\">proto tcp <\/span><br \/><span style=\"color: #0000ff\">remote server_IP_address 1194 <\/span><br \/><span style=\"color: #0000ff\">user nobody <\/span><br \/><span style=\"color: #0000ff\">group nogroup <\/span><br \/><span style=\"color: #0000ff\">persist-key <\/span><br \/><span style=\"color: #0000ff\">persist-tun <\/span><br \/><span style=\"color: #0000ff\">remote-cert-tls server <\/span><br \/><span style=\"color: #0000ff\">comp-lzo <\/span><br \/><span style=\"color: #0000ff\">verb 3 <\/span><br \/><span style=\"color: #0000ff\">cipher AES-128-CBC <\/span><br \/><span style=\"color: #0000ff\">auth SHA256 <\/span><br \/><span style=\"color: #0000ff\">key-direction 1<\/span> <\/p>\n<p> \u53c3\u8003\u00a0<a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-set-up-an-openvpn-server-on-ubuntu-16-04\" target=\"_blank\" rel=\"noopener noreferrer\">How To Set Up an OpenVPN Server on Ubuntu 16.04 | DigitalOcean<\/a>\u00a0\u5efa\u7acb .ovpn \u7684 Script \u6a94<br \/># <span style=\"color: #ff0000\">vim ~\/openvpn_client_files\/make_config.sh<\/span> <br \/><span style=\"color: #0000ff\">#!\/bin\/bash <\/span><\/p>\n<p><span style=\"color: #0000ff\"># First argument: Client identifier <\/span><\/p>\n<p><span style=\"color: #0000ff\">KEY_DIR=~\/openvpn_client_files <\/span><br \/><span style=\"color: #0000ff\">OUTPUT_DIR=~\/openvpn_client_files <\/span><br \/><span style=\"color: #0000ff\">BASE_CONFIG=~\/openvpn_client_files\/base.conf <\/span><\/p>\n<p><span style=\"color: #0000ff\">cat ${BASE_CONFIG} <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &lt;(echo -e &#8216;&lt;ca&gt;&#8217;) <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 ${KEY_DIR}\/ca.crt <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &lt;(echo -e &#8216;&lt;\/ca&gt;n&lt;cert&gt;&#8217;) <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 ${KEY_DIR}\/${1}.crt <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &lt;(echo -e &#8216;&lt;\/cert&gt;n&lt;key&gt;&#8217;) <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 ${KEY_DIR}\/${1}.key <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &lt;(echo -e &#8216;&lt;\/key&gt;n&lt;tls-auth&gt;&#8217;) <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 ${KEY_DIR}\/ta.key <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &lt;(echo -e &#8216;&lt;\/tls-auth&gt;&#8217;) <\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &gt; ${OUTPUT_DIR}\/${1}.ovpn<\/span> <\/p>\n<p>\u66f4\u6539\u6a94\u6848\u6b0a\u9650<br \/># <span style=\"color: #ff0000\">chmod 700 ~\/openvpn_client_files\/make_config.sh<\/span><\/p>\n<p> \u5207\u63db\u76ee\u9304<br \/># <span style=\"color: #ff0000\">cd ~\/openvpn_client_files<\/span><\/p>\n<p>\u9032\u884c\u88fd\u4f5c<br \/># <span style=\"color: #ff0000\">.\/make_config.sh client<\/span><\/p>\n<p>\u6aa2\u67e5\u662f\u5426\u6709\u7522\u751f\u6574\u5408\u7684\u8a2d\u5b9a\u6a94<br \/># <span style=\"color: #ff0000\">ls -l\u00a0<\/span><span style=\"color: #ff0000;font-size: 1em\">~\/openvpn_client_files\/<\/span><span style=\"color: #ff0000;font-size: 1em\">*.ovpn<br \/><\/span><span style=\"color: #0000ff\">-rw-r&#8211;r&#8211; 1 root root 9860 12\u6708 23 22:15 client.ovpn<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c3\u8003\u7db2\u9801\uff1a CentOS 7 install OpenVPN @ \u56de\u61b6&#8230;&#8230;! :: \u75de &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/01\/04\/openvpn-client-%e7%ab%af%e8%a8%ad%e5%ae%9a\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008OpenVPN Client \u7aef\u8a2d\u5b9a\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[168],"tags":[],"class_list":["post-19363","post","type-post","status-publish","format-standard","hentry","category-c-84780"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["680587"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19363"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=19363"}],"version-history":[{"count":1,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19363\/revisions"}],"predecessor-version":[{"id":20906,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19363\/revisions\/20906"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}