tech:notes_ssh_proxy_jump_proxycommand
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:notes_ssh_proxy_jump_proxycommand [2025/07/23 14:45] – Jean-Baptiste | tech:notes_ssh_proxy_jump_proxycommand [2026/02/06 10:05] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes SSH proxy jump ProxyCommand | ||
| + | |||
| + | |||
| + | L’intérêt étant de ne pas déposer ailleurs sa clef SSH privée | ||
| + | |||
| + | ~~~bash | ||
| + | ssh -t -A serveurBastionRebond ssh serveurPlop118 | ||
| + | ~~~ | ||
| + | |||
| + | Ou plus simple : | ||
| + | |||
| + | '' | ||
| + | ~~~ | ||
| + | Host serveurPlop118 | ||
| + | ProxyCommand ssh -W %h:%p bastion | ||
| + | | ||
| + | ### Si besion | ||
| + | |||
| + | Host bastion | ||
| + | Hostname 192.168.2.34 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Avec sshpass | ||
| + | |||
| + | '' | ||
| + | |||
| + | ~~~ | ||
| + | Host l12* 192.168.* !pom01 !l12srvpom01 !192.168.50.160 | ||
| + | User admin | ||
| + | ProxyCommand sshpass -e ssh -W %h:%p pom01 | ||
| + | |||
| + | Host l12srvpom01 pom01 | ||
| + | Hostname 192.168.50.160 | ||
| + | User admin | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | read -s SSHPASS | ||
| + | export SSHPASS | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Pb | ||
| + | |||
| + | ~~~ | ||
| + | $ ssh -t -A bastion ssh -o StrictHostKeychecking=no 192.168.1.22 | ||
| + | Permission denied (publickey). | ||
| + | Shared connection to 171.33.90.69 closed | ||
| + | ~~~ | ||
| + | |||
| + | Solution | ||
| + | ~~~bash | ||
| + | ssh -O stop bastion | ||
| + | ~~~ | ||
| + | |||
| + | ou | ||
| + | ~~~bash | ||
| + | ssh -o ControlMaster=no 192.168.1.22 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Exemple | ||
| + | |||
| + | '' | ||
| + | ~~~ | ||
| + | Host rebond | ||
| + | Hostname 192.168.89.155 | ||
| + | User jean | ||
| + | |||
| + | Host old-rhel5 | ||
| + | Hostname 192.168.50.20 | ||
| + | User root | ||
| + | ProxyCommand ssh -W %h:%p rebond | ||
| + | KexAlgorithms +diffie-hellman-group1-sha1, | ||
| + | HostKeyAlgorithms +ssh-rsa | ||
| + | PubkeyAcceptedKeyTypes +ssh-rsa | ||
| + | SetEnv TERM=linux | ||
| + | | ||
| + | Host old-rhel3 | ||
| + | Hostname 192.168.50.30 | ||
| + | KexAlgorithms +diffie-hellman-group1-sha1, | ||
| + | HostKeyAlgorithms +ssh-rsa | ||
| + | PubkeyAcceptedKeyTypes +ssh-rsa | ||
| + | Ciphers +aes256-cbc | ||
| + | SetEnv TERM=linux | ||
| + | |||
| + | Host centreon | ||
| + | Hostname 192.168.50.21 | ||
| + | User root | ||
| + | ProxyCommand ssh -W %h:%p rebond | ||
| + | RemoteForward 3128 192.168.89.221: | ||
| + | LocalForward 8081 localhost: | ||
| + | # ExitOnForwardFailure yes | ||
| + | # SendEnv LANG LC_* | ||
| + | ~~~ | ||
| + | |||
| + | FIXME | ||
| + | |||
