Próxima revisión | Revisión previaPróxima revisiónAmbos lados, revisión siguiente |
es:howtos:security:ssh [2019/02/11 01:44 (UTC)] – creado slackwarespanol | es:howtos:security:ssh [2019/03/24 16:12 (UTC)] – [Alternate method of Changing the SSH default port without changing] antares_alf |
---|
<!-- Add your text below. Start with a Headline (see button bar above). --> | <!-- Add your text below. Start with a Headline (see button bar above). --> |
====== Improving OpenSSH security ====== | ====== Mejorando la seguridad de OpenSSH ====== |
| |
[[http://www.openssh.org|OpenSSH]] is the swiss-army knife of remote-access programs: it provides you with a shell on your distant machine, and transmits data in a secure and encrypted way - including commands, file transfer, X11 and VNC sessions, rsync data, etc. | [[http://www.openssh.org|OpenSSH]] es la navaja suiza de los programas de acceso remoto: le proporciona un shell en su máquina distante,y transmite datos de forma segura y encriptada - incluyendo comandos, transferencia de archivos, sesiones X11 y VNC, datos rsync, etc. |
| |
[[http://www.openssh.org|OpenSSH]] is so advanced that it can be considered as a simplified VPN (Virtual Private Network). | [[http://www.openssh.org|OpenSSH]]es tan avanzado que puede considerarse como una VPN simplificada (red privada virtual). |
| |
Slackware contains [[http://www.openssh.org|OpenSSH]] of course, and the default configuration is already pretty secure. This page has been created to show you a few simple configuration tweaks that can be applied to the default configuration to improve its security. | Slackware contiene [[http://www.openssh.org|OpenSSH]]por supuesto, y la configuración por defecto ya es bastante segura.Esta página se ha creado para mostrarle algunos ajustes de configuración simples que se pueden aplicar a la configuración predeterminada para mejorar su seguridad. |
| |
You will need to know how to use a text editor to be able to follow this HOWTO. If you are a complete beginner, try ''nano''. Once you are more advanced, and more at ease with Linux, feel free to use something more powerful... | Necesitará saber cómo usar un editor de texto para poder seguir este HOWTO. Si eres un principiante completo, prueba ''nano''.Una vez que esté más avanzado y más cómodo con Linux, siéntase libre de usar algo más poderoso ... |
| |
===== The SSH configuration files and finding more information ===== | ===== Los archivos de configuración de SSH y encontrar más información ===== |
| |
The [[http://www.openssh.org|OpenSSH]] configuration files reside in the directory ''/etc/ssh/''. The most important one is the ''/etc/ssh/sshd_config'' that we are going to modify here. | Los archivos de configuración de [[http://www.openssh.org|OpenSSH]] residen en el directorio''/etc/ssh/''. El más importante es el ''/etc/ssh/sshd_config'' que vamos a modificar aquí. |
| |
The [[http://www.openssh.org|OpenSSH]] documentation is very good, so feel free to enter the command: ''apropos openssh'' or ''man -k openssh'' and read the different man pages, which are much more detailed than this wiki page. | La documentación de [[http://www.openssh.org|OpenSSH]] es muy buena, así que siéntase libre de ingresar el comando: ''apropos openssh'' or ''man -k openssh'' y lea las diferentes páginas man, que son mucho más detalladas que esta página wiki. |
| ===== Modificando el archivo sshd_config ===== |
| |
===== Modifying the sshd_config file ===== | La primera regla, antes de modificar un archivo de configuración importante es hacer una copia de respaldo. Por ejemplo: |
| |
| <code> |
| # cp -v /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG.20120826 |
| </code> |
| |
The first rule, before you modify an important configuration file is to make a backup copy of it. For instance: | El comando mostrado arriba hace una copia del archivo ''sshd_config'' y añadir la extención ''.ORIG'' (por original, por supuesto)e incluir la fecha de modificación. Aunque no es perfecto, este sistema asegurar que siempre pueda volver a la versión previa del importante archivo ingresando el siguiente código. |
| |
''# cp -v /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG.20120826'' | <code> |
| # cp -v /etc/ssh/sshd_config.ORIG.20120826 /etc/ssh/sshd_config |
| </code> |
| |
The command shown above will make a copy of the ''sshd_config'' file, and append the extension ''.ORIG'' (for original, of course) and include a modification date. While not perfect, this system insures that you can always go back to the previous version of an important file by entering the following: | Tenga en cuenta que esta es una sugerencia, por supuesto, y se recomienda encarecidamente a los administradores de sistemas que tienen que administrar grandes instalaciones, con cientos de servidores, investigar mejores soluciones, como [[http://puppetlabs.com/|Puppet]] u otros gestores de configuración de sistemas distribuidos. |
| |
''# cp -v /etc/ssh/sshd_config.ORIG.20120826 /etc/ssh/sshd_config'' | Ahora, edite el archivo ''/etc/ssh/sshd_config'' con su editor favorito y ajusta las siguientes lineas: |
| |
Please note that this is a suggestion, of course, and system administrators that have to manage large installation, with hundreds of servers, are strongly advised to investigate better solutions, such as [[http://puppetlabs.com/|Puppet]] or other distributed system configuration managers. | ===== 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. |
| |
Now, edit the ''/etc/ssh/sshd_config'' file with your favourite editor and tweak the following lines: | Si desea cambiar el puerto, busque la opción ''Port'' en ''sshd_config'', que generalmente está en la parte superior del archivo, y cambie el valor. |
| |
===== Change the SSH default port ===== | Por ejemplo: |
| |
By default, OpenSSH 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. So, while it may slow down some attacks on your machine, it will not prevent them entirely. | |
| |
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. | |
| |
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. |
| |
===== Alternate method of Changing the SSH default port without changing ===== | 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 |
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 | #Agregar ssh_hide al puerto 8889 |
if [ -x /etc/rc.d/rc.ssh_hide ]; then | if [ -x /etc/rc.d/rc.ssh_hide ]; then |
/etc/rc.d/rc.ssh_hide | /etc/rc.d/rc.ssh_hide |