1 votos

ssh: permisos en archivos /etc

Creo que he roto los permisos para (al menos) los archivos en /etc, y es por eso que ssh ya no funciona. hosts.allow:

sshd : ALL
ALL : ALL

hosts.deny:

sshd: ALL

anfitriones:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost

salida de ssh localhost:

kex_exchange_identification: read: Connection reset by peer
Connection reset by ::1 port 22

salida de ls -ld /etc /etc/ssh* /etc/ssh*/*:

lrwxr-xr-x@  1 root  wheel      11  1   2020 /etc -> private/etc
drwxrwxr-x  13 root  wheel     416  2  23:26 /etc/ssh
-rwxrwxr-x   1 root  wheel  577388  1   2020 /etc/ssh/moduli
-rwxrwxr-x   1 root  wheel    1511  1   2020 /etc/ssh/ssh_config
-rwxrwxr-x   1 root  wheel    1405 22  18:22 /etc/ssh/ssh_host_dsa_key
-rwxrwxr-x   1 root  wheel     620 22  18:22 /etc/ssh/ssh_host_dsa_key.pub
-rwxrwxr-x   1 root  wheel     525 22  18:23 /etc/ssh/ssh_host_ecdsa_key
-rwxrwxr-x   1 root  wheel     192 22  18:23 /etc/ssh/ssh_host_ecdsa_key.pub
-rwxrwxr-x   1 root  wheel     387  2  23:26 /etc/ssh/ssh_host_ed25519_key
-rwxrwxr-x   1 root  wheel      82  2  23:26 /etc/ssh/ssh_host_ed25519_key.pub
-rwxrwxr-x   1 root  wheel    2622 22  18:22 /etc/ssh/ssh_host_rsa_key
-rwxrwxr-x   1 root  wheel     584 22  18:22 /etc/ssh/ssh_host_rsa_key.pub
-rwxrwxr-x   1 root  wheel    3169  1   2020 /etc/ssh/sshd_config

sudo /usr/sbin/sshd -dD:

debug1: sshd version OpenSSH_8.6, LibreSSL 2.8.3
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0775 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
debug1: Unable to load host key "/etc/ssh/ssh_host_rsa_key": bad permissions
debug1: Unable to load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0775 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
debug1: Unable to load host key "/etc/ssh/ssh_host_ecdsa_key": bad permissions
debug1: Unable to load host key: /etc/ssh/ssh_host_ecdsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0775 for '/etc/ssh/ssh_host_ed25519_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
debug1: Unable to load host key "/etc/ssh/ssh_host_ed25519_key": bad permissions
debug1: Unable to load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.

sudo ssh ::1 -vvv:

OpenSSH_8.6p1, LibreSSL 2.8.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug2: resolve_canonicalize: hostname ::1 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/sava/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/sava/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug3: ssh_connect_direct: entering
debug1: Connecting to ::1 [::1] port 22.
debug3: set_sock_tos: set socket 3 IPV6_TCLASS 0x48
debug1: Connection established.
debug1: identity file /Users/sava/.ssh/id_rsa type 0
debug1: identity file /Users/sava/.ssh/id_rsa-cert type -1
debug1: identity file /Users/sava/.ssh/id_dsa type -1
debug1: identity file /Users/sava/.ssh/id_dsa-cert type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/sava/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/sava/.ssh/id_ed25519 type -1
debug1: identity file /Users/sava/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/sava/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/sava/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/sava/.ssh/id_xmss type -1
debug1: identity file /Users/sava/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
kex_exchange_identification: read: Connection reset by peer
Connection reset by ::1 port 22

¿Cómo puedo arreglar esto? ¡Realmente necesito su ayuda! Estoy desesperada :(

2voto

unbeatable101 Puntos 90

sshd se niega a utilizar sus claves de host debido a que los permisos son demasiado abiertos, aquí están los comandos para ejecutar por lo que los archivos ssh debe ser establecido:

sudo chmod 755 /etc/ssh
sudo chmod 644 /etc/ssh/moduli
sudo chmod 644 /etc/ssh/ssh_config
sudo chmod 755 /etc/ssh/ssh_config.d
sudo chmod 600 /etc/ssh/ssh_host*
sudo chmod 644 /etc/ssh/ssh_host*.pub
sudo chmod 644 /etc/ssh/sshd_config
sudo chmod 755 /etc/ssh/sshd_config.d

0voto

Algunas cosas parecen estar fuera de lugar con seguridad:

$ ls -ld /etc /etc/ssh* /etc/ssh*/*
lrwxr-xr-x@  1 root  wheel      11 Oct 18 05:30 /etc@ -> private/etc
drwxr-xr-x  19 root  wheel     608 Oct 25 23:38 /etc/ssh/
-rw-r--r--   1 root  wheel  570321 Oct 18 05:30 /etc/ssh/moduli
-rw-r--r--   1 root  wheel    1963 Oct 18 05:30 /etc/ssh/ssh_config
drwxr-xr-x   2 root  wheel      64 Oct 18 05:30 /etc/ssh/ssh_config.d/
-rw-r--r--   1 root  wheel    1624 Jun 27  2015 /etc/ssh/ssh_config~orig
-rw-------   1 root  wheel     672 Oct 23  2013 /etc/ssh/ssh_host_dsa_key
-rw-r--r--   1 root  wheel     590 Oct 23  2013 /etc/ssh/ssh_host_dsa_key.pub
-rw-------   1 root  wheel     227 Jul 21  2015 /etc/ssh/ssh_host_ecdsa_key
-rw-r--r--   1 root  wheel     162 Jul 21  2015 /etc/ssh/ssh_host_ecdsa_key.pub
-rw-------   1 root  wheel     387 Jul 21  2015 /etc/ssh/ssh_host_ed25519_key
-rw-r--r--   1 root  wheel      82 Jul 21  2015 /etc/ssh/ssh_host_ed25519_key.pub
-rw-------   1 root  wheel     965 Oct 23  2013 /etc/ssh/ssh_host_key
-rw-r--r--   1 root  wheel     630 Oct 23  2013 /etc/ssh/ssh_host_key.pub
-rw-------   1 root  wheel    1675 Oct 23  2013 /etc/ssh/ssh_host_rsa_key
-rw-r--r--   1 root  wheel     382 Oct 23  2013 /etc/ssh/ssh_host_rsa_key.pub
-rw-r--r--   1 root  wheel    3523 Oct 18 05:30 /etc/ssh/sshd_config
drwxr-xr-x   4 root  wheel     128 Oct 30 10:38 /etc/ssh/sshd_config.d/
-rw-r--r--   1 root  wheel    4161 Mar 21  2015 /etc/ssh/sshd_config~previous

AppleAyuda.com

AppleAyuda es una comunidad de usuarios de los productos de Apple en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X