Benutzer-Werkzeuge

Webseiten-Werkzeuge


en:howtos:sshstepstone

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

en:howtos:sshstepstone [2022/02/18 08:09] – Externe Bearbeitung 127.0.0.1en:howtos:sshstepstone [2022/02/18 08:42] (aktuell) morquai
Zeile 1: Zeile 1:
 ====== SSH - Stepping Stones ====== ====== SSH - Stepping Stones ======
-Was soll das seinein Stepping StoneMein Unternehmen stellt mir einen Rechner zur Verfügung, der als Einsprungspunkt ins Firmennetz dientAuf diesem Rechner sind erweiterte Authentifizierungsinformationen erforderlichz.Bein OATH (__O__ne __T__ime __A__uthorisation __T__oken). Eine Anmeldung nur durch einen Private Keys ist unterbundenDer Rechner ist also quasi der Einstiegspunkt in das Firmennetzwerk.\\ +What is that supposed to bea stepping stoneMy company provides me with a computer that serves as the entry point into the company networkExtended authentication information is required on this machinee.gan OATH (__O__ne __T__ime __A__uthorisation __T__oken). Registration using only a private key is prohibitedThe computer is therefore the entry point into the company network.\\ 
-Das tägliche Problem ist es zig-mal das OATH herauszugraben, sobald einer der Server meine Aufmerksamkeit verlangtDas muss auch einfacher gehenWie gehe ich vorIch melde mich auf hop.example.com an und wechsele von dort via ssh zu database.example.com, ich brauche also zwei Commands +The daily problem is digging out the OATH umpteen times as soon as one of the servers demands my attentionThere has to be an easier wayHow do I proceedI log into hop.example.com and ssh from there to database.example.com, so I need two commands 
-  Client: ssh hop.example.com # Damit bekomme ich eine Shell auf dem Stepping Stonemuss aber das OATH benutzen +  Client: ssh hop.example.com # This gives me a shell on the stepping stonebut 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 web.example.com anmeldenwiederholt sich die ProzedurDas OATH ist schon ganz abgegriffen 8-)\\+If I now also want to register on the web server web.example.com, the procedure is repeatedThe OATH is already worn out 8-)\\
 \\ \\
-Ich will es einfacher habenalso passe ich meine .ssh/config mal wieder anIch lasse den "Host *" Teil mal weg, um es übersichtlicher zu gestalten+I want it to be simplerso I'll adjust my .ssh/config againI omit the "Host *" part to make it clearer
-  # Erstmal den Stepping Stone definieren+  # First define the stepping stone
   Host step   Host step
-    User            admin +    User admin 
-    HostName        hop.example.com +    Host name hop.example.com 
-    ForwardX11      yes    +    ForwardX11 yes 
-    LocalForward    2222 localhost:22 +    LocalForward 2222 localhost:22 
-  # Jetzt den Port 2222 auf meinem Client +  # Now port 2222 on my client 
-  Host tunnel +  host tunnel 
-    HostName        localhost +    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
-    HostName        %h +    hostname %h 
-    User            admin +    User admin 
-    ProxyCommand    /usr/bin/ssh -q -W %h:%p tunnel +    ProxyCommand /usr/bin/ssh -q -W %h:%p tunnel 
-Der Befehl+The command
   ssh server2.example.com   ssh server2.example.com
-bringt mich jetzt sofort auf den angegeben Serverohne das ich nochmals das OATH bemühen mussEin Blick in den Debug Output (ssh -v) zeigt uns wie es funktioniert.+brings me now immediately to the specified serverwithout having to use OATH againA look at the debug output (ssh -v) shows us how it works.
   [user@client][/home/user] ssh -v server2.example.com   [user@client][/home/user] ssh -v server2.example.com
-  OpenSSH_7.5p1, OpenSSL 1.0.2k  26 Jan 2017+  OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
   debug1: Reading configuration data /home/user/.ssh/config   debug1: Reading configuration data /home/user/.ssh/config
   debug1: /home/user/.ssh/config line 114: Applying options for *   debug1: /home/user/.ssh/config line 114: Applying options for *
Zeile 33: Zeile 33:
   debug1: Executing proxy command: exec /usr/bin/ssh -q -W server2.example.com:22 tunnel   debug1: Executing proxy command: exec /usr/bin/ssh -q -W server2.example.com:22 tunnel
    
