Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
en:howtos:sshfreak [2022/02/18 08:09] – Externe Bearbeitung 127.0.0.1 | en:howtos:sshfreak [2022/02/18 08:43] (aktuell) – morquai | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== SSH - für Freaks | + | ====== SSH - for geeks ====== |
- | Wer bis hierhin durchgehalten hat, verdient sich ein Lob, hat aber nur an der Oberfläche geschnuppert. Jetzt endlich geht es ans Eingemachte.\\ | + | Anyone who has made it this far deserves praise, but has only sniffed the surface. Now it's finally time to get down to business.\\ |
- | SSH wird von vielen als sicher betrachtet, was wahrscheinlich an dem Wörtchen | + | SSH is considered secure by many, probably due to the word "secure" in " |
- | In Wirklichkeit ist SSH das Schweizer Taschenmesser zum Aushebeln von Sicherheitseinstellungen. Wie man dies nutzt und wie man sich dagegen schützt wird hier beschrieben. | + | In reality, |
- | ===== Tunnel, | + | ===== Tunnel, |
- | Was ist eigentlich unter einem SSH-Tunnel zu verstehen? Eine etablierte | + | What is actually meant by an SSH tunnel? An established |
- | Betrachten wir den hilfreichen Einsatz eines Tunnels an einem Beispiel | + | Let's look at the helpful use of a tunnel with an example. I work from home and use SSH access to access the company network. I have a connection and can issue commands on individual servers, but I don't have access to the company' |
- | Ein kleiner | + | A small SSH tunnel can help here: |
ssh -L 8080: | ssh -L 8080: | ||
- | Das war das ganze Geheimnis. Betrachten wir mal, was geschieht. Die Option | + | That was the whole secret. Let's see what happens. The "-L 8080: |
- | Geht das auch andersherum? Kann ich, obwohl der firmeneigene Proxy und die Firewall es verbieten Kontakt mit GoogleMail aufnehmen? SSH und die Tunnel sind auch hier die Lösung. | + | Does that also work the other way around? Can I contact Gmail even though the company' |
ssh -R 8443: | ssh -R 8443: | ||
- | Problem | + | Problem |
- | Das erscheint nicht praktikabel, | + | That doesn' |
ssh -D 3128 user@sshserver.firma.de | ssh -D 3128 user@sshserver.firma.de | ||
- | startet einen Socks Proxy auf meinem PC, der auf Port 3128 lauscht. Dort eingehender | + | starts a socks proxy on my pc listening on port 3128. Traffic |
- | Wenn der "Einbruch" so einfach ist, wie sieht es mit dem "Ausbruch" | + | If the "break-in" |
- | - einen SSH Server, der uneingeschränkten Zugang zum Internet | + | - an SSH server that has unrestricted access to the Internet |
- | - einen SSH Zugang aus der Firma zu diesem Server | + | - SSH access from the company to this server |
- | Der SSH Server ist das geringste Problem, ich starte einfach den Dienst auf meinem heimischen | + | The SSH server is the least of the problems, I just start the service on my home PC. Access from the company to this SSH server is easy to establish with a tunnel |
ssh -R 2222: | ssh -R 2222: | ||
- | und nun auf dem " | + | and now on the " |
ssh -D 3292 -p 2222 heimuser@localhost | ssh -D 3292 -p 2222 heimuser@localhost | ||
- | Ein wenig aufwendiger, aber mit zwei Befehlen durchaus im Rahmen des Machbaren.\\ | + | A little more complex, but definitely within the realm of possibility with two commands.\\ |
- | ===== geschachtelte Tunnel | + | |
- | Selbstverständlich kann man auch einen bestehenden Tunnel nutzen um darin einen weiteren Tunnel anzulegen. Die mehrfache Schachtelung macht es fast unmöglich | + | ===== nested tunnels |
- | ====== | + | Of course, you can also use an existing tunnel to create another tunnel in it. The multiple nesting makes it almost impossible to decrypt such a connection, since one does not know how many levels exist. Furthermore, an existing tunnel can be used to hide a VPN in that tunnel. This creates the possibility of connecting a secure network to the home network or to the Internet. |
- | Stellt man sich nun einmal auf die andere Seite, also nicht die des SSH Clients sondern auf die des SSH Server Administrators, | + | ====== |
- | SSH bietet nicht nur die clientseitigen Möglichkeiten, sondern auch die Einschränkung auf der Server Seite. Im Folgenden wenden wir uns einzelnen Konfigurationseinstellungen zu. | + | If you look at the other side, i.e. not that of the SSH client but that of the SSH server administrator, you seriously have to ask yourself whether |
- | ===== Authentifizierung | + | SSH offers not only the client-side possibilities, but also the limitation on the server side. In the following we turn to individual configuration settings. |
- | Für die Anmeldung | + | ===== Authentication |
+ | There are different options for logging on to an SSH server: | ||
* Password | * Password | ||
- | * SSH Keys | + | * SSH key |
- | * PAM (einschließlich | + | * PAM (including |
* Kerberos | * Kerberos | ||
- | * u.v.a. | + | * etc. |
- | Der Konfigurationsparameter | + | The " |
- | Die Verwendung von Puclic Keys kann geregelt werden, indem man es dem Administrator statt jedem User überlässt, | + | The use of public keys can be regulated by letting the administrator instead of each user maintain the authorized_keys |
- | AuthorizedKeysFile / | + | AuthorizedKeysFile / |
- | an einen Ort an dem der User keinen Schreibzugriff hat, kann nur noch der Administrator Public Keys dort eintragen. Im Zusammenspiel mit signierten Public Keys (siehe TrustedUserCAKeys) | + | only the administrator can enter public keys in a place where the user does not have write access. In combination with signed public keys (see TrustedUserCAKeys), the use of unsigned public keys can be prevented. \\ |
- | Es gibt also auf der Ebene Authentifizierung eine Reihe von Möglichkeiten nur vertrauenswürdigen Benutzern Zugriff zu gewähren. | + | So there are a number of options at the authentication level to only grant access to trustworthy users. |
- | ===== Tunnel | + | ===== Tunnels |
- | Der Einsatz von Tunneln sollte reglementiert werden. Zwei Paramter erlauben ein solche Einschränkung: | + | The use of tunnels should be regulated. Two parameters allow such a restriction: |
AllowTcpForwarding no | AllowTcpForwarding no | ||
PermitOpen none | PermitOpen none | ||
- | Ist der Einsatz eines Tunnels gewünscht, oder unerlässlich, | + | If the use of a tunnel is desired or essential, it can be specifically allowed |
Match Group tunnel | Match Group tunnel | ||
AllowTcpForwarding yes | AllowTcpForwarding yes | ||
- | | + | |
- | Auch die Beschränkung zum Öffnen eines Ports auf bestimmte, geprüfte und somit als sicher geltende Scripts kann helfen. Der entsprechende Paramter ist " | + | Restricting the opening of a port to certain scripts that have been checked and are therefore considered safe can also help. The corresponding parameter is " |
- | ===== VPNs verhindern | + | ===== Prevent |
- | Die Angabe von " | + | Specifying |
- | ===== Ports absichern, die von einem Client geöffnet werden | + | ===== Securing ports opened by a client |
- | Ist es einem Client erlaubt einen Port zu öffnen, muss man sich entscheiden ob der Port nur von dem Rechner benutzt werden kann, auf dem er geöffnet wurde, oder ob er auch von anderen Rechner angesprochen werden darf. Der Parameter | + | If a client is allowed to open a port, you have to decide whether the port can only be used by the computer on which it was opened, or whether it can also be accessed by other computers. The " |
- | ===== Fremden Zugriff gewähren | + | ===== Grant access to strangers |
- | Muss man Fremden Zugang gewähren muss man deren Möglichkeiten soweit wie möglich einschränken. Die Einrichtung einer CHROOT | + | If you have to grant access to strangers, you have to limit their options as much as possible. Establishing a CHROOT |
- | ChrootDirectory /pfad/zur/chroot | + | ChrootDirectory /path/to/chroot |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + |