#-----------------------------------------------------------------------------------------# # # # sshd_configuration # # Die # vor den Erklärungen stehen lassen, sonst könnte es zu Störungen kommen # # # #-----------------------------------------------------------------------------------------# #----------------------------------------------------------- # Allegemein - /etc/ssh/sshd_config #----------------------------------------------------------- Port 22 # Standard SSH Port. Ein verstecken ist sinnlos, da ein Portscann den SSH Port ohnehin aufdeckt SSH Port Protocol 2 # Das einzige SSH Protocol AddressFamily any # IPv4 und IPv6 Netzwerk. # ListenAddress $IP_INTERN # Set Listening Intern Address # ListenAddress $IP_EXTERN # Set Listening Extern Address #----------------------------------------------------------- # HostKey - Only the curvy one #----------------------------------------------------------- HostKey /etc/ssh/ssh_host_ed25519_key # Erlaube nur die sichere ECDSA Pub-Key Authentifizierung #----------------------------------------------------------- # Ciphers - Nur das beste für die Feste #----------------------------------------------------------- KexAlgorithms curve25519-sha256@libssh.org # Key exchange methods to generate per-connection keys MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-512 # Message authentication codes used to detect traffic modification Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com # Allow only sexy Encrypt-Ciphers. For Android-Connection add aes256-ctr HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-ed25519 # Accepted Pub-Key algorithms for the SSH-Server to authenticate to a SSH-Client #----------------------------------------------------------- # Logging #----------------------------------------------------------- LogLevel INFO # VERBOSE for more like key fingerprint logging SyslogFacility AUTHPRIV # Logging Authentication Commands #----------------------------------------------------------- # Authentication: #----------------------------------------------------------- MaxSessions 2 # Maximum allowed User Sessions MaxAuthTries 3 # Maximum allowed Auth Attempts StrictModes yes # Vorbeugen von Konfigurationsfehlern. LoginGraceTime 60 # Login Period Time to authenticate PermitRootLogin no # User Root darf nicht rein. Bei einem Angriff der meist genutzte Username um ins System zu kommen. PubkeyAuthentication yes # Erlaube Pub-Key Authentifikation PasswordAuthentication yes # Erlaube Passwort Authentifikation. Wenn man es nicht braucht, sollte man es deaktiveren. IgnoreRhosts yes # Deaktivierung von User Rhost Files. Wir geben jedesmal brav das Passwort ein PermitEmptyPasswords no # Keine Leeren Passwörter! HostbasedAuthentication no # keine Hostbasierende Authentifizierung ChallengeResponseAuthentication no TCPKeepAlive yes # Verbindungsabbruch verhindern. ClientAliveCountMax 2 # 2x Nachfragen ob wir noch da sind. ClientAliveInterval 1800 # Trennt die Verbindung nach 30 Minuten inaktivität. Wert kann rauf oder runter gesetzt werden. Angabe in Sekunden. #----------------------------------------------------------- # Security #----------------------------------------------------------- UsePAM yes # Allow PAM Authentication Compression no # Disable Compression for better Security # AllowUsers olum brunhilde # Erlaubt spezielle User. Hier olum and brunhilde. Keine Ahnung wer die sind. # AllowGroups ssh-pimps # Erlaubt eine spezielle Gruppe. Die Gruppe hier ist ssh-pimps # RekeyLimit 1G 1H # Limiting amount of data transmitted with a single session key Banner none # Disable Banner DebianBanner no # Deaktiviert den Debian Banner auf Debian basierten Systemen. Stattdessen kann man eine Welcome Message mit neofetch einrichten. VersionAddendum none # Deaktiviert SSH Protokol Banner PrintMotd no # Meldung des Tages deaktiveren. Kann man allerdings auch als Gimmick nutzen. bspw. den BOFH Ausredenkalender.... PrintLastLog yes # Zeigt an, wann wir uns das letzte mal eingelogt haben mit Datum und Uhrzeit PermitTunnel no # Wir wollen nur SSH Verbindungen. Daher ist das Tunneln verboten. PermitUserRC no # Disable User RC Files PermitUserEnvironment no # Disable User Environment Files # Disable Forwarding GatewayPorts no # Disable Remote Port Forwarding X11Forwarding no # Disable X11 Forwarding/Tunneling (GUI) AllowTcpForwarding no # Disable TCP Forwarding/Tunneling AllowAgentForwarding no # Disable Agent Forwarding/Tunneling # Disable Kerberos Authentication KerberosOrLocalPasswd no KerberosAuthentication no KerberosTicketCleanup yes GSSAPIAuthentication no GSSAPICleanupCredentials yes AuthorizedKeysFile %h/.ssh/authorized_keys # Set AuthorizedKeysFile in a controlled manner #----------------------------------------------------------- # Verschiedenes #----------------------------------------------------------- UseDNS no # Disables DSN-Lookup for the Love of Speed AcceptEnv LANG LC_* # Allow locale environment variables for Clients #----------------------------------------------------------- # SFTP #----------------------------------------------------------- # SFTP - Enable if need # Subsystem sftp /usr/lib/openssh/sftp-server -f AUTHPRIV -l INFO # Set special stuff to special SFTP-Users - Enable if you use SFTP # Match Group sftp-pimps # ChrootDirectory /home/%u # PermitTunnel no # X11Forwarding no # AllowTcpForwarding no # AllowAgentForwarding no # ForceCommand internal-sftp #----------------------------------------------------------- # Set special SSH-User/Group options #----------------------------------------------------------- # Match User olum,brunhilde # PasswordAuthentication yes # AllowTcpForwarding yes # Match Group ssh-pimps # PasswordAuthentication yes # AllowTcpForwarding yes #----------------------------------------------------------- # Documentation #----------------------------------------------------------- # https://man7.org/linux/man-pages/man1/ssh-keygen.1.html # https://man7.org/linux/man-pages/man5/sshd_config.5.html