# db_tunnel 结合TELEPORT堡垒机使用的DB SSH数据库隧道工具 数据库配置文件请放到/etc或者与bin文件同一路径 # build git clone https://git.aixiao.me/aixiao/db_tunnel.git cd db_tunnel bash bash build.sh(可能会提示安装包) # test root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/tunnel# ./bin/tunnel -h flag needs an argument: -h Usage of ./bin/tunnel: -c int 建立隧道最大次数(与DB服务器断开) (default 999) -d run in daemon -f run forever -h string DB服务器SSH IP地址 -l string 本地监听端口(或者堡垒机监听端口) -p string DB服务器SSH PORT -r string DB服务器端口(如: 3306、1521 ...) -u string DB服务器SSH USER用户 root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/tunnel# root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/tunnel/bin# ./tunnel -d -f -c 500 -h 47.108.253.59 -p 22 -u app -r 3306 -l 3306 [*] Daemon running in PID: 28640 PPID: 24 root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/tunnel/bin# [*] Forever running in PID: 28645 PPID: 1 [*] Service running in PID: 28649 PPID: 28645 数据库连接成功 47.108.253.59 22 app hyj4Sxq1UQUJ0RF95MQGf1oNUSdZ/rlIYNXu9DPSCLt3sNsXCpKmRtm85tFCRPN 0Hv5m&uRwYKFZdu 2023/03/15 12:15:55.161984 PID: 28649 PPID: 28645 本地端口: 3306 当前连接数:1 2023/03/15 12:15:55.162630 listening for new connections... root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/tunnel/bin#