PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Problem bei Verbindung zu SSH-Server



gnoovy
22.11.06, 23:43
hi leutz,


folgendes Problem. Möchte mit rsync und ssh eine sichere Verbindung aufbauen, um spätere Aktionen mittels Linux-HA durchzuführen. Habe erst den Key generiert: Auf Server namends "Server"


ssh-keygen -t rsa -b 2048


Habe alles ohne Passwort generiert, da rsync bei der automatischen Verbindung da anscheinend Probleme hat. Habe den öffentlichen Schlüssel nun auf den Client "Client" kopiert. Danach mittels vi authorized_keys diese Datei erstellt. Mit cat *.pub >> authorized_keys den Inhalt in die keys-Datei kopiert. In der /etc/ssh/sshd_config habe ich auf beiden Maschinen Passwordauthentification auf no gesetzt. Von "Server" auf "Client" kann ich mittels ssh <ip-adresse> ohne Passwort zugreifen. Dauert allerdings ein bisschen. Von "Client" auf "Server" kann ich nicht zugreifen. Es kommt immer die Meldung Permission denied (publickey,gssapi-with-mic). Was kann ich da tun?

ramsys
23.11.06, 09:19
PubkeyAutentication yes am Deamon gesetzt?

gnoovy
23.11.06, 19:59
Hallo Leutz,

ja hatte ich gesetzt, hatte aber keine Wirkung gehabt. Habe auch den Authorised_keys-Eintrag gesetzt gehabt. Fällt Euch noch was ein?

MiGo
23.11.06, 20:09
Authorised_keys-Eintrag
authorized_keys :)
Kleingeschrieben und mit "z".

Ausserdem musst du den Prozess in beide Richtungen machen. Also der pubkey des Servers muss in die authorized_keys des Client, und der pubkey des Clients muss in die authorized_keys des Servers.

marce
23.11.06, 20:12
erster Einfall meinerseits wäre, die sshd.config des Servers zu posten und eine evtl. Firewall auf dem Client und Server zu überprüfen... Logfiles sind auch immer tolle Dinge...

Ansonsten - kannst Du generell nicht von Client auf Server per ssh zugreifen oder nur nicht "ohne PW"?

gnoovy
24.11.06, 22:35
hi leutz,


also habe bei dom1 mit ssh-keygen -t dsa den key ohne passphrase generiert. Dann den id_dsa.pub auf dom2 kopiert und beide Server neu gestartet. Von dom1 auf dom2 wird keine Passwortabfrage mehr durchgeführt, von dom2 zu dom1 allerdings wird noch eine Passwortabfrage durchgeführt. Bei Eingabe des Root-Passwortes komme ich dann auf den Server, warum?

Hier mal die sshd_config beider Rechner

dom1:

# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# 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 change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# 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

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile /root/.ssh/authorized_keys

# 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

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server

********************************+
********************************

dom2:

# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# 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 change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# 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

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# 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

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server


Besten Dank !!!

marce
25.11.06, 00:58
weil Du auch auf dom2 den Key generieren musst und den dort generierten auf dom1 in die authorized_keys eintragen...

gnoovy
25.11.06, 10:41
Hab ich gemacht jetzt ist es genau anders herum. Von dom2 auf dom1 gehts jetzt ohne passwort, von dom1 auf dom2 wird jetzt allerdings komischerweise eines verlangt.

marce
25.11.06, 17:12
... und auf dom2 hast Du nichts verändert?

gnoovy
26.11.06, 01:38
nein hab ich nicht. Ich verstehe das nicht. Habe auf beiden Servern mit ssh-keygen -t dsa einen Schlüssel erzeugt und den Publick-Key der einzelnen Maschinen auf den jeweils anderen kopiert, also in die Datei authorized_keys. Was mache ich da noch falsch, mensch?

bla!zilla
26.11.06, 10:05
Auf Dom2 mal bitte



#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys


auf



#RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys


ändern.

ramsys
26.11.06, 12:43
PubkeyAutentication yes am Deamon gesetzt?

^^

*10zeichen*

bla!zilla
26.11.06, 12:46
Ja scheinbar ja nicht.

ramsys
26.11.06, 12:47
War nicht auf dich bezogen sondern ihn.
Er meinte ja das er es gesetzt hatte.

bla!zilla
26.11.06, 12:50
Weiß ich, deswegen sagte ich ja "Scheinbar nicht". Bezogen auf seine Aussage das es gesetzt wäre, und den Ausdruck der sshd_config. :)

gnoovy
26.11.06, 13:51
also komischerweise gehts immer noch nicht. Kann es vielleicht auch daran liegen, dass ich alles unter Microsoft Visual PC mache? Habe dom1 ganz normal installiert, dom2 sozusagen lediglich die virutal-pc-dateien kopiert und halt dann die ip-adresse und den namen angepasst. Kann es deshalb noch differenzen geben?

bla!zilla
26.11.06, 14:01
Nein, kann nicht daran liegen das du Virtual PC verwendest. Lass doch mal einen diff über die sshd_config der beiden Maschinen laufen. Dann siehst du die Unterschiede.

gnoovy
26.11.06, 18:09
keine ahnung was ich jetzt anders gemacht habe, aber jetzt gehts. Vielen Dank nochmals an alle, die mir geholfen haben. Such a nice weekend

bla!zilla
26.11.06, 18:15
Was war's? Wie hast du das Problem gelöst?

marce
26.11.06, 18:24
keine ahnung was ich jetzt anders gemacht habe, aber jetzt gehts.
ich fürchte, es wird uns auf ewig verborgen bleiben...

gnoovy
26.11.06, 18:25
eigentlich nur nochmals das, was ihr mir geraten habt. Auf jedem Server mittels ssh-keygen -t dsa einen private und einen public key erzeugt und den public-key eines servers auf den jeweils anderen kopiert. danach die server neu gestartet und zack hats funktioniert.

marce
26.11.06, 18:40
... eigentlich sollte es auch ohne Serverneustart funktionieren.

Vermutung: Du hast wohl vorher schon mal was an der Konfig geändert, welches es wohl eigentlich zum laufen hätte bringen müssen, aber da den Server nicht neu gestartet... :-)