Page 1 of 2
OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 09:31
by Proteus
Hallo,
da ich mich nicht so sehr mit OpenSSL auskenne, ist mir halt aufgefallen, das das Generieren der:
Code: Select all
openssl genpkey -genparam -algorithm DH -pkeyopt dh_paramgen_prime_len:4096 -out /etc/ssl/dh_params.pem
extrem lange dauert. Ich habe es heute Nacht mal durchlaufen lassen, und selbst das 12 Stunden war er noch nicht fertig. Irgendwas stimmt nicht, oder ich mache etwas falsch.
MfG
Proti
PS. Übrigens Danke die die Namensnennung in der Wiki, es ehrt mich ungemein! :ymblushing:
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 09:38
by Proteus
Mir ist noch was aufgefallen. Es erscheint aber nur in der KVM Konsole.
Bild ist im Dateianhang.
MfG Proteus
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 14:24
by Joe User
Die Generierung der dhparams dauert durchaus mal eine Stunde, selten auch länger.
Zwölf Stunden erklären sich für mich nur durch ein virtuelles System mit mangelhaftem oder fehlendem Input für den Zufallszahlengenerator hinter /dev/random
Abhilfe schafft hier eine vernünftige Konfiguration des VM-Host (aktivieren der Hardwareunterstützung für Zufallszahlengeneratoren innerhalb der virtuellen Maschinen) und/oder gleichzeitiger Aktivität innerhalb der VM.
Die Logzeile bezüglich PAM verschwindet durch deaktivieren von PAM in OpenSSH mittels "UsePAM no" in der /etc/ssh/sshd_config
Die Logzeilen bezüglich der fehlenden mac können ignoriert werden, sofern man selbst einen halbwegs aktuellen SSH-Client verwendet. Ursache sind deaktivierte unsichere MAC Verfahren, welche nur noch von veralteten unsicheren SSH-Clients und Bruteforcebots verwendet werden.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 14:32
by Joe User
Proteus wrote:PS. Übrigens Danke die die Namensnennung in der Wiki, es ehrt mich ungemein! :ymblushing:
Wer sich aktiv beteiligt, sollte auch genannt werden. Meiner Meinung nach ist das nur fair und selbstverständlich.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 17:31
by Proteus
Joe User wrote:Die Generierung der dhparams dauert durchaus mal eine Stunde, selten auch länger.
Zwölf Stunden erklären sich für mich nur durch ein virtuelles System mit mangelhaftem oder fehlendem Input für den Zufallszahlengenerator hinter /dev/random
Abhilfe schafft hier eine vernünftige Konfiguration des VM-Host (aktivieren der Hardwareunterstützung für Zufallszahlengeneratoren innerhalb der virtuellen Maschinen) und/oder gleichzeitiger Aktivität innerhalb der VM.
Gut das mit der VM verstehe ich, aber das passiert nicht in einer VM, sondern auf einem normalem ProLiant Gen8 Server mit 8 CPU und 8 virtuellen CPU`s
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 17:50
by Proteus
Wenn wir schon bei der FAQ sind hier fällt mir noch ein Fehler auf und zwar das neu schreiben der sshd_conf. Am Ende erscheint die Fehlermeldung:
Code: Select all
sed -e 's/^#\(Protocol\).*$/\1 2/' \
-e 's/^#\(HostKey /etc/ssh/ssh_host_rsa_key\).*$/\1/' \
-e 's/^#\(HostKey /etc/ssh/ssh_host_ecdsa_key\).*$/\1/' \
-e 's/^#\(HostKey /etc/ssh/ssh_host_ed25519_key\).*$/\1/' \
-e 's/^#\(RekeyLimit\).*$/\1 500M 1h/' \
-e 's/^#\(LoginGraceTime\).*$/\1 1m/' \
-e 's/^#\(PermitRootLogin\).*$/\1 yes/' \
-e 's/^#\(StrictModes\).*$/\1 yes/' \
-e 's/^#\(MaxAuthTries\).*$/\1 3/' \
-e 's/^#\(MaxSessions\).*$/\1 10/' \
-e 's/^#\(RSAAuthentication\).*$/\1 no/' \
-e 's/^#\(PubkeyAuthentication\).*$/\1 yes/' \
-e 's/^#\(IgnoreRhosts\).*$/\1 yes/' \
-e 's/^#\(PasswordAuthentication\).*$/\1 no/' \
-e 's/^#\(PermitEmptyPasswords\).*$/\1 no/' \
-e 's/^#\(ChallengeResponseAuthentication\).*$/\1 no/' \
-e 's/^#\(UsePAM\).*$/\1 no/' \
-e 's/^#\(AllowAgentForwarding\).*$/\1 no/' \
-e 's/^#\(AllowTcpForwarding\).*$/\1 no/' \
-e 's/^#\(GatewayPorts\).*$/\1 no/' \
-e 's/^#\(X11Forwarding\).*$/\1 no/' \
-e 's/^#\(PermitTTY\).*$/\1 yes/' \
-e 's/^#\(UseLogin\).*$/\1 no/' \
-e 's/^#\(UsePrivilegeSeparation\).*$/\1 sandbox/' \
-e 's/^#\(PermitUserEnvironment\).*$/\1 no/' \
-e 's/^#\(UseDNS\).*$/\1 yes/' \
-e 's/^#\(MaxStartups\).*$/\1 10:30:100/' \
-e 's/^#\(PermitTunnel\).*$/\1 no/' \
-e 's/^#\(ChrootDirectory\).*$/\1 %h/' \
-e 's/^\(Subsystem.*\)$/#\1/' \
-i '' /etc/ssh/sshd_config
sed: 1: "s/^#\(HostKey /etc/ssh/ ...": RE error: parentheses not balanced
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 18:05
by Joe User
OK, der Fehler im sed ist behoben und beim nächsten Update im Laufe des Abends auch online. Bis dahin hier der Fix:
Code: Select all
sed -e 's|^#\(Protocol\).*$|\1 2|' \
-e 's|^#\(HostKey /etc/ssh/ssh_host_rsa_key\).*$|\1|' \
-e 's|^#\(HostKey /etc/ssh/ssh_host_ecdsa_key\).*$|\1|' \
-e 's|^#\(HostKey /etc/ssh/ssh_host_ed25519_key\).*$|\1|' \
-e 's|^#\(RekeyLimit\).*$|\1 500M 1h|' \
-e 's|^#\(LoginGraceTime\).*$|\1 1m|' \
-e 's|^#\(PermitRootLogin\).*$|\1 yes|' \
-e 's|^#\(StrictModes\).*$|\1 yes|' \
-e 's|^#\(MaxAuthTries\).*$|\1 3|' \
-e 's|^#\(MaxSessions\).*$|\1 10|' \
-e 's|^#\(RSAAuthentication\).*$|\1 no|' \
-e 's|^#\(PubkeyAuthentication\).*$|\1 yes|' \
-e 's|^#\(IgnoreRhosts\).*$|\1 yes|' \
-e 's|^#\(PasswordAuthentication\).*$|\1 no|' \
-e 's|^#\(PermitEmptyPasswords\).*$|\1 no|' \
-e 's|^#\(ChallengeResponseAuthentication\).*$|\1 no|' \
-e 's|^#\(UsePAM\).*$|\1 no|' \
-e 's|^#\(AllowAgentForwarding\).*$|\1 no|' \
-e 's|^#\(AllowTcpForwarding\).*$|\1 no|' \
-e 's|^#\(GatewayPorts\).*$|\1 no|' \
-e 's|^#\(X11Forwarding\).*$|\1 no|' \
-e 's|^#\(PermitTTY\).*$|\1 yes|' \
-e 's|^#\(UseLogin\).*$|\1 no|' \
-e 's|^#\(UsePrivilegeSeparation\).*$|\1 sandbox|' \
-e 's|^#\(PermitUserEnvironment\).*$|\1 no|' \
-e 's|^#\(UseDNS\).*$|\1 yes|' \
-e 's|^#\(MaxStartups\).*$|\1 10:30:100|' \
-e 's|^#\(PermitTunnel\).*$|\1 no|' \
-e 's|^#\(ChrootDirectory\).*$|\1 %h|' \
-e 's|^\(Subsystem.*\)$|#\1|' \
-i '' /etc/ssh/sshd_config
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 18:20
by Joe User
Proteus wrote:Gut das mit der VM verstehe ich, aber das passiert nicht in einer VM, sondern auf einem normalem ProLiant Gen8 Server mit 8 CPU und 8 virtuellen CPU`s
Das ist ungewöhnlich :(
Beim nächsten mal bitte etwas zufällige Hintergrundlast für CPU, Netzwerk und HDD erzeugen, welche keine Zufallszahlen benötigt (also kein SSL oder sonstige Verschlüsselung).
Falls der Server im BIOS eine Option zum (De)Aktivieren des Hardwarezufallsgenerator hat (bei Intel-CPUs RDRAND genannt), dann bitte aktivieren. TPM kann dagegen deativiert werden.
Unabhängig davon:
Ich werde das Erzeugen der DHParams im HowTo demnächst an einen späteren Zeitpunkt verschieben, so dass zumindest ein bischen Hintergrundaktivität sichergestellt ist. Dürfte aber heute nicht mehr klappen, dafür im (über)nächsten Update.
Danke für den Hinweis, hätte mir auch selbst auffallen können/müssen.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 18:49
by Joe User
Update ist online.
Erzeugung der DH-Params war ausserhalb des Certification-HowTo ohnehin überflüssig, daher entsorgt.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 18:50
by Proteus
Das sind Oktacore AMD CPU`s ich mache eben noch mal einen durch lauf. Ins Bios komme ich leider nicht, weil Passwortgeschützt, hier verstehe ich aber Webtropia, der Grund viele haben durch falsche Bios Einstellungen ihr System versemmelt. Aber hier muss ich ja nicht in Bios, weilAMD CPU`s :)
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:04
by Proteus
Es funktionieren nicht:
Code: Select all
-e 's|^#\(ChrootDirectory\).*$|\1 %h|' \
und
Code: Select all
Subsystem sftp internal-sftp -u 0027
Fehlermeldung:
fatal: bad ownership or modes for chroot direktory "/home/admin
/etc/ssh/sshd_config line 167: Directive 'Subsystem' is not allowed within a Match block
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:13
by Joe User
Poste bitte mal die Ausgabe von
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:14
by Joe User
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:21
by Proteus
Code: Select all
tail -n 40 /etc/ssh/sshd_config
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
AllowGroups wheel admin sftponly users
Match Group admin
PasswordAuthentication yes
ChrootDirectory none
Match Group sftponly
ForceCommand internal-sftp
Match User root
ChrootDirectory none
AllowGroups wheel admin sftponly users
Match Group admin
PasswordAuthentication yes
ChrootDirectory none
Match Group sftponly
ForceCommand internal-sftp
Match User root
ChrootDirectory none
Subsystem sftp internal-sftp -u 0027
AllowGroups wheel admin sftponly users
Match Group admin
PasswordAuthentication yes
ChrootDirectory none
Match Group sftponly
ForceCommand internal-sftp
Match User root
ChrootDirectory none
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:27
by Proteus
Joe User wrote:Und einmal ausführen:
Habe ich gemacht.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:29
by Proteus
Code: Select all
[root@a1404:~] # chmod 0755 /usr/home/admin
[root@a1404:~] # service sshd restart
Performing sanity check on sshd configuration.
/etc/ssh/sshd_config line 182: Directive 'Subsystem' is not allowed within a Match block
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:30
by Joe User
Da hast Du versehentlich mehrfach das cat ausgeführt ;)
Um sicher zu gehen, dass da nicht mehr falsch gelaufen ist, hier eine vollständige /etc/ssh/sshd_config mit allen notwendigen Anpassungen aus dem HowTo (bitte Deine komplett mit dieser ersetzen):
Code: Select all
# $OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Exp $
# $FreeBSD: releng/10.1/crypto/openssh/sshd_config 264692 2014-04-20 12:46:18Z des $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
# Note that some of FreeBSD's defaults differ from OpenBSD's, and
# FreeBSD has a few additional options.
Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# The default requires explicit activation of protocol 1
Protocol 2
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024
# Ciphers and keying
RekeyLimit 500M 1h
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr,aes256-cbc
Macs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,diffie-hellman-group-exchange-sha1
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
LoginGraceTime 1m
PermitRootLogin yes
StrictModes yes
MaxAuthTries 3
MaxSessions 10
RSAAuthentication no
PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# Change to yes to enable built-in password authentication.
PasswordAuthentication no
PermitEmptyPasswords no
# Change to no to disable PAM authentication
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'no' to disable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM no
AllowAgentForwarding no
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
UseLogin no
UsePrivilegeSeparation sandbox
PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
UseDNS yes
#PidFile /var/run/sshd.pid
MaxStartups 10:30:100
PermitTunnel no
ChrootDirectory %h
#VersionAddendum FreeBSD-20140420
# no default banner path
#Banner none
# override default of no subsystems
#Subsystem sftp /usr/libexec/sftp-server
# Disable HPN tuning improvements.
#HPNDisabled no
# Buffer size for HPN to non-HPN connections.
#HPNBufferSize 2048
# TCP receive socket buffer polling for HPN. Disable on non autotuning kernels.
#TcpRcvBufPoll yes
# Allow the use of the NONE cipher.
#NoneEnabled no
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
Subsystem sftp internal-sftp -u 0027
AllowGroups wheel admin sftponly users
Match Group admin
PasswordAuthentication yes
ChrootDirectory none
Match Group sftponly
ForceCommand internal-sftp
Match User root
ChrootDirectory none
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:39
by Proteus
Oh man das habe ich gar nicht gesehen!! Ich dämlack! Die war total verwurstet, sorry für die Mühe!
Jetzt gehts
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:41
by Joe User
Kein Problem, passiert mir auch gelegentlich ;)
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:42
by Proteus
Ich habe es mir nicht nehmen lassen noch mal was zu spenden!! ;) Is nicht viel aber für ein paar Bier und ne heiße Wurst wird`s reichen. *g*
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:45
by Joe User
Vielen Dank, fliesst direkt in die Doppelmiete für den gerade durchgeführten Serverwechsel.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:52
by Proteus
Achso? Kann es daher zu den 30 Sekündigen Aussetzern kommen? In dieser Zeit ist der Server so gar nicht erreichbar.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 19:56
by Joe User
Oh, eigentlich nicht, zumal bei mir noch keine Aussetzer auftraten und leider auch noch niemand welche gemeldet hat :(
Kannst Du mal die Uhrzeit notieren und mir per PN mitteilen, wenn es wieder hakt? Danke vorab.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 20:00
by Proteus
Ok mache ich.
Re: OpenSSL konfigurieren RootWiki
Posted: 2015-02-14 20:01
by Proteus
Jetzt eben hing er beim Post abschicken. 30 Sekunden frosty!