Use Boring to Connect Remote Server DataBase

Install

navigate to https://github.com/alebeck/boring/releases

1
2
3
4
5
wget https://github.com/alebeck/boring/releases/download/v0.12.0/boring-v0.12.0-linux-amd64.tar.gz
tar -zxvf boring-v0.12.0-linux-amd64.tar.gz
rm -f LICENSE
cp ./boring /usr/local/bin/
chmod +x /usr/local/bin/boring

call boring list to make sure installation is ok.

Configure

vim ~/.config/boring/.boring.toml

1
2
3
4
5
6
7
8
[[tunnels]]
name = "<tunnel name>"
local = "0.0.0.0:<port>" # local listen addr
remote = "localhost:<port>" # remote server database addr
host = "<server host>"
port = <server port>
user = "<ssh user>"
identity = "~/.config/boring/xxx.pem" # private key file

boring list can show tunnels

Connect

just ssh to server once.

1
ssh -i ~/.config/boring/xxx.pem user@host

open all tunnel

1
boring open -a

Test your connection with local port.

Licensed under CC BY-NC-SA 4.0
记录平时瞎折腾遇到的各种问题, 方便查找
使用 Hugo 构建
主题 StackJimmy 设计