waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 16 insertions
ssh.md
| @@ -67,6 +67,8 @@ Host 192.168.66.* | |||
| 67 | 67 | ||
| 68 | 68 | ``` | |
| 69 | 69 | ||
| 70 | + | ProxyJump can be chained by `ssh -J <host> -J <host>`. | |
| 71 | + | ||
| 70 | 72 | # SSH Multiplexing | |
| 71 | 73 | ||
| 72 | 74 | ``` | |
| @@ -82,4 +84,18 @@ Host * | |||
| 82 | 84 | MaxSessions 10 | |
| 83 | 85 | ``` | |
| 84 | 86 | ||
| 87 | + | # [SSHFS](https://de.wikipedia.org/wiki/SSHFS) | |
| 88 | + | ||
| 89 | + | ``` | |
| 90 | + | sshfs [user@]hostname:[directory] mountpoint | |
| 91 | + | ``` | |
| 92 | + | ||
| 93 | + | [More](https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh) information, [macFUSE and SSHFS](https://osxfuse.github.io/) and even [SSHFS-Win](https://osxfuse.github.io/). | |
| 94 | + | ||
| 95 | + | # Port Forwarding / Tunneling | |
| 96 | + | ||
| 97 | + | ! [SSH Tunnel](https://sslhowto.files.wordpress.com/2021/08/2922a-59b8e0_117ab19cfc3a42219ebb7ca9efa5c158mv2.png) | |
| 98 | + | ||
| 99 | + | ## Reverse Tunneling | |
| 100 | + | ||
| 85 | 101 | https://www.maketecheasier.com/kill-unresponsive-ssh-session/ | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 4 insertions, 1 deletion
ssh.md
| @@ -27,7 +27,7 @@ waja at Brotschneidemaschine in ~ | |||
| 27 | 27 | $ ssh-add -d ~/.ssh/id_rsa | |
| 28 | 28 | Identity removed: /Users/waja/.ssh/id_rsa RSA (waja@Brotschneidemaschine.local) | |
| 29 | 29 | ``` | |
| 30 | - | Identities are not permanent, Desktop-Managers reads keys from `basename -s .pub ~/.ssh/*.pub`. | |
| 30 | + | Identities are not permanent, maybe use something like `echo 'AddKeysToAgent yes' >> ~/.ssh/config`. | |
| 31 | 31 | ``` | |
| 32 | 32 | waja in 🌐 jumphost in ~ | |
| 33 | 33 | ✦ ❯ kill -9 7715 | |
| @@ -44,6 +44,9 @@ waja in 🌐 jumphost in ~ | |||
| 44 | 44 | ✦ ❯ ssh-add -L | |
| 45 | 45 | The agent has no identities. | |
| 46 | 46 | ``` | |
| 47 | + | ||
| 48 | + | You can [start](https://unix.stackexchange.com/a/390631) `ssh-agent` even via `systemd`. | |
| 49 | + | ||
| 47 | 50 | ## SSH Agent forwarding is nice but... | |
| 48 | 51 | ||
| 49 | 52 | [You should only add servers you trust and that you intend to use with agent forwarding.](https://docs.github.com/en/developers/overview/using-ssh-agent-forwarding) | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 1 insertion, 1 deletion
ssh.md
| @@ -60,7 +60,7 @@ Host 192.168.66.* | |||
| 60 | 60 | # https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts | |
| 61 | 61 | #ProxyJump user1@10.42.5.6:22 | |
| 62 | 62 | #ProxyCommand ssh -q -W %h:%p user1@10.42.5.6 | |
| 63 | - | ProxyCommand ssh -o 'ForwardAgent yes' 10.42.5.66 'ssh-add && nc %h %p' | |
| 63 | + | ProxyCommand ssh -o 'ForwardAgent yes' 10.42.5.6 'ssh-add && nc %h %p' | |
| 64 | 64 | ||
| 65 | 65 | ``` | |
| 66 | 66 | ||
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 35 insertions
ssh.md
| @@ -1,3 +1,4 @@ | |||
| 1 | + | # Agent Forwarding | |
| 1 | 2 | ||
| 2 | 3 | Adding and removing keys to the agent: | |
| 3 | 4 | ``` | |
| @@ -43,5 +44,39 @@ waja in 🌐 jumphost in ~ | |||
| 43 | 44 | ✦ ❯ ssh-add -L | |
| 44 | 45 | The agent has no identities. | |
| 45 | 46 | ``` | |
| 47 | + | ## SSH Agent forwarding is nice but... | |
| 48 | + | ||
| 49 | + | [You should only add servers you trust and that you intend to use with agent forwarding.](https://docs.github.com/en/developers/overview/using-ssh-agent-forwarding) | |
| 50 | + | [Why using SSH agent-forwarding is a Bad Idea](https://medium.com/kernel-space/why-using-ssh-agent-forwarding-is-a-bad-idea-6cbdff31bbee) | |
| 51 | + | ||
| 52 | + | # SSH ProxyCommand / ProxyJump | |
| 53 | + | ||
| 54 | + | ``` | |
| 55 | + | ~ via ☕ via | |
| 56 | + | ✦ ❯ tail -7 .ssh/config | |
| 57 | + | Host 192.168.66.* | |
| 58 | + | # https://www.cyberciti.biz/faq/linux-unix-ssh-proxycommand-passing-through-one-host-gateway-server/ | |
| 59 | + | # https://goteleport.com/blog/ssh-proxyjump-ssh-proxycommand/ | |
| 60 | + | # https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts | |
| 61 | + | #ProxyJump user1@10.42.5.6:22 | |
| 62 | + | #ProxyCommand ssh -q -W %h:%p user1@10.42.5.6 | |
| 63 | + | ProxyCommand ssh -o 'ForwardAgent yes' 10.42.5.66 'ssh-add && nc %h %p' | |
| 64 | + | ||
| 65 | + | ``` | |
| 66 | + | ||
| 67 | + | # SSH Multiplexing | |
| 68 | + | ||
| 69 | + | ``` | |
| 70 | + | ~ via ☕ via | |
| 71 | + | ✦ ❯ tail -8 .ssh/config | |
| 72 | + | Host * | |
| 73 | + | # https://www.cyberciti.biz/faq/linux-unix-reuse-openssh-connection/ | |
| 74 | + | # https://blog.scottlowe.org/2015/12/11/using-ssh-multiplexing/ | |
| 75 | + | # https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing | |
| 76 | + | ControlPath ~/.ssh/controlmasters/%r@%h:%p | |
| 77 | + | ControlMaster auto | |
| 78 | + | ControlPersist yes | |
| 79 | + | MaxSessions 10 | |
| 80 | + | ``` | |
| 46 | 81 | ||
| 47 | 82 | https://www.maketecheasier.com/kill-unresponsive-ssh-session/ | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 1 insertion, 1 deletion
ssh.md
| @@ -26,7 +26,7 @@ waja at Brotschneidemaschine in ~ | |||
| 26 | 26 | $ ssh-add -d ~/.ssh/id_rsa | |
| 27 | 27 | Identity removed: /Users/waja/.ssh/id_rsa RSA (waja@Brotschneidemaschine.local) | |
| 28 | 28 | ``` | |
| 29 | - | Identities are not permanent | |
| 29 | + | Identities are not permanent, Desktop-Managers reads keys from `basename -s .pub ~/.ssh/*.pub`. | |
| 30 | 30 | ``` | |
| 31 | 31 | waja in 🌐 jumphost in ~ | |
| 32 | 32 | ✦ ❯ kill -9 7715 | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 5 insertions
ssh.md
| @@ -17,6 +17,11 @@ waja at Brotschneidemaschine in ~ | |||
| 17 | 17 | $ ssh-add -L | |
| 18 | 18 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCfovU+pdwsO4ubyG8kldmtFwVcfNIbJX8Qvi+4rWKmkcEx7xdz27o+CrCXyu3eSbw8q/BVNZImwbs3C4dCBZ+o7ZtHmJGYzyrIOkY1AD1kdf0tbH3boEqoL46xOx8zGIUWCcuJd+bzMw/ub/5Qf+yW6a00h4szFiREyM6k2y+0gF21ewoSKPZp+XTFFXfOoGAllJ1rhQq+PScUHHu81Ft9bl18e0SWKRJd/EOiI+2/GAb/jtYo0lxyIk1GrmZDA80Tew7Mv636zWfXUaL1Tr4Y8Wxmeetr97MLcVcY9hMZmQlcmurDqeIJdWn1IAr8IRieLJZPiMjt09LZ2EAd/TmI2lbfy3c+013qmc4YoOhXDlRgoS5qeQr/zupP1/0ATzG37pGtkomO1zz9WBafFy5ewzIU1YUArV+/PNWbVdrnIEOKmHF/YM/ZCA5JwFp7M/8FOHZrM6KvCwcnmtHOzU+0y7eHYejUHTBOIrk9/SfP37IFEELaNrEJdDokQBXpT38= waja@Brotschneidemaschine.local | |
| 19 | 19 | ||
| 20 | + | waja at Brotschneidemaschine in ~ | |
| 21 | + | $ tail -2 .ssh/config | |
| 22 | + | Host * | |
| 23 | + | ForwardAgent yes | |
| 24 | + | ||
| 20 | 25 | waja at Brotschneidemaschine in ~ | |
| 21 | 26 | $ ssh-add -d ~/.ssh/id_rsa | |
| 22 | 27 | Identity removed: /Users/waja/.ssh/id_rsa RSA (waja@Brotschneidemaschine.local) | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 3 insertions, 1 deletion
ssh.md
| @@ -37,4 +37,6 @@ Agent pid 7795 | |||
| 37 | 37 | waja in 🌐 jumphost in ~ | |
| 38 | 38 | ✦ ❯ ssh-add -L | |
| 39 | 39 | The agent has no identities. | |
| 40 | - | ``` | |
| 40 | + | ``` | |
| 41 | + | ||
| 42 | + | https://www.maketecheasier.com/kill-unresponsive-ssh-session/ | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 17 insertions
ssh.md
| @@ -20,4 +20,21 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCfovU+pdwsO4ubyG8kldmtFwVcfNIbJX8Qvi+4rWKm | |||
| 20 | 20 | waja at Brotschneidemaschine in ~ | |
| 21 | 21 | $ ssh-add -d ~/.ssh/id_rsa | |
| 22 | 22 | Identity removed: /Users/waja/.ssh/id_rsa RSA (waja@Brotschneidemaschine.local) | |
| 23 | + | ``` | |
| 24 | + | Identities are not permanent | |
| 25 | + | ``` | |
| 26 | + | waja in 🌐 jumphost in ~ | |
| 27 | + | ✦ ❯ kill -9 7715 | |
| 28 | + | ||
| 29 | + | waja in 🌐 jumphost in ~ | |
| 30 | + | ✦ ❯ ssh-add -L | |
| 31 | + | Error connecting to agent: Connection refused | |
| 32 | + | ||
| 33 | + | waja in 🌐 jumphost in ~ | |
| 34 | + | ✦ ❯ eval "$(ssh-agent -s)" | |
| 35 | + | Agent pid 7795 | |
| 36 | + | ||
| 37 | + | waja in 🌐 jumphost in ~ | |
| 38 | + | ✦ ❯ ssh-add -L | |
| 39 | + | The agent has no identities. | |
| 23 | 40 | ``` | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 5 insertions
ssh.md
| @@ -1,5 +1,10 @@ | |||
| 1 | + | ||
| 1 | 2 | Adding and removing keys to the agent: | |
| 2 | 3 | ``` | |
| 4 | + | waja at Brotschneidemaschine in ~ | |
| 5 | + | $ eval "$(ssh-agent -s)" | |
| 6 | + | Agent pid 7715 | |
| 7 | + | ||
| 3 | 8 | waja at Brotschneidemaschine in ~ | |
| 4 | 9 | $ ssh-add -L | |
| 5 | 10 | The agent has no identities. | |
waja a révisé ce gist 3 years ago. Aller à la révision
1 file changed, 18 insertions
ssh.md(fichier créé)
| @@ -0,0 +1,18 @@ | |||
| 1 | + | Adding and removing keys to the agent: | |
| 2 | + | ``` | |
| 3 | + | waja at Brotschneidemaschine in ~ | |
| 4 | + | $ ssh-add -L | |
| 5 | + | The agent has no identities. | |
| 6 | + | ||
| 7 | + | waja at Brotschneidemaschine in ~ | |
| 8 | + | $ ssh-add ~/.ssh/id_rsa | |
| 9 | + | Identity added: /Users/waja/.ssh/id_rsa (waja@Brotschneidemaschine.local) | |
| 10 | + | ||
| 11 | + | waja at Brotschneidemaschine in ~ | |
| 12 | + | $ ssh-add -L | |
| 13 | + | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCfovU+pdwsO4ubyG8kldmtFwVcfNIbJX8Qvi+4rWKmkcEx7xdz27o+CrCXyu3eSbw8q/BVNZImwbs3C4dCBZ+o7ZtHmJGYzyrIOkY1AD1kdf0tbH3boEqoL46xOx8zGIUWCcuJd+bzMw/ub/5Qf+yW6a00h4szFiREyM6k2y+0gF21ewoSKPZp+XTFFXfOoGAllJ1rhQq+PScUHHu81Ft9bl18e0SWKRJd/EOiI+2/GAb/jtYo0lxyIk1GrmZDA80Tew7Mv636zWfXUaL1Tr4Y8Wxmeetr97MLcVcY9hMZmQlcmurDqeIJdWn1IAr8IRieLJZPiMjt09LZ2EAd/TmI2lbfy3c+013qmc4YoOhXDlRgoS5qeQr/zupP1/0ATzG37pGtkomO1zz9WBafFy5ewzIU1YUArV+/PNWbVdrnIEOKmHF/YM/ZCA5JwFp7M/8FOHZrM6KvCwcnmtHOzU+0y7eHYejUHTBOIrk9/SfP37IFEELaNrEJdDokQBXpT38= waja@Brotschneidemaschine.local | |
| 14 | + | ||
| 15 | + | waja at Brotschneidemaschine in ~ | |
| 16 | + | $ ssh-add -d ~/.ssh/id_rsa | |
| 17 | + | Identity removed: /Users/waja/.ssh/id_rsa RSA (waja@Brotschneidemaschine.local) | |
| 18 | + | ``` | |