-Alles klarNatürlich nichtalso hier die Auflösung des RätselsEinmalig melde ich mich auf "step" an, um den lokalen Port 2222 mit dem Port 22 des Stepping Stones zu verheiratenHier muss ich mich natürlich mit meinem OATH ausweisenDiese SSH Session minimiere ich und vergessen sie. \\ +UnderstoodOf course notso here's the answer to the riddleOnce I log on to "step" to marry the local port 2222 to port 22 of the stepping stoneOf course I have to identify myself with my OATH hereI minimize this SSH session and forget about it. \\ 
-Da jetzt aller Traffic auf meinen lokalen Port 2222 an den Port 22 des Stepping Stones geleitet wirdkönnte ich mich jetzt sofort mit "ssh tunnel" auf dem Stepping Stone anmelden, ohne das OATH herausholen zu müssenDamit habe ich diese Schritt zwar vereinfacht muss aber immer noch zwei ssh Commands eingeben, um dahin zu kommen wo ich eigentlich hin muss.\\ +Since all traffic on my local port 2222 is now routed to the stepping stone's port 22, I could now immediately "ssh tunnel" into the stepping stone without having to pull out the OATH. So I have simplified this step, but I still have to enter two ssh commands to get to where I actually have to go.\\ 
-Der dritte Eintrag ist es, der mit den "direktenLogin erlaubtDer Parameter "ProxyCommand" sorgt dafür, das auf "tunnel" ein Befehl (ssh in diesem Fallgestartet wirdDer zu diesem ssh Aufruf "-W %h:%p" ist ein wenig kryptisch. In der .ssh/config kann ich Variablen verwenden, "%h" steht für den eingegeben Hostnamen, "%p" für eine eingegebene Portnummer (wenn man keine angegeben hatwird 22 als Default genommen).\\ +The third entry is the one that allows using the "directloginThe "ProxyCommand" parameter ensures that a command (ssh in this caseis started on "tunnel"The "-W %h:%p" call to this ssh is a bit cryptic. In the .ssh/config I can use variables, "%h" stands for the entered host name, "%p" for an entered port number (if you haven't entered one, 22 is taken as the default).\\ 
-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 ID (numerisch+  - %i - The local user ID (numeric
-  - %L - Der lokale hostname +  - %L - The local hostname 
-  - %l - Der voll qualifizierte lokale hostname (client.heim.netz+  - %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 auf dem Server +  - %r - The username on the server 
-  - %u - Der lokale Benutzename+  - %u - The local username
  
-Während der Arbeit habe ich nun aber immer das Fenster mit der "Step" Session offen, um den lokalen Port 2222 nutzen zu könnenWenn man das Fenster als störend empfindetkann man mit  +But while I'm working, I always have the window with the "Step" session open so that I can use the local port 2222. If you find the window annoyingyou can go with it
   ssh -N -f step   ssh -N -f step
-den ssh Prozess in den Hintergrund schicken und das Fenster schliessenEs stellt sich jetzt aber die Fragewie ich den so in den Hintergrund verschwundenen Prozess kontrollieren (.z.B. beendenkannDafür gibt es den sogenannte Control Mechanismus, der mit allen so aufgesetzten ssh Verbindungen über einen ControlPath kommunizieren kannAuf weitere Einsatzzwecke komme ich in weiteren HowTo'zu sprechenhier nur mal der Command um dies zu realisieren:+send the ssh process to the background and close the windowHoweverthe question now arises as to how I can control (e.gendthe process that has disappeared into the backgroundThere is the so-called control mechanism for this, which can communicate with all ssh connections set up in this way via a control pathI'll talk about other uses in other HowTo's, here's just the command to do this:
   ssh -N -f -o "ControlMaster=auto" -o "ControlPath=~/.ssh/cm_sockets/%r@%h:%p" step   ssh -N -f -o "ControlMaster=auto" -o "ControlPath=~/.ssh/cm_sockets/%r@%h:%p" step
-wird der Prozess gestartet und sofort in den Hintergrund geschicktDas Verzeichnis ~/.ssh/cm_sockets/ muss existieren. In der .ssh/config sind die Einträge wie folgt zu setzen+the process is started and immediately sent to the backgroundThe ~/.ssh/cm_sockets/ directory must exist. In the .ssh/config the entries are to be set as follows
-  # Erstmal den Stepping Stone definieren+  # First define the stepping stone
   Host step   Host step
-    User            admin +    User admin 
-    HostName        hop.example.com +    Host name hop.example.com 
-    ForwardX11      yes    +    ForwardX11 yes 
-    LocalForward    2222 localhost:22 +    LocalForward 2222 localhost:22 
-    ControlMaster   auto +    Control Master auto 
-    ControlMaster   ~/.ssh/cm_sockets/%r@%h:%p +    ControlMaster ~/.ssh/cm_sockets/%r@%h:%p 
-    ControlPersist  0+    ControlPersist 0
            
-Durch die Angabe eines ControlPath wird es uns möglichden Hintergrundprocess mit der Option "-O" zu kontrollieren +By specifying a ControlPath, we are able to control the background process with the "-O" option 
-  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 "-O" findet ihr, wie schon gesagt, in anderen SSH HowTo's.   +
- +
- +
- +
  
 +As already mentioned, you can find the other possible commands for "-O" in other SSH HowTo's.
en/howtos/sshstepstone.1645171795.txt.gz · Zuletzt geändert: 2022/02/18 08:09 von 127.0.0.1