Created
November 24, 2021 05:33
-
-
Save trungng1992/a4a8a80010369c6cd3866608d16d56a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What is bastiot host? | |
Bastion host is usually public-facing, hardened systems that serve as an entrypoint to systems behind a firewall or other restricted location, and they are especially popular with the rise of cloud computing | |
# Proxy Jump | |
## Command | |
``` | |
$ ssh -J <bastion_host> <remote-host> | |
``` | |
## Hard-coding proxy hosts in ~/.ssh/config | |
``` | |
# In the ~/.ssh/config | |
### The bastion host | |
Host bastion-host-farm-test | |
Hostname 10.10.10.10 | |
Host remote-host-web-farm-test | |
Hostname 192.168.0.2 | |
ProxyJump bastion-host-farm-test | |
``` | |
# Forwarding stdin and stdout | |
`ProxyCommand` works by forwarding standard in (stdin) and standard out (stdout) from the remote machine thought the proxy or bastion hosts. | |
## Command | |
``` | |
$ ssh -o ProxyCommand="ssh -W %h:%p bastion-host" remote-host | |
``` | |
## Hard-coding proxy hosts in ~/.ssh/config | |
``` | |
Host bastion-host | |
Hostname 10.10.10.10 | |
Host remote-host | |
ProxyCommand ssh bastion-host -W %h:%p | |
Hostname 192.168.0.2 | |
``` | |
# Agent forwarding | |
## Command | |
``` | |
ssh -A -t <ip_terminal> "ssh -A -t 10.10.55.51" | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment