chromiumer.com

TCP端口转发

2023.12.15
本地13306端口流量转发到本地3306端口,并且只允许 202.202.202.202 ip 访问13306端口。
1.白名单配置文件
cat <<'EOF'>> /data/backup/config.txt
202.202.202.202
EOF

2.启动脚本

cat <<'EOF'>> /data/supervisord.d/portforward2.conf
[program:portforward2]
command         = /data/backup/portforward2 127.0.0.1:3306 0.0.0.0:13306
directory       = /data/backup
stdout_logfile  = /data/backup/stdout.portforward2.log
user            = root
stopwaitsecs    = 10
stopasgroup     = true
killasgroup     = true
autostart       = true
autorestart     = true
redirect_stderr = true
EOF