一.序
最近朋友给我介绍了一个黑科技玩法,需要用到sniproxy,这东西我之前就知道,当初拿来代理谷歌配合自建dns用,好久没用都忘记怎么装了……所以做个记录
二.正文
其实吧,作者的GITHUB(传送门)说的很清楚……然而我还是要水一篇233
yum install autoconf automake curl gettext-devel libev-devel pcre-devel perl pkgconfig rpm-build udns-devel cd /opt wget -O sniproxy-0.4.0.tar.gz https://github.com/dlundquist/sniproxy/archive/0.4.0.tar.gz tar xzf sniproxy-0.4.0.tar.gz cd sniproxy-0.4.0 ./autogen.sh && ./configure && make dist rpmbuild --define "_sourcedir `pwd`" -ba redhat/sniproxy.spec rpm -ivh ~/rpmbuild/RPMS/x86_64/sniproxy-0.4.0-1.el6.x86_64.rpm
这是制作RPM包的方法,属于一劳永逸的(要更新除外),对了,在autogen的过程中会报 debchange: command not found 请无视,这是debian的玩意
另外打包必须要yum安装libev-devel和udns-devel,然而make install安装的话我们可以选择编译版本的libev和udns(版本更新,强迫症福利)
cd /opt wget http://dist.schmorp.de/libev/Attic/libev-4.22.tar.gz tar xzf libev-4.22.tar.gz cd libev-4.22 ./configure make make install echo -e '/usr/local/lib\n/usr/local/lib64' > /etc/ld.so.conf.d/local.conf ldconfig cd /opt wget http://www.corpit.ru/mjt/udns/udns-0.4.tar.gz tar xzf udns-0.4.tar.gz cd udns-0.4 ./configure make cd .. mv udns-0.4 /usr/local/udns echo -e '/usr/local/udns' > /etc/ld.so.conf.d/udns.conf ldconfig
到这里安装基本没啥问题了,至于配置的话,这东西配置相当简单,我给出一份GITHUB上的Example,相信各位一看就懂了
user daemon pidfile /tmp/sniproxy.pid error_log { syslog daemon priority notice } listener 127.0.0.1:443 { protocol tls table TableName # Specify a server to use if the initial client request doesn't contain # a hostname fallback 192.0.2.5:443 } table TableName { # Match exact request hostnames example.com 192.0.2.10:4343 # If port is not specified the listener port will be used example.net [2001:DB8::1:10] # Or use regular expression to match .*\\.com [2001:DB8::1:11]:443 # Combining regular expression and wildcard will resolve the hostname # client requested and proxy to it .*\\.edu *:443 }