This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ssh [2021/07/06 05:05] – [Reverse proxy] vissie | ssh [2021/10/06 03:19] (current) – [CentOS] vissie | ||
|---|---|---|---|
| Line 232: | Line 232: | ||
| Happy days... | Happy days... | ||
| + | |||
| + | |||
| + | ====ProxyJump==== | ||
| + | The ProxyJump, or the -J flag, was introduced in ssh version 7.3. To use it, specify the bastion host to connect through after the -J flag, plus the remote host: | ||
| + | ssh -J < | ||
| + | You can also set specific usernames and ports if they differ between the hosts: | ||
| + | ssh -J user@< | ||
| + | The ssh man (or manual) page (man ssh) notes that multiple, comma-separated hostnames can be specified to jump through a series of hosts: | ||
| + | ssh -J < | ||
| + | |||
| + | ====Hard-coding proxy hosts in config==== | ||
| + | The -J flag provides flexibiltiy for easily specifying proxy and remote hosts as needed, but if a specific bastion host is regularly used to connect to a specific remote host, the ProxyJump configuration can be set in ~/ | ||
| + | <sxh bash; gutter: false> | ||
| + | ### The Bastion Host | ||
| + | Host bastion-host-nickname | ||
| + | HostName bastion-hostname | ||
| + | |||
| + | ### The Remote Host | ||
| + | Host remote-host-nickname | ||
| + | HostName remote-hostname | ||
| + | ProxyJump bastion-host-nickname | ||
| + | Using the example configuration above, when an ssh connection is made like so: | ||
| + | </ | ||
| + | ssh remote-host-nickname | ||
| =====Reverse proxy===== | =====Reverse proxy===== | ||
| Line 250: | Line 274: | ||
| # For my IP cameras https:// | # For my IP cameras https:// | ||
| ssh -L 5000: | ssh -L 5000: | ||
| - | </ | ||
| # For zmninja | # For zmninja | ||
| Line 257: | Line 280: | ||
| # My Router | # My Router | ||
| #ssh -L 5000: | #ssh -L 5000: | ||
| + | </ | ||