- 论坛徽章:
- 0
|
ss5 socks server教程(一):安装---rpm安装包的制作
本文原出处:Coolzsb的杂货铺子
可自由转载,但请遵循“署名-非商业用途-保持一致”的创作共用协议。
ss5 socks server是一个相当完善的SOCKS v4 以及 v5 服务软件,支持Linux、Freebsd、Solaris。性能上相当不错,据官方网站介绍,在一台跑在Linux kernel 2.6.x的IBM x360的服务器,有跑到每秒2500个并发连接的纪录。ss5还提供了用户带宽控制功能,这可好像是目前唯一能找到的提供此功能的开源Socks服务了。
安装版本:3.6.4-3
系统安装环境:trustix 3.0.5
因为ss5有提供编译rpm的spec文件,所以就自己编了个给trustix 3.0.5的rpm来用,这样软件管理会方便些。
ss5的作者Matteo Ricchetti为了这个rpm包的东西能加入fedora,跟fedora的人认认真真地沟通了半年,真是佩服他这种一板一眼的认真劲。
下了最新版的ss5的软件包之后,发现要直接作成给trustix 3.0.5用的rpm还是不成的,一部分是因为trustix调整了部分initscripts的路径,另外一部分就是作者的疏忽了。做了相应的调整之后,才总算折腾出了一个给trustix 3.0.5用的比较完善的rpm包。我作的修改大致如下:
* 根据trustix的initscripts路径作了调整
* 修正了ss5的服务启动脚本中的一些错误
* 修正了ss5的spec文件中的一些文件目录的权限设置
* 增加了ss5的logrotate设置
* 增加了ss5的服务启动参数设置文件:/etc/sysconfig/ss5
然后直接用rpmbuild编译一个rpm安装包出来就可以直接安装使用了。
1. rpmbuild -bb --target=i686 /usr/src/trustix/specs/ss5.spec
2. rpm -ivh /usr/src/trustix/rpms/i686/ss5-3.6.4-3.i686.rpm
可惜尝试着编译出来带epoll支持的ss5没法工作,我只好放弃了ss5对epoll的支持。
具体的修改如下,对于使用其他系统的兄弟,大致可以参考一下
对ss5-3.6.4-3.spec所做的修改
下载: ss5-3.6.4-3.spec-for-trustix-3.0.5.patch
- --- /tmp/old/ss5-3.6.4-3.spec 2008-01-08 19:04:44.000000000 +0800
- +++ /tmp/new/ss5-3.6.4-3.spec 2008-01-10 11:36:34.753724380 +0800
- @@ -6,6 +6,7 @@
- Group: Applications/Internet
- URL: [url]http://sourceforge.net/projects/ss5[/url]
- Source: [url]http://prdownloads.sourceforge.net/ss5/ss5-3.6.4-3.tar.gz[/url]
- +Patch1: modify_for_trustix_3.0.5.patch
- BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
- BuildRequires: openldap-devel pam-devel
-
- @@ -15,6 +16,7 @@
-
- %prep
- %setup
- +%patch1 -p1
-
- %build
-
- @@ -43,7 +45,7 @@
- %files
- %defattr(755,root,root)
- %{_sbindir}/ss5
- -%{_initrddir}/ss5
- +%{_initdir}/ss5
- %{_libdir}/ss5/
-
- %defattr(644,root,root)
- @@ -67,8 +69,11 @@
- %defattr(755,root,root)
- %{_localstatedir}/log/ss5
-
- -%defattr(644,root,root)
- +%defattr(755,root,root)
- %dir %{_sysconfdir}/opt/ss5
- +%defattr(644,root,root)
- +%{_sysconfdir}/logrotate.d/ss5
- +%config(noreplace) %{_sysconfdir}/sysconfig/ss5
- %config(noreplace) %{_sysconfdir}/opt/ss5/ss5.conf
- %config(noreplace) %{_sysconfdir}/opt/ss5/ss5.passwd
- %config(noreplace) %{_sysconfdir}/pam.d/ss5
复制代码
对ss5-3.6.4-3的软件包的修改
下载: modify_for_trustix_3.0.5.patch
- --- ss5-3.6.4/Makefile.in 2007-05-24 23:59:53.000000000 +0800
- +++ ss5-3.6.4.new/Makefile.in 2008-01-10 11:06:59.052650112 +0800
- @@ -48,11 +48,15 @@
- @( cp modules/mod_balance/SS5Logo.jpg $(dst_dir)$(lib_path_base)/ss5/ )
-
- @( if [ $(OS) = "Linux" ]; then \
- - if [ ! -d $(dst_dir)/etc/rc.d/init.d ]; then mkdir -p $(dst_dir)/etc/rc.d/init.d; fi ; \
- + if [ ! -d $(dst_dir)/etc/init.d ]; then mkdir -p $(dst_dir)/etc/init.d; fi ; \
- + if [ ! -d $(dst_dir)/etc/logrotate.d ]; then mkdir -p $(dst_dir)/etc/logrotate.d; fi ; \
- + if [ ! -d $(dst_dir)/etc/sysconfig ]; then mkdir -p $(dst_dir)/etc/sysconfig; fi ; \
- fi )
- @( if [ $(OS) = "Linux" ]; then \
- - if [ ! -f $(dst_dir)/etc/rc.d/init.d/ss5 ]; then cp conf/ss5.init $(dst_dir)/etc/rc.d/init.d/ss5; \
- - else cp conf/ss5.init $(dst_dir)/etc/rc.d/init.d/ss5.rpmnew ; fi ; \
- + if [ ! -f $(dst_dir)/etc/init.d/ss5 ]; then cp conf/ss5.init $(dst_dir)/etc/init.d/ss5; \
- + else cp conf/ss5.init $(dst_dir)/etc/init.d/ss5.rpmnew ; fi ; \
- + if [ ! -f $(dst_dir)/etc/logrotate.d/ss5 ]; then cp conf/ss5.logrotate $(dst_dir)/etc/logrotate.d/ss5; fi ;\
- + if [ ! -f $(dst_dir)/etc/sysconfig/ss5 ]; then cp conf/ss5.sysconfig $(dst_dir)/etc/sysconfig/ss5; fi ;\
- fi )
- @( if [ $(OS) = "SunOS" ]; then \
- if [ ! -d $(dst_dir)/etc/init.d ]; then mkdir -p $(dst_dir)/etc/init.d; fi ; \
- @@ -134,7 +138,7 @@
- fi )
-
- @( if [ $(OS) = "Linux" ]; then \
- - if [ -f $(dst_dir)/etc/rc.d/init.d/ss5 ]; then rm -f $(dst_dir)/etc/rc.d/init.d/ss5; fi; \
- + if [ -f $(dst_dir)/etc/init.d/ss5 ]; then rm -f $(dst_dir)/etc/init.d/ss5; fi; \
- fi )
- @( if [ $(OS) = "SunOS" ]; then \
- if [ -f $(dst_dir)/etc/init.d/ss5 ]; then rm -f $(dst_dir)/etc/init.d/ss5; fi; \
- diff -Nur ss5-3.6.4/conf/ss5.init ss5-3.6.4.new/conf/ss5.init
- --- ss5-3.6.4/conf/ss5.init 2007-04-17 22:40:43.000000000 +0800
- +++ ss5-3.6.4.new/conf/ss5.init 2008-01-10 11:20:15.394071801 +0800
- @@ -4,12 +4,21 @@
- # description: This script takes care of starting \
- # and stopping ss5
- #
- +# processname: ss5
- +# config: /etc/opt/ss5/ss5.conf
-
- OS=`uname -s`
- if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then
-
- # Source function library.
- - . /etc/rc.d/init.d/functions
- +if [ -f /etc/init.d/functions ]; then
- + . /etc/init.d/functions
- +elif [ /etc/rc.d/init.d/functions ]; then
- + . /etc/rc.d/init.d/functions
- +else
- + echo "Can't find functions file, exiting"
- + exit 1
- +fi
-
- # Source networking configuration.
- . /etc/sysconfig/network
- @@ -20,6 +29,9 @@
- [ -f /usr/sbin/ss5 ] || exit 0
- fi
-
- +#set ulimit open file
- +ulimit -HSn 65535
- +
- # Test custom variables
- test -f /etc/sysconfig/ss5 && . /etc/sysconfig/ss5
-
- @@ -31,7 +43,7 @@
- if [ $OS = "Linux" ]; then
- daemon /usr/sbin/ss5 -t $SS5_OPTS
- touch /var/lock/subsys/ss5
- - if [ $OS = "SunOS" ]; then
- + elif [ $OS = "SunOS" ]; then
- /usr/sbin/ss5 -t
- touch /var/lock/subsys/ss5
- else
- diff -Nur ss5-3.6.4/conf/ss5.logrotate ss5-3.6.4.new/conf/ss5.logrotate
- --- ss5-3.6.4/conf/ss5.logrotate 1970-01-01 08:00:00.000000000 +0800
- +++ ss5-3.6.4.new/conf/ss5.logrotate 2008-01-10 11:02:31.232586242 +0800
- @@ -0,0 +1,7 @@
- +/var/log/ss5/ss5.log {
- + sharedscripts
- + notifempty
- + postrotate
- + /usr/bin/killall -HUP ss5
- + endscript
- +}
- diff -Nur ss5-3.6.4/conf/ss5.sysconfig ss5-3.6.4.new/conf/ss5.sysconfig
- --- ss5-3.6.4/conf/ss5.sysconfig 1970-01-01 08:00:00.000000000 +0800
- +++ ss5-3.6.4.new/conf/ss5.sysconfig 2008-01-10 11:05:33.542858180 +0800
- @@ -0,0 +1,4 @@
- +## These variables are used by ss5 socks service
- +## You will want to fill in your own ss5 start options
- +#
- +SS5_OPTS=""
复制代码 |
|