Page 1 sur 1

[SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 10:50
par kutsuru
Bonjour,

Je viens à vous car je ne sais plus quoi faire afin de régler ce problème, récemment j'ai installé un serveur local sous Arch, l'installation se déroula sans aucun problème. Le problème survint lorsque je tentai de me connecter via ssh de mon laptop au serveur.

Code : Tout sélectionner

kutsuru@NHK:~$ssh 192.168.0.12
Et la ce fut le drame, je ne voyais aucune demande de pass apparaitre.

Avec l'option -vvv, on obtient:

Code : Tout sélectionner

OpenSSH_5.3p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to valhalla [192.168.0.12] port 22.
debug1: Connection established.
debug1: identity file /home/kutsuru/.ssh/identity type 0
debug3: Not a RSA1 key file /home/kutsuru/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/kutsuru/.ssh/id_rsa type 1
debug3: Not a RSA1 key file /home/kutsuru/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/kutsuru/.ssh/id_dsa type 2
Je suis passé sur le chan à la recherche d'aide, on m'a alors conseillé de changer les clés rsa et dsa, chose faite mais sans le moindre succès. Déjà, la première chose que je ne comprends pas, pourquoi va t-il bloquer sur les clés ? ne devrait-il pas sauter cette étape et me demander mon pass ?

hosts.deny,

Code : Tout sélectionner

ALL: ALL: DENY
hosts.allow,

Code : Tout sélectionner

sshd: ALL: ALLOW
sshd_config,

Code : Tout sélectionner

#       $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $

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

#Port 22
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require 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

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

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

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#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

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

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

# GSSAPI options
#GSSAPIAuthentication no
#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 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 yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem       sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       ForceCommand cvs server
L'erreur ne semble intervenir que lors d'une connection locale, ce que je trouve d'autant plus étrange, mais bon après je ne suis que novice dans le monde d'Unix donc peut etre que l'erreur vous sautera aux yeux.

N'hésitez pas à poster la moindre idée qui vous passe par la tête (en relation avec ce problème de préférence ^^), merci d'avance,

Kutsuru

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 11:04
par benjarobin
Je pense que tu as des erreurs dans ton .ssh de ton home, déplace/renomme le déjà

Sinon pour info ma config (un peu par défaut pas trop sécurisé... mais bon le port est fermé pour l'instant)

Code : Tout sélectionner

#	$OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $

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

Port 22
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require 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

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

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

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

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

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

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

# GSSAPI options
#GSSAPIAuthentication no
#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 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 yes

AllowUsers benjarobin
AllowGroups benjarobin

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
MaxStartups 3
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem	sftp	/usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	ForceCommand cvs server

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 11:12
par kutsuru
En enlevant le .ssh sur le laptop et sur le serveur, la sortie du ssh -vvv varie,

Code : Tout sélectionner

OpenSSH_5.3p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to valhalla [192.168.0.12] port 22.
debug1: Connection established.
debug1: identity file /home/kutsuru/.ssh/identity type -1
debug1: identity file /home/kutsuru/.ssh/id_rsa type -1
debug1: identity file /home/kutsuru/.ssh/id_dsa type -1
Sinon les deux sshd_config semblent être équivalent (excepté les AllowUsers et AllowGroups), non ? car les valeurs commentées sont les valeurs par défaut.

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 11:41
par benjarobin
Que donne une connexion sur toi même (ssh 127.0.0.1) sur le serveur si c'est possible (je ne sais pas si tu y a accès)

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 11:44
par Vinvin
Essaie en précisant le nom du compte ssh sur lequel tu veux te connecter :
ssh root@192.168.0.12
ou
ssh kutsuru@192.168.0.12
ou
ssh Jean-Bernard-de-la-Martinière@192.168.0.12

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 11:46
par kutsuru
Oui j'ai un accès physique au serveur, le ssh localhost fonctionne parfaitement.

@Vinvin, le résultat reste le même (chose pas trop étonnante étant donné que le user est le même sur le laptop et sur le serveur)

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 11:55
par Vinvin
Jusqu'à présent, tu as étudié les logs de connexion sur le client SSH.
Regarde les logs de connexion sur le serveur : que disent les logs lors d'une tentative de connexion ?

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 11:56
par benjarobin
Ton deuxième poste me gène un peu, cela coupe comme cela.. La commande se termine... Ou cela "freeze" et tu termine avec ctrl+c

Tu pourrai installer un serveur ssh sur le client et tenter de te connecter a toi même... Car la je sèche.

Tu peux essayer de te connecter depuis le serveur sur toi même avec la commande: ssh 192.168.0.12 (192.168.0.12 ip du serveur si j'ai bien compris)

Ce qui me gène c'est le "Connection established." donc apparemment pas de problème de parfeu

Sinon bonne idée Vinvin, mais tail -f /var/log/auth.log ne donne rien (en effet il ne log qu'une fois connecté...)

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 12:10
par kutsuru
Cela freeze,

Depuis le serveur un ssh 192.168.0.12 (ip du serveur) fonctionne

Concernant le auth.log,

Code : Tout sélectionner

Dec 31 12:07:29 Valhalla sshd[30760]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211.144.35.172 
Dec 31 12:07:31 Valhalla sshd[30760]: Failed password for invalid user internet from 211.144.35.172 port 58912 ssh2
Dec 31 12:07:34 Valhalla sshd[30763]: Invalid user postmaster from 211.144.35.172
Dec 31 12:07:34 Valhalla sshd[30763]: pam_unix(sshd:auth): check pass; user unknown
Dec 31 12:07:34 Valhalla sshd[30763]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211.144.35.172 
Dec 31 12:07:36 Valhalla sshd[30763]: Failed password for invalid user postmaster from 211.144.35.172 port 59083 ssh2
Dec 31 12:07:39 Valhalla sshd[30766]: Invalid user squid from 211.144.35.172
Dec 31 12:07:39 Valhalla sshd[30766]: pam_unix(sshd:auth): check pass; user unknown
Dec 31 12:07:39 Valhalla sshd[30766]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211.144.35.172 
Dec 31 12:07:41 Valhalla sshd[30766]: Failed password for invalid user squid from 211.144.35.172 port 59304 ssh2
Dec 31 12:07:43 Valhalla sshd[30769]: Invalid user ldap from 211.144.35.172
Dec 31 12:07:43 Valhalla sshd[30769]: pam_unix(sshd:auth): check pass; user unknown
Dec 31 12:07:43 Valhalla sshd[30769]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211.144.35.172 
Dec 31 12:07:45 Valhalla sshd[30769]: Failed password for invalid user ldap from 211.144.35.172 port 59508 ssh2
Dec 31 12:07:48 Valhalla sshd[30773]: Invalid user marcus from 211.144.35.172
Dec 31 12:07:48 Valhalla sshd[30773]: pam_unix(sshd:auth): check pass; user unknown
Dec 31 12:07:48 Valhalla sshd[30773]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211.144.35.172 
Dec 31 12:07:50 Valhalla sshd[30773]: Failed password for invalid user marcus from 211.144.35.172 port 59689 ssh2
Dec 31 12:07:52 Valhalla sshd[30778]: Invalid user newsletter from 211.144.35.172
Dec 31 12:07:52 Valhalla sshd[30778]: pam_unix(sshd:auth): check pass; user unknown
Dec 31 12:07:52 Valhalla sshd[30778]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211.144.35.172 
Dec 31 12:07:53 Valhalla sshd[30776]: Did not receive identification string from 192.168.0.10
Dec 31 12:07:54 Valhalla sshd[30778]: Failed password for invalid user newsletter from 211.144.35.172 port 59885 ssh2
Il semblerait que quelqu'un d'autre que moi tente d'y acceder, non ?

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 12:28
par Vinvin
L'adresse IP 211.144.35.172 est un site asiatique de vente de sous-vêtements ! :mrgreen:
Effectivement, il semble que quelqu'un essaie de se connecter à ton serveur en essayent différents identifiants (internet, postmaster, squid, ldap, marcus, newsletter, ...).

Fait un essai en supprimant le .ssh sur le laptop, mais en le conservant sur le serveur.

Re: [SSH]Impossibilité de se connecter à mon serveur local

Publié : jeu. 31 déc. 2009, 12:35
par kutsuru
L'adresse IP 211.144.35.172 est un site asiatique de vente de sous-vêtements ! :mrgreen:
Il veut surement acceder à ma bdd de "pantsu" ^^

Sinon le résultat reste le même, (il n'y a que le knows_hosts dans le .ssh du serveur, du moins pour l'instant)

Edit: J'ai modifié le hosts.allow en

Code : Tout sélectionner

sshd: 192.168.0.: ALLOW
et avec le tail -f /var/log/auth.log j'obtiens

Code : Tout sélectionner

sshd[32090]: Server listening on 0.0.0.0 port 22
sshd[32093]: Did not receive identification string from 192.168.0.10