Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
en:howtos:sshstepstone [2022/02/18 08:09] – Externe Bearbeitung 127.0.0.1 | en:howtos:sshstepstone [2022/02/18 08:42] (aktuell) – morquai | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== SSH - Stepping Stones ====== | ====== SSH - Stepping Stones ====== | ||
- | Was soll das sein, ein Stepping Stone. Mein Unternehmen stellt mir einen Rechner zur Verfügung, der als Einsprungspunkt ins Firmennetz dient. Auf diesem Rechner sind erweiterte Authentifizierungsinformationen erforderlich, z.B. ein OATH (__O__ne __T__ime __A__uthorisation __T__oken). | + | What is that supposed to be, a stepping stone. My company provides me with a computer that serves as the entry point into the company network. Extended authentication information is required on this machine, e.g. an OATH (__O__ne __T__ime __A__uthorisation __T__oken). |
- | Das tägliche Problem ist es zig-mal das OATH herauszugraben, | + | The daily problem is digging out the OATH umpteen times as soon as one of the servers demands my attention. There has to be an easier way. How do I proceed? I log into hop.example.com |
- | Client: ssh hop.example.com # Damit bekomme ich eine Shell auf dem Stepping Stone, muss aber das OATH benutzen | + | Client: ssh hop.example.com # This gives me a shell on the stepping stone, but I have to use the OATH |
- | Hop: ssh database.example.com # Nun bin ich auf dem Datenbank Server | + | Hop: ssh database.example.com # Now I'm on the database server |
- | Will ich mich nun auch noch auf dem WebServer | + | If I now also want to register on the web server |
\\ | \\ | ||
- | Ich will es einfacher haben, also passe ich meine .ssh/ | + | I want it to be simpler, so I'll adjust my .ssh/ |
- | # Erstmal den Stepping Stone definieren | + | # First define the stepping stone |
Host step | Host step | ||
- | User admin | + | User admin |
- | | + | |
- | ForwardX11 | + | ForwardX11 yes |
- | LocalForward | + | LocalForward 2222 localhost: |
- | # Jetzt den Port 2222 auf meinem Client | + | # Now port 2222 on my client |
- | | + | |
- | HostName | + | HostName localhost |
- | Port 2222 | + | Port 2222 |
- | User admin | + | User admin |
- | # Nun den Rest der Firma | + | # Now the rest of the company |
Host *.example.com | Host *.example.com | ||
- | | + | |
- | User admin | + | User admin |
- | ProxyCommand | + | ProxyCommand / |
- | Der Befehl | + | The command |
ssh server2.example.com | ssh server2.example.com | ||
- | bringt mich jetzt sofort auf den angegeben Server, ohne das ich nochmals das OATH bemühen muss. Ein Blick in den Debug Output | + | brings me now immediately to the specified server, without having to use OATH again. A look at the debug output |
[user@client][/ | [user@client][/ | ||
- | OpenSSH_7.5p1, | + | OpenSSH_7.5p1, |
debug1: Reading configuration data / | debug1: Reading configuration data / | ||
debug1: / | debug1: / | ||
Zeile 33: | Zeile 33: | ||
debug1: Executing proxy command: exec / | debug1: Executing proxy command: exec / | ||
- | Alles klar? Natürlich nicht, also hier die Auflösung des Rätsels. Einmalig melde ich mich auf " | + | Understood? Of course not, so here's the answer to the riddle. Once I log on to " |
- | Da jetzt aller Traffic auf meinen lokalen Port 2222 an den Port 22 des Stepping Stones geleitet wird, könnte ich mich jetzt sofort mit "ssh tunnel" | + | Since all traffic on my local port 2222 is now routed to the stepping stone' |
- | Der dritte Eintrag ist es, der mit den "direkten" | + | The third entry is the one that allows using the "direct" |
- | Eine Liste der nutzbaren Variablen ist: | + | A list of usable variables is: |
- | - %% - Das Zeichen | + | - %% - The character |
- | - %C - Abkürzung für %l%h%p%r | + | - %C - Abbreviation for %l%h%p%r |
- | - %d - Pfadname des lokalne Home Directories | + | - %d - pathname of local home directory |
- | - %h - Der lokale Hostname | + | - %h - The local hostname |
- | - %i - Die lokale Benutzer | + | - %i - The local user ID (numeric) |
- | - %L - Der lokale | + | - %L - The local hostname |
- | - %l - Der voll qualifizierte lokale | + | - %l - The fully qualified local hostname (client.home.net) |
- | - %n - Der im ssh Command angegebene Hostname | + | - %n - The hostname specified in the ssh command |
- | - %p - Der Port auf der Server Seite | + | - %p - The port on the server side |
- | - %r - Der username | + | - %r - The username |
- | - %u - Der lokale Benutzename | + | - %u - The local username |
- | Während der Arbeit habe ich nun aber immer das Fenster mit der " | + | But while I'm working, I always have the window with the " |
ssh -N -f step | ssh -N -f step | ||
- | den ssh Prozess in den Hintergrund schicken und das Fenster schliessen. Es stellt sich jetzt aber die Frage, wie ich den so in den Hintergrund verschwundenen Prozess kontrollieren | + | send the ssh process to the background and close the window. However, the question now arises as to how I can control |
ssh -N -f -o " | ssh -N -f -o " | ||
- | wird der Prozess gestartet und sofort in den Hintergrund geschickt. Das Verzeichnis | + | the process is started and immediately sent to the background. The ~/ |
- | # Erstmal den Stepping Stone definieren | + | # First define the stepping stone |
Host step | Host step | ||
- | User admin | + | User admin |
- | | + | |
- | ForwardX11 | + | ForwardX11 yes |
- | LocalForward | + | LocalForward 2222 localhost: |
- | | + | |
- | ControlMaster | + | ControlMaster ~/ |
- | ControlPersist | + | ControlPersist 0 |
- | Durch die Angabe eines ControlPath | + | By specifying a ControlPath, |
- | ssh -O check step # Prüft, ob die Connection aktiv ist | + | ssh -O check step # Checks whether the connection is active |
- | ssh -O exit step # beenden die Connection | + | ssh -O exit step # terminate the connection |
- | + | ||
- | Die weiteren möglichen Befehle zu " | + | |
- | + | ||
- | + | ||
- | + | ||
+ | As already mentioned, you can find the other possible commands for " |