Próxima revisión | Revisión previa |
es:howtos:security:sshkeys [2019/02/11 01:45 (UTC)] – creado slackwarespanol | es:howtos:security:sshkeys [2021/09/12 08:29 (UTC)] (actual) – [Configure su clave pública en la computadora remota] antares_alf |
---|
<!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> | <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> |
====== How to use SSH keys to connect without a password. ====== | ====== Cómo utilizar las llaves SSH para conectarse sin una contraseña. ====== |
| |
[[http://www.openssh.org|OpenSSH]] is a very secure way to connect remotely to a Slackware machine. But the easiest way to use SSH is to use its key facility. | [[http://www.openssh.org|OpenSSH]] es una forma muy segura de conectarse de forma remota a una máquina Slackware. Pero la forma más fácil de usar SSH es, simplemente, usar sus llaves. |
| |
The concept of public/private keys can be hard to explain, we will try to go through it in as simple a manner as possible. | El concepto de claves públicas/privadas puede ser difícil de explicar, trataremos de hacerlo de la manera más simple posible. |
| <note>Permítanme decir esto de nuevo, para todos ustedes, crypto nerds allí afuera: Sí, ya sé que esta es una versión muy simplificada de SSH. Esto se crea para todos los novatos SSH... mmmmkay?</note> |
| |
<note>Allow me to say this again, for all of you, crypto nerds out there: yes, I know this is a very simplified version of SSH. This is created for all the SSH newbies... mmmmkay?</note> | Esencialmente, las llaves SSH se basan en la criptografía de clave pública. Esto significa que creas //__dos__// claves: una se llama llave pública y se usa para cifrar datos que solo usted puede descifrar. Puede dar su llave pública a cualquier persona, ya que su única función es cifrar datos - No hay mucho más que puedas hacer con él. La otra llave se llama llave PRIVADA, y es esta llave la que se utiliza para descifrar los datos cifrados con la llave pública. |
| |
Essentially, SSH keys are based on public key cryptography. This means you create //__two__// keys: one is called the public key, and it is used to encrypt data that only you can decrypt. You can give your public key to anyone, since its only function is to encrypt data - there is not much more you can do with it. The other key is called the PRIVATE key, and it is this key that is used to decrypt data encrypted with the public key. | Hasta ahora todo bien ... Ahora, ¿cómo se usa esto con SSH? |
| |
So far so good... Now, how is this used with SSH? | Cada vez que se comunique con una máquina Slackware (o cualquier máquina que ejecute OpenSSH, en realidad) a través del protocolo SSH, su SSH //__cliente__// (el programa, instalado en la computadora que tiene delante, que utiliza para conectarse) hablará con el SSH //__server__// instalado en la máquina distante. Determinarán en conjunto las capacidades que ambos pueden usar y la versión del protocolo que deben usar para comunicarse de forma segura. |
| |
Whenever you contact a Slackware machine (or any machine running OpenSSH, really) through the SSH protocol, your SSH //__client__// (the program, installed on the computer in front of you, that you use to connect) will talk to the SSH //__server__// installed on the distant machine. They will determine together the capabilities that they both can use, and the protocol version they should use to communicate securely. | Luego, intentarán determinar cómo usted (el usuario) iniciará sesión en la máquina remota. Si no se usan las claves, usualmente SSH (pero no siempre) predeterminará para pedirle una contraseña. Por otro lado, si se usan claves, las máquinas las usarán en el siguiente orden: |
| |
Then, they will try to determine how you (the user) will login on the remote machine. If keys are not used, SSH will usually (but not always) default to asking you a password. On the other hand, if keys are used, the machines are going to use them in the following order: | Then, they will try to determine how you (the user) will login on the remote machine. If keys are not used, SSH will usually (but not always) default to asking you a password. On the other hand, if keys are used, the machines are going to use them in the following order: |
| |
- The SSH server will encrypt a short message (technically a hash value) with your public key and send it to your computer. | - El servidor SSH cifrará un mensaje corto (técnicamente un valor hash) con su llave pública y lo enviará a su computadora. |
- Your SSH client will decrypt this message with the private key (whose only copy should be on your computer), and send it back to the SSH server. | - Su cliente de SSH descifrará este mensaje con la clave privada (cuya única copia debe estar en su computadora) y lo enviará de vuelta al servidor de SSH. |
- The SSH server will then be satisfied that you "are you" so to speak, since you are theoretically the only person able to decrypt the message sent, and will grant you access immediately. | - El servidor de SSH estará satisfecho de que usted 'sea usted', por así decirlo, ya que teóricamente es la única persona capaz de descifrar el mensaje enviado y le otorgará acceso de inmediato. |
| Si todo esto parece un poco complicado, solo recuerda esto: tienes una clave pública y una privada. La clave pública debe estar en la computadora a la que desea acceder, o la computadora 'remota'. La clave privada debe estar en su computadora. |
| |
If this all seems a bit complicated, just remember this simple thing: you have a public key and a private key. The public key should be on the computer you want access to, or the "remote" computer. The private key should be on your computer. | ¡Vamos a pasar por este proceso paso a paso! |
| |
Let's go through this process step by step! | |
| |
| |
===== Create the public/private key pair ===== | ===== Crear el par de claves pública/privada ===== |
| |
| Para crear una clave pública y una privada, use la utilidad OpenSSH ''ssh-keygen''. Esto generará automáticamente un par de claves, utilizando los valores predeterminados. Aquí hay un pequeño ejemplo: |
To create a public and a private key, use the OpenSSH ''ssh-keygen'' utility. This will automatically generate a key pair, using the default values. Here is a small example: | |
| |
<code> | <code> |
</code> | </code> |
| |
OK, what is going on here? | OK, ¿qué está pasando aquí? |
First, ''ssh-keygen'' is going to generate a key pair. So far, so good, please make sure you read the [[http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-keygen&apropos=0&sektion=1&manpath=OpenBSD+5.1&arch=i386&format=html|ssh-keygen man page]] to understand all the options, and there are many of them. | Primero, ''ssh-keygen'' generará un par de claves. Hasta ahora, todo bien, asegúrese de leer el |
| [[http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-keygen&apropos=0&sektion=1&manpath=OpenBSD+5.1&arch=i386&format=html|ssh-keygen man page]] entender todas las opciones, y hay muchas de ellas. |
| |
Next, ''ssh-keygen'' is going to respond that it is creating the RSA key pair (public and private key). RSA is the name of the encryption algorithm used. There are three such encryption possible: DSA, RSA and ECDSA. Which one is the best is left as an exercice for the reader... ;-) | A continuación, ''ssh-keygen'' responderá que está creando el par de claves RSA (clave pública y privada). RSA es el nombre del algoritmo de cifrado utilizado. Hay tres tipos de cifrado posibles: DSA, RSA y ECDSA. Cuál es el mejor se deja como ejercicio para el lector ... ;-) |
| |
It is then going to ask you where to save the key. Here, ''TEST.rsa'' is entered, since there are other keys on the system. Giving a proper name to the key is important, since it makes it much easier to remember which key connects to what. | Luego le preguntará dónde guardar la clave. Aquí se ingresa ''TEST.rsa'', ya que hay otras claves en el sistema. Es importante dar un nombre propio a la clave, ya que hace que sea mucho más fácil recordar a qué se conecta cada clave. |
| |
For instance, if you had an account on a machine named: ''stang.slackware.com'', a good name for the key pair would be ''stang_slackware_com.rsa'' or some such. | Por ejemplo, si tuviera una cuenta en una máquina llamada: ''stang.slackware.com'', un buen nombre para el par de claves sería ''stang_slackware_com.rsa'' o algo así. |
| |
Next, ''ssh-keygen'' asks you for a passphrase. It is always a good idea to enter a passphrase! This allows you to protect your private key, even if it falls into the wrong hands. If you are absolutely, 100% sure that your private key is **not** going to fall into the wrong hands (how optimistic you are!), just press ''Enter'' here. | A continuación, ''ssh-keygen'' le pide una frase de contraseña. ¡Siempre es una buena idea ingresar una frase de contraseña! Esto le permite proteger su clave privada, incluso si cae en las manos equivocadas. Si está absolutamente seguro al 100% de que su clave privada **no** va a caer en las manos equivocadas (¡qué optimista es!), Simplemente presione ''Entrar'' aquí. |
| |
The rest are just informative messages, and you will note that the key pair has been saved as follows: | |
| |
- The private key is named ''TEST.rsa''. | El resto son solo mensajes informativos, y notará que el par de claves se ha guardado de la siguiente manera: |
- The public key - the one you want to copy on the remote machine - is named ''TEST.rsa.pub'' | |
| |
Congratulations! You are halfway there! | - La clave privada se llama ''TEST.rsa''. |
| - La clave pública, la que desea copiar en la máquina remota, se llama ''TEST.rsa.pub'' |
| |
===== Configure your public key on the remote computer ===== | ¡Felicidades! Estás a medio camino! |
| |
| ===== Configure su clave pública en la computadora remota ===== |
| |
All right, now, how to use the public/private key? That's simple enough: copy the public key (named ''TEST.rsa.pub'' as we have seen) onto the remote computer. The best way to do this is to use ''scp'' the OpenSSH secure copy program. For instance: | Muy bien, ahora, ¿cómo usar la clave pública/privada? Eso es bastante simple: copie la //clave pública// (llamada ''TEST.rsa.pub'' como hemos visto) en la computadora remota. La mejor manera de hacer esto es usar ''scp'' el programa de copia segura OpenSSH. Por ejemplo: |
| |
<code> | <code> |
</code> | </code> |
| |
In the example above, I copy the //__public__// key ''TEST.rsa.pub'' on the remote machine named ''test.example.com'', as user ''nr''. The file is renamed ''authorized_keys'' which is the name of the file that contains all the public keys authorized to connect to the server. | En el ejemplo anterior, copió la //clave pública// ''TEST.rsa.pub'' en la máquina remota llamada ''test.example.com'', como usuario ''nr''. El archivo cambia de nombre a ''authorized_keys'', que es el nombre del archivo que contiene todas las claves públicas autorizadas para conectarse al servidor. |
| |
<note warning>A word of caution here: do not execute the ''scp'' command above if you already have an ''authorized_keys'' file on the remote computer! This will replace the content of the file with your public key!! | <note warning>**Una advertencia**: ¡no ejecute el comando ''scp'' anterior si ya tiene un archivo de ''authorized_keys'' en la computadora remota! ¡¡Esto reemplazará el contenido del archivo con su clave pública!! |
If you already have an ''authorized_keys'' file, execute a ''cat TEST.rsa.pub >> authorized_keys'' on the remote machine to add your public key at the end of authorized keys.</note> | Si ya tiene un archivo ''authorized_keys'', ejecute un ''cat TEST.rsa.pub >> authorized_keys'' en la máquina remota para agregar su clave pública al final de las claves autorizadas. |
| </note> |
| |
Since all the SSH keys you use should be placed in the ''.ssh'' directory, that's where it goes on the remote machine. | Dado que todas las claves SSH que usa deben colocarse en el directorio ''.ssh'', ahí es donde va en la máquina remota. |
| |
So, are we done? Not really, there is just one small thing to do, but it is truly important, since it is the source of a lot of problems... | |
| |
| Entonces, ¿hemos terminado? Realmente no, solo hay una pequeña cosa por hacer, pero es realmente importante, ya que es la fuente de muchos problemas... |
===== Check the public key permissions on the remote machine ===== | ===== Check the public key permissions on the remote machine ===== |
| |
<!-- * 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 |Noryungi]] | * Originalmente redactado por [[wiki:user:Noryungi |Noryungi]] |
<!-- * Contrbutions by [[wiki:user:yyy | User Y]] --> | <!-- * Contrbutions by [[wiki:user:yyy | User Y]] --> |
| * Traducción al Español [[wiki:user:antares_alf | antares_alf]] \\ |
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> |
<!-- You must also remove the tag-word "template" below. Otherwise your page will not show up in the Table of Contents --> | <!-- You must also remove the tag-word "template" below. Otherwise your page will not show up in the Table of Contents --> |
{{tag>howtos security ssh sshkeys author_noryungi}} | {{tag>howtos security ssh sshkeys author_noryungi}} |