筆記一下3proxy在CentOS 6.6系統底下用原始碼的安裝方式,先介紹3proxy是一個很屌的輕量化代理伺服器,跨平台支援Win/Unix,跨軟體支援HTTP/HTTPS proxy, FTP proxy, SOCKSv4/SOCKSv4.5/SOCKSv5 proxy, POP3 proxy, SMTP proxy, AIM/ICQ proxy (icqpr/icqpr.exe), MSN messenger / Live messenger proxy (msnpr/msnpr.exe), caching DNS proxy,能想到的proxy幾乎都支援,恐怖了吧,而且超輕量化原始碼,只能說完全神人無誤,還不快去官網土下座 ? 3proxy – Universal proxy server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
yum -y install gcc gzip zip unzip cd /usr/src wget http://www.3proxy.ru/0.7.1.1/3proxy-0.7.1.1.tgz tar zxf 3proxy-0.7.1.1.tgz cd 3proxy make -f Makefile.Linux make -f Makefile.Linux install cp /usr/src/3proxy/cfg/3proxy.cfg.sample /etc/3proxy.cfg.bak touch /var/run/3proxy.pid wget http://205.185.112.51/~pageones/conf/3proxy.init mv 3proxy.init /etc/init.d/3proxy chkconfig 3proxy on touch /var/log/3proxy.log ln -sf /usr/local/bin/3proxy /usr/bin/3proxy |
3proxy.cfg的設定其實也很簡單,該修改的就改改帳密跟IP位置而已
User1:CL:Pass1
修改成
帳號1:CL:密碼1
internal 8.8.8.8
修改成
internal 主機對外IP
proxy -p3129
socks -p1081
這兩個端口號就看心情改了,總之記得也要添加到對應的iptables或是其他防火牆
1 2 3 4 |
iptables -A INPUT -p tcp --dport 3129 -j ACCEPT iptables -A INPUT -p tcp --dport 1081 -j ACCEPT service iptables save service iptables restart |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
nserver 209.244.0.3 nserver 74.82.42.42 nserver 208.67.222.222 nserver 168.95.1.1 nscache 65536 timeouts 1 5 30 60 180 1800 15 60 users User1:CL:Pass1 "User2:CL:Pass2" daemon #service log /var/log/3proxy.log logformat "- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T" archiver gz /bin/gzip %F rotate 30 external 0.0.0.0 internal 8.8.8.8 dnspr #################### #### http proxy setting #################### auth strong deny * * 127.0.0.1,192.168.1.1 allow * * * 80-88,8080-8088 HTTP allow * * * 443,8443 HTTPS maxconn 360 proxy -p3129 #################### #### socks5 proxy setting #################### auth strong flush allow User1,User2 maxconn 360 socks -p1081 #################### setgid 65535 setuid 65535 |
1 2 3 |
service 3proxy restart ps ax | grep 3proxy netstat -tulpn | grep 3proxy |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
#!/bin/sh # # Init file for Software Watchdog daemon. # # Written by Dag Wieers <dag@wieers.com>. # Rewrote for ALT Linux by Pavlov Konstantin <thresh@altlinux.ru> # Modifyed for Fedora by Pavel Alexeev aka Pahan-Hubbitus <pahan@hubbitus.info> # # chkconfig: - 02 98 # description: 3proxy Proxy Server # # processname: 3proxy # config: /etc/3proxy.cfg WITHOUT_RC_COMPAT=1 . /etc/init.d/functions ### Default variables prog=3proxy CONFIG=/etc/3proxy.cfg PROXY=/usr/bin/3proxy RETVAL=0 LOCKFILE=/var/lock/subsys/3proxy #LOGFILE=/var/log/3proxy.log start() { echo -n $"Starting $prog: " # daemon --pidfile "${PIDFILE}" sh -c "exec "$PROXY" "$CONFIG" 2>&1 > "$LOGFILE" &" daemon "$PROXY" "$CONFIG" RETVAL=$? echo [ 0 -eq $RETVAL ] && touch ${LOCKFILE} return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc -d 3 "$prog" RETVAL=$? echo [ 0 -eq $RETVAL ] && rm -f ${LOCKFILE} return $RETVAL } restart() { stop start } reload(){ echo -n $"Reloading $prog: " killproc $prog -USR1 RETVAL=$? echo } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; condrestart) [ -e $LOCKFILE ] && restart RETVAL=$? ;; status) status "$PROXY" RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status|reload}" RETVAL=1 ;; esac exit $RETVAL |