2023-02-22 11:51:20 +08:00
2023-02-22 11:51:20 +08:00
2023-02-13 18:09:13 +08:00
2023-02-13 18:09:13 +08:00
2023-02-13 18:09:13 +08:00
2023-02-13 18:09:13 +08:00

db_tunnel

结合TELEPORT堡垒机使用的DB SSH数据库隧道工具
数据库配置文件、tp_decrypt bin请放到/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/db_tunnel# ./db_tunnel -h
flag needs an argument: -h
Usage of ./db_tunnel:
  -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/db_tunnel#


root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/db_tunnel/bin# ./db_tunnel -d -f -h 39.104.27.21 -l 3308 -r 3306 -p 22 -u app
[*] Daemon running in PID: 12918 PPID: 67
root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/db_tunnel/bin# [*] Forever running in PID: 12922 PPID: 1
[*] Service running in PID: 12927 PPID: 12922
39.104.27.21 22 app 3306 3308
39.104.27.21 app 22
数据库连接成功
39.104.27.21 22 app 6+sNDSN4QL7VCLSr+Vt/fNSAX1XsTUwf6fYRTf3pGS8rYBn8Ik
I9EKbb
设置SSH配置服务器:39.104.27.21:22; 用户/密码: app/I9EKbbH; 远程:0.0.0.0:3306; 本地:0.0.0.0:3308
root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/db_tunnel/bin#
Description
No description provided
Readme 12 MiB
Languages
C 60%
Go 33.1%
Python 4.6%
Shell 2.3%