Benutzer-Werkzeuge

Webseiten-Werkzeuge


ssh_ssl

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
ssh_ssl [2023-03-17 20:44:50] – [SSHD Config] davidssh_ssl [2024-07-27 22:28:01] (aktuell) david
Zeile 3: Zeile 3:
   * [[http://www.golem.de/news/dan-j-bernstein-krypto-algorithmen-sicher-designen-1501-111605-2.html|Krypto-Algorithmen sicher designen]] von Dan J. Bernstein -> Dan Bernstein fordert Algorithmen, bei denen man weniger falsch machen kann.   * [[http://www.golem.de/news/dan-j-bernstein-krypto-algorithmen-sicher-designen-1501-111605-2.html|Krypto-Algorithmen sicher designen]] von Dan J. Bernstein -> Dan Bernstein fordert Algorithmen, bei denen man weniger falsch machen kann.
   * **[[SSH-Schlüssel austauschen für ein passwortlosen Login]]**   * **[[SSH-Schlüssel austauschen für ein passwortlosen Login]]**
-  * [[SSL-Schlüssel generieren]] +  * [[OpenSSL]] 
-    * [[Let's Encrypt]]+  * [[::EDV:SSL-Schlüssel generieren]] 
 +    * [[letsencrypt]]
   * [[einzelne Dateien mit openSSL verschlüsseln]]   * [[einzelne Dateien mit openSSL verschlüsseln]]
   * [[Datenbankverbindungen zu einer MySQL mit SSL-Verschlüsselung]]   * [[Datenbankverbindungen zu einer MySQL mit SSL-Verschlüsselung]]
Zeile 10: Zeile 11:
   * [[SCP-only mit Change Root]]   * [[SCP-only mit Change Root]]
   * [[SFTP-User mit Change Root]]   * [[SFTP-User mit Change Root]]
-    * Datenaustausch zwischen **Android** ([[https://play.google.com/store/apps/details?id=nextapp.fx|FX File Explorer]] & [[https://play.google.com/store/apps/details?id=nextapp.fx.rk|FX Plus License]]) und **FreeBSD** per **''SFTP''**: +    * Datenaustausch zwischen **Android** ([[https://play.google.com/store/apps/details?id=nextapp.fx|FX File Explorer]] & [[https://play.google.com/store/apps/details?id=nextapp.fx.rk|FX Plus License]]) und **FreeBSD** per **''SFTP''**: siehe [[#sshd_config|SSHD Config]]
-      * dafür muß auf dem **FreeBSD-Server** folgendes eingestellt werden: +
-        * ''vim /etc/ssh/sshd_config'' +
-          <code yaml /etc/ssh/sshd_config> +
-          PermitRootLogin prohibit-password +
-          PubkeyAuthentication yes +
-          PasswordAuthentication no +
-          PermitEmptyPasswords no +
-          ChallengeResponseAuthentication no +
-          UsePAM no +
-          Subsystem sftp internal-sftp -u 0022 +
-          </code>+
   * [[SSH/BASH mit Change Root]]   * [[SSH/BASH mit Change Root]]
   * [[SSH-Tunnel]]   * [[SSH-Tunnel]]
Zeile 114: Zeile 104:
 ===== SSH Config ===== ===== SSH Config =====
  
-Beispiel Konfiguration, die nur Ed25519 erlaubt+Beispiel Konfiguration, die nur Ed25519 erlaubt (nur als Beispiel, wenn überhaupt sollte der Server Cipher usw. einschränken)
 <code yaml ~/.ssh/config> <code yaml ~/.ssh/config>
 #https://man.openbsd.org/ssh #https://man.openbsd.org/ssh
Zeile 120: Zeile 110:
 #ssh -Q help #ssh -Q help
  
-HOST *+Host *
     #ssh -Q sig     #ssh -Q sig
     CASignatureAlgorithms ssh-ed25519,sk-ssh-ed25519@openssh.com     CASignatureAlgorithms ssh-ed25519,sk-ssh-ed25519@openssh.com
Zeile 139: Zeile 129:
 </code> </code>
  
-alle 30s ein Nullpaket (keep-alive) an den Server senden (hier bis zu 30 Mal)+Alle 3s ein Nullpaket (keep-alive) an den Server senden (hier bis zu 10 Mal)
 <code yaml ~/.ssh/config> <code yaml ~/.ssh/config>
-HOST +Host 
-    ServerAliveInterval 30 +    ClientAliveInterval 10 
-    ServerAliveCountMax 30+    ClientAliveCountMax 3 
 +    TCPKeepAlive yes
  
 </code> </code>
  
-Für den Host example.com einen anderen Standard-Port verwenden (hier: 2222)+Andere Config-Dateien einlesen
 <code yaml ~/.ssh/config> <code yaml ~/.ssh/config>
-HOST example.com+Include config.d/*.conf 
 + 
 +</code> 
 + 
 +Für den Host example.com einen anderen Standard-Port verwenden (hier: 2222) 
 +<code yaml ~/.ssh/config.d/example-com.conf> 
 +Host example.com
     Port 2222     Port 2222
  
Zeile 156: Zeile 153:
  
 ===== SSHD Config ===== ===== SSHD Config =====
 +
 +siehe [[https://man.openbsd.org/sshd_config]]
 +
 +==== komplette Beispiel-Config ====
 +
 +
 +=== Unix-like ===
 +
 +<code yaml /etc/ssh/sshd_config>
 +Port 22
 +AddressFamily any
 +ListenAddress 0.0.0.0
 +ListenAddress ::
 +
 +PermitRootLogin prohibit-password
 +
 +PubkeyAuthentication yes
 +AuthorizedKeysFile .ssh/authorized_keys
 +
 +HostbasedAuthentication no
 +
 +PasswordAuthentication no
 +PermitEmptyPasswords no
 +
 +KbdInteractiveAuthentication no
 +ChallengeResponseAuthentication no
 +KerberosAuthentication no
 +GSSAPIAuthentication no
 +
 +UsePAM yes
 +
 +X11Forwarding yes
 +PrintMotd no
 +PrintLastLog yes
 +TCPKeepAlive yes
 +ClientAliveInterval 10
 +ClientAliveCountMax 3
 +VersionAddendum none
 +Banner none
 +# Debian only
 +DebianBanner no
 +
 +Subsystem sftp internal-sftp -u 0022
 +
 +Match User mm
 +    AllowTcpForwarding no
 +    ChrootDirectory /public/mm
 +    ForceCommand internal-sftp
 +    PasswordAuthentication yes
 +    PermitTTY no
 +    X11Forwarding no
 +</code>
 +
 +
 +=== Windows ===
 +
 +<code yaml C:/ProgramData/ssh/sshd_config>
 +Port 22
 +Port 23
 +AddressFamily any
 +ListenAddress 0.0.0.0
 +ListenAddress ::
 +
 +PermitRootLogin prohibit-password
 +
 +PubkeyAuthentication yes
 +AuthorizedKeysFile .ssh/authorized_keys
 +
 +HostbasedAuthentication no
 +
 +PasswordAuthentication no
 +PermitEmptyPasswords no
 +
 +KbdInteractiveAuthentication no
 +ChallengeResponseAuthentication no
 +GSSAPIAuthentication no
 +
 +PrintMotd yes
 +PrintLastLog yes
 +TCPKeepAlive yes
 +ClientAliveInterval 10
 +ClientAliveCountMax 3
 +VersionAddendum none
 +Banner none
 +
 +Subsystem sftp internal-sftp
 +
 +#Match Group administrators
 +#    AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
 +
 +# configure pwsh as default shell (run command in pwsh as admin):
 +# New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$(Get-Command pwsh | Convert-Path)" -PropertyType String -Force
 +</code>
 +
 +
 +==== Zugriff ====
 +
 +Port 22 und 23 (z.B. extern nur 23 erlauben und intern 22 nutzen)
 +
 +<code yaml /etc/ssh/sshd_config>
 +Port 22
 +Port 23
 +AddressFamily any
 +ListenAddress 0.0.0.0
 +ListenAddress ::
 +</code>
 +
 +
 +Port 22 (IPv4+IPv6) und 23 (IPv6) (gleiches Beispiel wie oben, falls man im Router eine IPv4 Portweiterleitung über NAT umleiten will)
  
 <code yaml /etc/ssh/sshd_config> <code yaml /etc/ssh/sshd_config>
 #Port 22 #Port 22
 +#AddressFamily any
 +#ListenAddress 0.0.0.0
 +#ListenAddress ::
 ListenAddress 0.0.0.0:22 ListenAddress 0.0.0.0:22
 ListenAddress [::]:22 ListenAddress [::]:22
Zeile 164: Zeile 273:
 </code> </code>
  
 +=== Allgemein ===
 +          
 <code yaml /etc/ssh/sshd_config> <code yaml /etc/ssh/sshd_config>
-# root login only with key 
 PermitRootLogin prohibit-password PermitRootLogin prohibit-password
-# root login allowed 
-PermitRootLogin yes 
 PubkeyAuthentication yes PubkeyAuthentication yes
-PasswordAuthentication yes+PasswordAuthentication no
 PermitEmptyPasswords no PermitEmptyPasswords no
 ChallengeResponseAuthentication no ChallengeResponseAuthentication no
Zeile 178: Zeile 286:
 PrintLastLog yes PrintLastLog yes
 </code> </code>
 +
 +==== SFTP ====
 +
 +Um die Standard umask zu verwenden einfach '-u 0022' weglassen
  
 <code yaml /etc/ssh/sshd_config> <code yaml /etc/ssh/sshd_config>
-# omit '-u 0022' to use default umask 
 # internal sftp (recommended) # internal sftp (recommended)
 Subsystem sftp internal-sftp -u 0022 Subsystem sftp internal-sftp -u 0022
 +
 # external sftp # external sftp
 +
 ## Debian/Ubuntu ## Debian/Ubuntu
 Subsystem sftp /usr/lib/openssh/sftp-server -u 0022 Subsystem sftp /usr/lib/openssh/sftp-server -u 0022
 +
 ## FreeBSD ## FreeBSD
 Subsystem sftp /usr/libexec/sftp-server -u 0022 Subsystem sftp /usr/libexec/sftp-server -u 0022
 +
 </code> </code>
  
Zeile 267: Zeile 382:
 RSA mit großer Schlüssellänge ist z.Z. die sicherste Alternative. RSA mit großer Schlüssellänge ist z.Z. die sicherste Alternative.
  
-der ED25519-Schlüssel hat eine __feste Länge von 256 Bit__, hier wird die Option ''"-b"'' __ignoriert__:+der ED25519-Schlüssel hat eine __feste Länge von 256 Bit__, hier wird die Option ''-b'' __ignoriert__:
   > ssh-keygen -t ed25519 -a 1024   > ssh-keygen -t ed25519 -a 1024
  
/home/http/wiki/data/attic/ssh_ssl.1679085890.txt · Zuletzt geändert: von david