sshtunnel
sshtunnel copied to clipboard
Add support for ssh-agent
Add support for ssh-agent, which can simplify the use of encrypted private keys. As you can load encrypted private keys to ssh-agent to facilitate the sshtunnel.
Hi, thanks for the PR. I'm open to the change, but using environment variables is a distinct change from the fact that everything else is configured through a JSON configuration file. We should be consistent in specifying agent information in the configuration file as well.
Hi~ I re-adjusted the code logic to respect the user's configuration in json. When the user does not configure it, the environment variables are read by default and the actual effective values are printed in the log.
2023/12/05 20:13:44 main.go:179: loaded config:
{
"SshAgentSocket": "/run/user/1000/keyring/ssh",
"KeyFiles": null,
"KnownHostFiles": [
"/home/yuguorui/.ssh/known_hosts"
],
"KeepAlive": {
"Interval": 30,
"CountMax": 2
},
"Tunnels": [
{
"Tunnel": "127.0.0.1:8899 -> 127.0.0.1:8899",
"Server": "[email protected]:22"
}
],
"BinarySHA256": "f9554279606e0177ea88ce836a373025dfb8e19b478b25c578a6199b10c71356"
}
2023/12/05 20:13:44 main.go:314: sshtunnel starting