{"id":254291,"date":"2013-10-25T17:31:17","date_gmt":"2013-10-25T09:31:17","guid":{"rendered":"http:\/\/blog.zhenglei.net\/?p=254291"},"modified":"2013-10-30T18:52:20","modified_gmt":"2013-10-30T10:52:20","slug":"socks-server","status":"publish","type":"post","link":"https:\/\/blog.zhenglei.net\/?p=254291","title":{"rendered":"Setup Socks Server"},"content":{"rendered":"<p><strong>Install dante in server  (centos):<br \/>\n<\/strong><\/p>\n<li>cd \/tmp<br \/>\nwget http:\/\/www.inet.no\/dante\/files\/dante-1.3.2.tar.gz<br \/>\ntar xvfz dante-*.tar.gz<br \/>\ncd dante-*<br \/>\n.\/configure<br \/>\nmake<br \/>\nmake install<\/p>\n<\/li>\n<li><strong>Config dante in server:<\/strong><br \/>\ncat \/etc\/sockd.conf<br \/>\n<em>#logoutput: syslog stdout \/var\/log\/sockd.log<br \/>\n#logoutput: stderr<br \/>\n#logoutput: syslog<br \/>\nlogoutput: \/var\/log\/sockd.log<\/p>\n<p>internal: 127.0.0.1 port = 1080<br \/>\nexternal: venet0<\/p>\n<p>method: none<br \/>\nclientmethod: none<\/p>\n<p>user.privileged: sockd<br \/>\nuser.unprivileged: nobody<br \/>\n#user.libwrap: nobody<\/p>\n<p>#compatibility: sameport<br \/>\n#compatibility: reuseaddr<\/p>\n<p>extension: bind<br \/>\ntimeout.negotiate: 30<br \/>\ntimeout.io: 86400<\/p>\n<p>#srchost: nounknown nomismatch<br \/>\n#client pass {<br \/>\n#        from: 10.0.0.0\/8 port 1-65535 to: 0.0.0.0\/0<br \/>\n#        method: rfc931 # match all idented users that also are in passwordfile<br \/>\n#}<\/p>\n<p>client pass {<br \/>\n        from: 127.0.0.1\/8  to: 127.0.0.1\/0<br \/>\n        log:  connect error<br \/>\n        method: none<br \/>\n}<\/p>\n<p>client block {<br \/>\n        from: 0.0.0.0\/0 to: 0.0.0.0\/0<br \/>\n        method: none<br \/>\n}<\/p>\n<p>pass {<br \/>\n        from: 127.0.0.1\/8 to: 0.0.0.0\/0<br \/>\n        command: bind connect udpassociate<br \/>\n        log: connect error<br \/>\n        method:  none<br \/>\n}<\/p>\n<p>pass {<br \/>\n      from: 0.0.0.0\/0 to: 127.0.0.1\/8<br \/>\n      command:  bindreply udpreply<br \/>\n      log: connect error<br \/>\n      method: none<br \/>\n}<\/p>\n<p>block {<br \/>\n       from: 0.0.0.0\/0 to: 0.0.0.0\/0<br \/>\n       log: connect error<br \/>\n}<\/em><\/p>\n<\/li>\n<li>\n<p><strong>Add init script:<\/strong><br \/>\ncat \/etc\/init.d\/sockd<br \/>\n<em>#!\/bin\/sh<br \/>\n#<br \/>\n# chkconfig: &#8211; 91 35<br \/>\n# description: Starts and stops the sockd(dante) daemon \\<br \/>\n#\t       used to provide socks services.<br \/>\n#<\/p>\n<p>PID=&#8221;\/var\/run\/sockd\/sockd.pid&#8221;<br \/>\nCONFIG=&#8221;\/etc\/sockd.conf&#8221;<\/p>\n<p># Source function library.<br \/>\nif [ -f \/etc\/init.d\/functions ] ; then<br \/>\n  . \/etc\/init.d\/functions<br \/>\nelif [ -f \/etc\/rc.d\/init.d\/functions ] ; then<br \/>\n  . \/etc\/rc.d\/init.d\/functions<br \/>\nelse<br \/>\n  exit 1<br \/>\nfi<\/p>\n<p># Avoid using root&#8217;s TMPDIR<br \/>\nunset TMPDIR<\/p>\n<p># Source networking configuration.<br \/>\n. \/etc\/sysconfig\/network<\/p>\n<p># Check that networking is up.<br \/>\n[ ${NETWORKING} = &#8220;no&#8221; ] &amp;&amp; exit 1<\/p>\n<p># Check that sockd.conf exists.<br \/>\n[ -f ${CONFIG} ] || exit 6<\/p>\n<p>RETVAL=0<br \/>\nOPTIONS=&#8221;-D -p ${PID} -f ${CONFIG}&#8221;<\/p>\n<p>start() {<br \/>\n        KIND=&#8221;SOCKD&#8221;<br \/>\n\techo -n $&#8221;Starting $KIND services: &#8221;<br \/>\n\t\/usr\/local\/sbin\/sockd  ${OPTIONS}<br \/>\n\tRETVAL=$?<br \/>\n\techo<br \/>\n\t[ $RETVAL -eq 0 ] &amp;&amp; touch \/var\/lock\/subsys\/sockd || \\<br \/>\n\t   RETVAL=1<br \/>\n\treturn $RETVAL<br \/>\n}\t<\/p>\n<p>stop() {<br \/>\n\tKIND=&#8221;SOCKD&#8221;<br \/>\n\techo -n $&#8221;Shutting down $KIND services: &#8221;<br \/>\n\tkillproc sockd<br \/>\n\tRETVAL=$?<br \/>\n\techo<br \/>\n\t[ $RETVAL -eq 0 ] &amp;&amp; rm -f \/var\/lock\/subsys\/sockd<br \/>\n\treturn $RETVAL<br \/>\n}\t<\/p>\n<p>restart() {<br \/>\n\tstop<br \/>\n\tstart<br \/>\n}\t<\/p>\n<p>rhstatus() {<br \/>\n\tstatus -l sockd sockd<br \/>\n\treturn $?<br \/>\n}\t<\/p>\n<p># Allow status as non-root.<br \/>\nif [ &#8220;$1&#8221; = status ]; then<br \/>\n       rhstatus<br \/>\n       exit $?<br \/>\nfi<\/p>\n<p>case &#8220;$1&#8243; in<br \/>\n  start)<br \/>\n  \tstart<br \/>\n\t;;<br \/>\n  stop)<br \/>\n  \tstop<br \/>\n\t;;<br \/>\n  restart)<br \/>\n  \trestart<br \/>\n\t;;<br \/>\n  status)<br \/>\n  \trhstatus<br \/>\n\t;;<br \/>\n  condrestart)<br \/>\n  \t[ -f \/var\/lock\/subsys\/sockd ] &amp;&amp; restart || :<br \/>\n\t;;<br \/>\n  *)<br \/>\n\techo $&#8221;Usage: $0 {start|stop|restart|status|condrestart}&#8221;<br \/>\n\texit 2<br \/>\nesac<\/p>\n<p>exit $?<\/em><\/p>\n<\/li>\n<li><strong>enable auto launch during boot<\/strong>\n<p>chkconfig &#8211;add sockd<\/li>\n<p><a href=\"http:\/\/www.inet.no\/dante\/\"><strong>dante<\/strong><\/a><br \/>\n<a href=\"http:\/\/www.inet.no\/dante\/\" title=\"dante\">http:\/\/www.inet.no\/dante\/<\/a><\/p>\n<p><strong><a href=\"http:\/\/ss5.sourceforge.net\/\">SS5<\/a><\/strong><br \/>\n<a href=\"http:\/\/ss5.sourceforge.net\/\">http:\/\/ss5.sourceforge.net\/<\/a><\/p>\n<p><strong><a href=\"http:\/\/www.delegate.org\/delegate\/\" \/>DeleGate<\/a><\/strong><br \/>\n<a href=\"http:\/\/www.delegate.org\/delegate\/\">http:\/\/www.delegate.org\/delegate\/<\/a><\/p>\n<p><strong><a href=\"http:\/\/socks-relay.sourceforge.net\/\">Srelay<\/a><\/strong><br \/>\n<a href=\"http:\/\/socks-relay.sourceforge.net\/\">http:\/\/socks-relay.sourceforge.net\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install dante in server (centos): cd \/tm &hellip; <a href=\"https:\/\/blog.zhenglei.net\/?p=254291\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-254291","post","type-post","status-publish","format-standard","hentry","category-internet"],"_links":{"self":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254291"}],"version-history":[{"count":7,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254291\/revisions"}],"predecessor-version":[{"id":254312,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254291\/revisions\/254312"}],"wp:attachment":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}