Foros del Web » Administración de Sistemas » Seguridad y redes »

Server unexpectedly closed network connection

Estas en el tema de Server unexpectedly closed network connection en el foro de Seguridad y redes en Foros del Web. Instale Cygwin en un Windows 2003 Server pero al intentar conectarme desde otros equipos usando putty y filezila me sale el siguiente error en forma ...
  #1 (permalink)  
Antiguo 09/06/2011, 10:27
 
Fecha de Ingreso: abril-2010
Ubicación: México D.F.
Mensajes: 54
Antigüedad: 14 años
Puntos: 0
De acuerdo

Instale Cygwin en un Windows 2003 Server pero al intentar conectarme desde otros equipos usando putty y filezila me sale el siguiente error en forma aleatoria: "Server unexpectedly closed network connection"

A veces pasa que desde un cliente inicio sesión en putty y sin cerrar sesión abro filezila para transferir archivos por sftp pero manda el mensaje, no se que pasa.

- Contenido del archivo hosts.denty este la ip y por eso me bloquea, este es el contenido que tiene

#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
ALL:ALL EXCEPT localhost:DENY

- Contenido de hosts.allow

#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# CYGWIN note: if you use a software firewall (such
# as ZoneAlarm or the "Windows Firewall" in Windows
# XP), you must also open a 'hole' at the proper
# port for the services you enable below.
#
ALL : localhost 127.0.0.1/32 [::1]/128 [::ffff:127.0.0.1]/128 : allow
ALL : PARANOID : deny
sshd: ALL : allow

¿Qué significa es?
Espero alguien haya pasado por esto y me pueda dar solución, ya intente reiniciar el servicio cron y el servicio cygwin pero a veces si me da acceso y a veces no, tmb reiniciar el servidor y pasa lo mismo, a veces si da acceso y a veces no.

¿Qué más puedo verificar o editar?

Este es el contenido del ssh_config ubicado en la carpeta etc

# Host *
# ForwardAgent no
# ForwardX11 no
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com

Este es el contenido del sshd_config ubicado en la carpeta etc

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_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh_host_rsa_key
#HostKey /etc/ssh_host_dsa_key
#HostKey /etc/ssh_host_ecdsa_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 yes
StrictModes no
#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_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 yes

# 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 no

#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/sbin/sftp-server

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

En otros foros encontré que la línea "ALL : PARANOID : deny" del archivo hosts.allow es la que causa este problema...

Porque si el DNS esta roto o algo así, ya no autentificará la IP, no entendí bien los términos, ojalá que alguien pueda explicarnos...

Recomiendan comentar esa línea por default para que no haya ese problema, haré ese cambio y les comento.

Última edición por BrujoNic; 10/06/2011 a las 09:30
  #2 (permalink)  
Antiguo 10/06/2011, 02:50
 
Fecha de Ingreso: febrero-2011
Mensajes: 581
Antigüedad: 13 años, 2 meses
Puntos: 81
Respuesta: Server unexpectedly closed network connection

Puedes usar los ficheros hosts.allow y hosts.deny para todos los accesos a servicios via tcp wrappers (incluido sshd).

La linea que comentas fuerza a que el DNS inverso este bien configurado, de forma que la maquina que intenta acceder se corresponda con su entrada DNS (es decir, u nreverse-lookup me arooje el nombre de la maquina que se esta conectando y se corresponda con un dns-lookup normal).

Generalmente no suele ser necesario configurar los archivos hosts.allow y hosts.deny, salvo que quieras que tan solo una (o varias) maquina concreta acceda via ssh... Aunque personalmente prefiero usar llaves de maquina (pubkey authentication) para securizar ese tipo de accesos.

Si quieres que solo se pueda acceder por SSH (o sftp usando sshd) desde una maquina concreta, podráis configurar tus ficheros hosts.deny y hosts.allow de la siguiente manera:

hosts.deny:
...
sshd: ALL

hosts.allow:
sshd: XXX.XXX.XXX.XXX

(siendo XXX.XXX.XXX.XXX la IP de la maquina a la que quieres permitir el acceso). El archivo hosts.allow se chequea antes que el deny en la cadena, por lo que debes tener cuidado con esto (no permitas algo en el allow que quieres denegar en el deny).

Lo que dicen las lineas de ariba es:
(En el hosts.allow): Permite acceso al sshd desde la IP XXX.XXX.XXX.XXX
(En el hosts.deny) deniega el acceso al sshd a todo el mundo.
(Podrías haber utilizado el modificador "EXECPT LOCAL" en el deny para permitir que el servidor pueda hacer ssh a si mismo por razones de test, por ejemplo... Esto suele hacerse con otros servicios, aunque con el sshd no parece muy util :)).

Otra cosa que debes tener en cuenta es que si en la parte del servicio pones "ALL" (es decir, la parte ANTES del caracter ":" en lugar de un servicio (en nuestro caso sshd), eso afectará a TODOS los servicios... Tenlo en cuenta, no vayas a permitir de mas, por ejemplo.

En realidad, es sencillo... Aunque, como te dije, yo no suelo usar los ficheros allow y deny para controlar el acceso ssh. No me parece seguro, la verdad (cualquier capaz de cambiar su IP se saltará la restricción).

Tú mismo ;)
  #3 (permalink)  
Antiguo 10/06/2011, 09:17
 
Fecha de Ingreso: abril-2010
Ubicación: México D.F.
Mensajes: 54
Antigüedad: 14 años
Puntos: 0
De acuerdo Respuesta: Server unexpectedly closed network connection

Cita:
Iniciado por moeb Ver Mensaje
Puedes usar los ficheros hosts.allow y hosts.deny para todos los accesos a servicios via tcp wrappers (incluido sshd).

La linea que comentas fuerza a que el DNS inverso este bien configurado, de forma que la maquina que intenta acceder se corresponda con su entrada DNS (es decir, u nreverse-lookup me arooje el nombre de la maquina que se esta conectando y se corresponda con un dns-lookup normal).

Tú mismo ;)
moeb, pues ya comenté "#ALL : PARANOID : deny" y hasta el momento ya va de maravilla, me conecto al mismo tiempo utilizando putty y filezilla, la cosa es que como estamos en corporativo, no tenemos permisos para modificar ip o dns y todo eso, entonces tal cual esta nuestro equipo asi debe de conectarse.

Y como tenemos ip dinámica pues bueno, solo haciendo un rango, pero de momento ya esta funcionando, gracias por la asesoria, me ha servido millones para entender más, en esta aventura de configurar el cygwin ya he aprendido muchisimo.
  #4 (permalink)  
Antiguo 13/06/2011, 08:38
 
Fecha de Ingreso: febrero-2011
Mensajes: 581
Antigüedad: 13 años, 2 meses
Puntos: 81
Respuesta: Server unexpectedly closed network connection

Y mas que vas a apreneder... No paras tio.

Mola :)
  #5 (permalink)  
Antiguo 17/06/2011, 09:12
 
Fecha de Ingreso: abril-2010
Ubicación: México D.F.
Mensajes: 54
Antigüedad: 14 años
Puntos: 0
Respuesta: Server unexpectedly closed network connection

Hasta la fecha continua funcionando de maravilla, muchas gracias por la ayuda

Etiquetas: closed, connection, network, server
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:28.