[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
es:howtos:security:ssh [2019/03/18 02:20 (UTC)] – [Modifying the sshd_config file] antares_alfes:howtos:security:ssh [2019/03/24 20:37 (UTC)] (actual) – [Sources] antares_alf
Línea 33: Línea 33:
 Ahora, edite el archivo ''/etc/ssh/sshd_config'' con su editor favorito y ajusta las siguientes lineas: Ahora, edite el archivo ''/etc/ssh/sshd_config'' con su editor favorito y ajusta las siguientes lineas:
  
-===== Change the SSH default port =====+===== Cambiar el puerto predeterminado de SSH ===== 
 +Por defecto, OpenSSH escucha en el puerto ''22''. A veces se recomienda cambiar este puerto predeterminado a algo diferente, como ''2222'' o ''4242''. Esto no es una mala idea, pero debe recordar que al escanear su máquina con un programa como ''nmap'' obtendrá este nuevo puerto muy rápidamente.Por lo tanto, si bien puede ralentizar algunos ataques en su máquina, no los evitará por completo.
  
-By defaultOpenSSH listens on port 22. It is sometimes advised to change this default port to something different, such as ''2222'' or ''4242''. This is not a bad idea, but you have to remember that scanning your machine with a program such as ''nmap'' will obtain this new port very quickly. Sowhile it may slow down some attacks on your machineit will not prevent them entirely.+Si desea cambiar el puertobusque la opción ''Port'' en ''sshd_config'', que generalmente está en la parte superior del archivoy cambie el valor.
  
-If you'd like to change the port, search for the ''Port'' option in ''sshd_config'', which is usually at the top of file, and change the value. +Por ejemplo:
- +
-For instance:+
  
 ''Port 22'' ''Port 22''
  
-Can be changed to:+Puede cambiarse por:
  
 ''Port 4242'' ''Port 4242''
 +===== Método alternativo para cambiar el puerto predeterminado de SSH sin cambiarlo =====
  
 +Esta sugerencia es completamente sacada de otro sitio. [[http://null.redcodenetwork.ro/changing-the-ssh-port-without-changing-it/|redcodenetwork.ro]]
 +La idea aquí es agregar una llamada a este script en ''rc.local'' para que se ejecute al inicio.\\ Para usar el ejemplo de descarga en la parte inferior, cámbielo a su gusto y guárdelo en ''/etc/rc.d/'' (haga que sea ejecutable)\\ Agregue este ejemplo a continuación a ''/etc/rc.d/rc.local''.
 +<code>
 +if [ -x /etc/rc.d/rc.ssh_hide ]; then
 + /etc/rc.d/rc.ssh_hide
 +fi
 +</code>
  
-===== Alternate method of Changing the SSH default port without changing  ===== + Lo que está haciendo es hacer que parezca que ha cambiado el puerto que está usando ssh y proporcionar cierta seguridad adicional
- +Lo que sucede es que los escáneres continuarán viendo el puerto 22 abierto e intentarán ir allí mientras su servidor deja caer esos paquetesporque el encabezado no está dañadoLos paquetes reales vienen en el puerto 8889 y son redirigidos por iptables al puerto 22 con mangle en el encabezado para que no se caigan.
-This suggestion is completely lifted from another site [[http://null.redcodenetwork.ro/changing-the-ssh-port-without-changing-it/]] +
- The idea here is add a call to this script in rc.local so it will run at start up+
- +
-To use Download sample at the bottom change as you like and save it in /etc/rc.d/  (make it executable to use) +
-Add this sample below to /etc/rc.d/rc.local +
- +
-#add ssh_hide to port 8889 +
-  if [ -x /etc/rc.d/rc.ssh_hide ]; then +
-    /etc/rc.d/rc.ssh_hide +
-  fi +
-   +
- What it is doing is making it look like you changed the port ssh is using and provide some additional security. +
-What happens is scanners will continue to see port 22 open and try to go there while your server drops those packetsbecause the header is not mangled Real packets come in on port 8889 and are redirected by iptables to port 22 with mangle in the header so they don't get dropped.+
  
 <file bash rc.ssh_hide> <file bash rc.ssh_hide>
Línea 96: Línea 90:
 </file> </file>
  
-Note not ipv6 compatible, due to nat (ip6tables not supporting nat)+Tenga en cuenta que no es compatible con ipv6debido a nat (ip6tables no son compatibles con nat)
  
 +===== Prohibir el acceso root a su máquina =====
  
-===== Forbid root access to your machine ===== +Este es probablemente el cambio más importante que puede hacer para mejorar la seguridad de su máquinaprohibir que el usuario ''root'' acceda a su máquinaPara hacer estobusque la siguiente línea en ''sshd_config'':
- +
- +
-This is probably the single most important change you can do to improve the security of your machineforbid the ''root'' user to access your machineTo do thislook for the following line in ''sshd_config'':+
  
 ''PermitRootLogin yes'' ''PermitRootLogin yes''
  
-And change it to:+Y cambiarlo a:
  
 ''PermitRootLogin no'' ''PermitRootLogin no''
  
-If you apply the changes abovemake sure you have at least one user on your machine that can ''su'' (switch user) to ''root'' or use ''sudo'' for more fine-grained system administration permissionsThe best way to administrate server through SSH is to have a user in the ''wheel'' groupwho can use both ''sudo'' and ''su'' to become ''root'' when need be.+Si aplica los cambios anterioresasegúrese de tener al menos un usuario en su máquina que pueda  (cambiar de usuario) ''su'' ''root'' use ''sudo'' para permisos de administración del sistema más específicos La mejor manera de administrar un servidor través de SSH es tener un usuario en el grupo ''wheel'', que puede usar ''sudo'' ''su'' para convertirse en ''root'' cuando sea necesario.
  
-Since most people who try to get into your machine uninvited use brute-force scripts that target the ''root'' loginyou can already rest a lot easierknowing this access is locked.+Ya que la mayoría de las personas que intentan ingresar a su máquina sin ser invitadas usan scripts de fuerza bruta que apuntan al inicio de sesión 'raíz', ya puede descansar mucho más fácilmentesabiendo que este acceso está bloqueado.
  
-===== Improve login security and timing =====+===== Mejorar la seguridad de inicio de sesión y el tiempo =====
  
 +Arriba y debajo de la opción ''PermitRootLogin'', encontrará otros permisos, que detallaremos rápidamente aquí:
  
-Above and below the ''PermitRootLogin'' option, you will find other permissions, that we are going to detail quickly here: +- ''LoginGraceTime''se utiliza para aumentaro disminuirel tiempo que le queda un usuario para iniciar sesión en la máquinaEsto se puede restringir de forma segura a minutoscon lo siguiente:
- +
-- ''LoginGraceTime'' is used to increaseor decreasethe time left to user to log into the machineThis can be safely be restricted to minuteswith the following:+
  
 ''LoginGraceTime 5m'' ''LoginGraceTime 5m''
  
-- ''MaxAuthTries'' is used to increseor decreasethe number of tries allowed to user to authentify correctly to the machineThis can be restricted to attempts by using:+- ''MaxAuthTries'' se utiliza para aumentaro disminuirel número de intentos permitidos un usuario para autenticar correctamente en la máquinaEsto se puede restringir a intentos usando:
  
 ''MaxAuthTries 3'' ''MaxAuthTries 3''
  
-===== Deny X11 forwarding =====+===== Denegar reenvío X11 =====
  
- +A menos que necesite usar X11 sobre SSH, puede desactivarlo de manera segura usando la siguiente opción:
-Unless you need to use X11 over SSH, you can safely disable it by using the following option:+
  
 ''X11Forwarding no'' ''X11Forwarding no''
  
-Please note that disabling X11 does not disable VNC over SSH, for instanceIn most casesit is always a good idea to disable un-needed services.+Tenga en cuenta que deshabilitar X11 no deshabilita VNC a través de SSH, por ejemploEn la mayoría de los casossiempre es una buena idea deshabilitar los servicios innecesarios.
  
-===== Restrict SSH login to approved users =====+===== Restringir el inicio de sesión SSH a usuarios aprobados =====
  
- +Si está seguro de que solo usuarios específicos necesitan conectarse a través de SSH a su máquinapuede declararlos usando la opción ''Permitir usuarios''Todos los usuarios, y solo los usuarios, mencionados después de la opción podrán conectarse a través de SSH a la máquina.
-If you are sure only specific users need to connect through SSH to your machineyou can declare them using the ''AllowUsers'' optionAll the users - and only the users - mentioned after the option will be able to connect through SSH to the machine.+
  
 ''AllowUsers jack backup betty'' ''AllowUsers jack backup betty''
  
-In the example shown aboveonly user ''jack'', ''betty'' and ''backup'' will be able to use SSH to connect to the machineAll other users will be denied accessOf courseyou should use this option with caution and make sure the (or "a"default user is included...+En el ejemplo que se muestra arribasolo el usuario ''jack'', ''betty'' ''backup'' podrá usar SSH para conectarse a la máquinaA todos los demás usuarios se les negará el accesoPor supuestodebe usar esta opción con precaución y asegurarse de que el usuario predeterminado ("a"esté incluido ...
  
-===== Restart the SSH server ===== 
  
 +===== Reinicie el servidor SSH =====
  
-The last thing to doto make sure the SSH server takes the new configuration into accountis to restart the SSH server with the command:+Lo último que debe hacerpara asegurarse de que el servidor SSH tenga en cuenta la nueva configuraciónes reiniciar el servidor SSH con el comando:
  
 ''# /etc/rc.d/rc.sshd restart'' ''# /etc/rc.d/rc.sshd restart''
  
-Your new, and slightly more secure OpenSSH configuration is now in effectCongratulations! +Su nueva y más segura configuración de OpenSSH será efectiva ahora¡Felicidades
- +===== Ver también =====
-===== See Also =====+
  
  
-  * [[http://openssh.org/manual.html|OpenSSH manual pages (on-line)]]+  * [[http://openssh.org/manual.html|Páginas de manual de OpenSSH (en línea)]]
  
 ====== Sources ====== ====== Sources ======
Línea 163: Línea 151:
 <!-- * Original source: [[http://some.website.org/some/page.html]] --> <!-- * Original source: [[http://some.website.org/some/page.html]] -->
 <!-- Authors are allowed to give credit to themselves! --> <!-- Authors are allowed to give credit to themselves! -->
-  * Originally written by [[wiki:user:noryungi | User Noryungi]]+  * Escrito originalmente por [[wiki:user:noryungi | User Noryungi]] 
 +  * Traducido al español por  --- //[[wiki:user:antares_alf|Antares_alf]] 2019/03/24 20:32 (UTC)//
 <!-- * Contrbutions by [[wiki:user:yyy | User Y]] --> <!-- * Contrbutions by [[wiki:user:yyy | User Y]] -->
  
 es:howtos:security:ssh ()