{"id":19404,"date":"2017-02-02T06:54:37","date_gmt":"2017-02-01T22:54:37","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/02\/02\/%e5%bb%ba%e7%bd%ae%e4%bd%bf%e7%94%a8%e5%b8%b3%e8%99%9f%e5%8f%8a%e5%af%86%e7%a2%bc%e8%aa%8d%e8%ad%89%e7%9a%84-openvpn-server-3\/"},"modified":"2017-02-02T06:54:37","modified_gmt":"2017-02-01T22:54:37","slug":"%e5%bb%ba%e7%bd%ae%e4%bd%bf%e7%94%a8%e5%b8%b3%e8%99%9f%e5%8f%8a%e5%af%86%e7%a2%bc%e8%aa%8d%e8%ad%89%e7%9a%84-openvpn-server-3","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/02\/02\/%e5%bb%ba%e7%bd%ae%e4%bd%bf%e7%94%a8%e5%b8%b3%e8%99%9f%e5%8f%8a%e5%af%86%e7%a2%bc%e8%aa%8d%e8%ad%89%e7%9a%84-openvpn-server-3\/","title":{"rendered":"\u5efa\u7f6e\u4f7f\u7528\u5e33\u865f\u53ca\u5bc6\u78bc\u8a8d\u8b49\u7684 OpenVPN Server &#8211; 3"},"content":{"rendered":"<p>\u5e95\u4e0b\u662f\u5728 CentOS 7.3 1611 \u4e0b\u5be6\u4f5c<br \/>1. \u5efa\u7acb\u4f7f\u7528\u8005\u53ca\u8a2d\u5b9a\u5bc6\u78bc<br \/># <span style=\"color: #ff0000;\">useradd test -s \/sbin\/nologin<\/span><br \/># <span style=\"color: #ff0000;\">passwd test<\/span><\/p>\n<p>2. \u4fee\u6539 OpenVPN \u8a2d\u5b9a\u6a94 <span style=\"color: #0000ff;\">\/etc\/openvpn\/server.conf<\/span><br \/>\u52a0\u5165\u4e0b\u9762\u7684\u8a2d\u5b9a<br \/><span style=\"color: #0000ff;\">client-cert-not-required<\/span><br \/><span style=\"color: #0000ff;\">username-as-common-name<\/span><br \/><span style=\"color: #0000ff;\">plugin \/usr\/lib64\/openvpn\/plugins\/openvpn-plugin-auth-pam.so \/etc\/pam.d\/login<\/span><\/p>\n<p>[@more@]3. \u6aa2\u67e5 OpenVPN \u8a2d\u5b9a\u6a94\u662f\u5426\u6b63\u78ba<br \/># <span style=\"color: #ff0000;\">openvpn &#8211;config \/etc\/openvpn\/server.conf<\/span><\/p>\n<p>4. \u91cd\u65b0\u555f\u52d5 OpenVPN Server\uff0c\u4e26\u6aa2\u67e5\u662f\u5426\u6709\u6b63\u5e38\u555f\u52d5<br \/># <span style=\"color: #ff0000;\">systemctl restart openvpn@server.service;systemctl status openvpn@server.service<\/span><\/p>\n<p>5. \u5b89\u88dd cyrus-sasl<br \/># <span style=\"color: #ff0000;\">yum install cyrus-sasl<\/span><\/p>\n<p>6. \u8a2d\u5b9a\u9810\u8a2d\u555f\u52d5\u00a0 saslauthd \u670d\u52d9<br \/># <span style=\"color: #ff0000;\">systemctl enable saslauthd.service<\/span><\/p>\n<p>7.\u555f\u52d5 saslauthd \u670d\u52d9\uff0c\u4e26\u6aa2\u67e5\u662f\u5426\u6709\u6b63\u5e38\u555f\u52d5<br \/># <span style=\"color: #ff0000;\">systemctl start saslauthd.service;systemctl status saslauthd.service<\/span><\/p>\n<p>8. \u6e2c\u8a66\u662f\u5426\u80fd\u4f7f\u7528\u672c\u6a5f\u5e33\u865f\u5bc6\u78bc\u9032\u884c\u8a8d\u8b49<br \/>\u6aa2\u67e5\u5e33\u865f\u5bc6\u78bc\u662f\u5426\u80fd\u6b63\u5e38\u4f7f\u7528<br \/># <span style=\"color: #ff0000;\">testsaslauthd -u test -p 123456 -s login<\/span><br \/><span style=\"color: #0000ff;\">0: OK &#8220;Success.&#8221;<\/span><br \/>\u5982\u679c\u51fa\u73fe\u4ee5\u4e0a\u7684\u8a0a\u606f\uff0c\u4ee3\u8868\u6b63\u5e38<\/p>\n<p><span style=\"color: #0000ff;\">connect() : No such file or directory<\/span><br \/><span style=\"color: #0000ff;\">0:<\/span><br \/>\u5982\u679c\u51fa\u73fe\u4e0a\u9762\u8a0a\u606f\uff0c\u4ee3\u8868 saslauthd \u6c92\u6709\u555f\u52d5\uff0c\u8acb\u505a\u7b2c 6~7 \u6b65\u9a5f<\/p>\n<p><span style=\"color: #0000ff;\">0: NO &#8220;authentication failed&#8221;<\/span><br \/>\u5982\u679c\u51fa\u73fe\u4e0a\u9762\u8a0a\u606f\uff0c\u4ee3\u8868\u8a8d\u8b49\u5931\u6557\uff0c\u53ef\u80fd\u8981\u67e5\u770b\u4e00\u4e0b <span style=\"color: #0000ff;\">\/var\/log\/secure<\/span> \u4e2d\u7684\u8a0a\u606f<\/p>\n<p>9. \u5728 OpenVPN Cleint \u7aef\u7684\u8a2d\u5b9a\u6a94\u4e2d\uff0c\u52a0\u5165\u4e0b\u9762\u9019\u4e00\u884c<br \/><span style=\"color: #0000ff;\">auth-user-pass<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5e95\u4e0b\u662f\u5728 CentOS 7.3 1611 \u4e0b\u5be6\u4f5c1. \u5efa\u7acb\u4f7f\u7528\u8005\u53ca\u8a2d\u5b9a\u5bc6\u78bc# useradd test -s &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/02\/02\/%e5%bb%ba%e7%bd%ae%e4%bd%bf%e7%94%a8%e5%b8%b3%e8%99%9f%e5%8f%8a%e5%af%86%e7%a2%bc%e8%aa%8d%e8%ad%89%e7%9a%84-openvpn-server-3\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u5efa\u7f6e\u4f7f\u7528\u5e33\u865f\u53ca\u5bc6\u78bc\u8a8d\u8b49\u7684 OpenVPN Server &#8211; 3\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":[117,168],"tags":[],"class_list":["post-19404","post","type-post","status-publish","format-standard","hentry","category-c-78462","category-c-84780"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["681779"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19404"}],"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=19404"}],"version-history":[{"count":0,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19404\/revisions"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}