1、yum install libconfig libconfig-devel
2、下载sslh
3、make生成sslh-fork和sslh-select
4、cp sslh-fork /usr/local/sbin/sslh
cp basic.cfg /etc/sslh.cfg
5、cp scripts/etc.rc.d.init.d.sslh.centos /etc/rc.d/init.d/sslh
6、修改sslh.cfg文件
# This is a basic configuration file that should provide
# sensible values for "standard" setup.
verbose: false;
foreground: false;
inetd: false;
numeric: false;
transparent: false;
timeout: 2;
user: "nobody";
pidfile: "/var/run/sslh.pid";
# Change hostname with your external address name.
listen:
(
{ host: "171.182.45.19"; port: "33890"; }
);
protocols:
(
{ name: "ssh"; service: "ssh"; host: "127.0.0.1"; port: "22"; },
{ name: "http"; host: "127.0.0.1"; port: "9888"; }
);
其中Listen字段是监听本机的ip和端口,protocols中的host则是需要转发的地址,因为只在本机转发,故端口为127.0.0.1,注意其中的逗号,最有一个不要逗号
7、启动(-F后没有空格)
sslh -F/etc/sslh.cfg