pinkeen.ssh-tunnel-client

通过 autossh 创建持久的 SSH 隧道(Centos7)

ssh_tunnel_client_user - 默认是 ssh_tunnel

ssh_tunnels - 包含以下键的数组:

  • name - 用于命名服务的名称
  • key_file - 私钥文件
  • target_host - 必须填写
  • target_port - 必须填写
  • local_port - 必须填写
  • remote_user - 默认设置为 ssh_tunnel
  • alive_interval - 默认设置为 10
  • alive_count_max - 默认设置为 1

警告

Autossh 会在远程机器上绑定到一个监控端口。使用的是固定端口,并且多个客户端不能同时绑定到同一端口,这会导致 SSH 会话每 10 分钟重启一次。

截至目前,最新的 CentOS 7 版本 (1.4e) 中端口随机化功能无法正常工作。

因此,autossh 监控功能被关闭。

即使没有监控,这个设置仍然应该正常工作,因为如果没有连接,SSH 会快速退出,得益于 -oServerAliveInterval=60 -oServerAliveCountMax=2 选项。

更多信息请查看: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=351162

附注:考虑一下,为什么我还需要 autossh?难道 systemd 不会处理重启吗?

关于项目

Set up autossh tunnels on client

安装
ansible-galaxy install pinkeen.ssh-tunnel-client
许可证
Unknown
下载
181
拥有者
All things science, tech, people. Solving problems as a programmer, server guy and photographer.