...
- открываем терминал и создаем папку для ключей:
- Генерируем ключи:
Code Block |
---|
|
$ cd ~/.ssh
$ sh-keygen -t ecdsa-sk -O resident -O application=ssh:YourTextHere -O verify-required
Generating public/private ecdsa-sk key pair.
You may need to touch your authenticator to authorize key generation.
Enter PIN for authenticator:
Enter file in which to save the key (/home/tester/.ssh/id_ecdsa_sk):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tester/.ssh/id_ecdsa_sk
Your public key has been saved in /home/tester/.ssh/id_ecdsa_sk.pub
The key fingerprint is:
SHA256:veX8eVHMp6r5jmrCtyonIK/bymj/22cyB8KytayhCz0 tester@192.168.88.141
The key's randomart image is:
+-[ECDSA-SK 256]--+
| |
| |
| o |
| . =|
| . S . . .o|
|.... + . = .. |
|.oEo=.o . . o. .|
|+ooo+o=oo+ o.. ..|
|*B+oo*o*Oo++o o. |
+----[SHA256]-----+ |
- Копируем открытый ключ на сервер
Code Block |
---|
|
$ ssh-copy-id -i /home/tester/.ssh/id_ecdsa_sk.pub tester@192.168.88.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/tester/.ssh/id_ecdsa_sk.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
tester@rtub1910x64's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'tester@192.168.88.129'"
and check to make sure that only the key(s) you wanted were added. |
На сервере необходимо
Настройка сервера:
Необходимо добавить ключ "verify-required" в строку с ключем подключения в файле ~/.ssh/authorized_keys
Code Block |
---|
|
//Пример вывода содержимого файла:
$ cat /home/tester/.ssh/authorized_keys
sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBJgH8rLL3QBdtNFmtsbLqHvj78ql3W8xLA3ktuQ5MVXLE/5eXMmBMrMhwTstdU9JO4cKU2Amw0EZLCncShdEC10AAAAQc3NoOllvdXJUZXh0SGVyZQ== tester@192.168.88.129 verify-required |
...
Подключение:
Code Block |
---|
|
//Необходимо будет ввести пароль от закрытого ключа, пин-код Рутокен MFA и нажать кнопку на устройстве.
$ ssh 192.168.88.129
Enter passphrase for key '/home/tester/.ssh/id_ecdsa_sk':
Confirm user presence for key ECDSA-SK SHA256:veX8eVHMp6r5jmrCtyonIK/bymj/22cyB8KytayhCz0
Enter PIN for ECDSA-SK key /home/tester/.ssh/id_ecdsa_sk:
Confirm user presence for key ECDSA-SK SHA256:veX8eVHMp6r5jmrCtyonIK/bymj/22cyB8KytayhCz0
User presence confirmed
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-94-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
Расширенное поддержание безопасности (ESM) для Applications выключено.
0 обновлений может быть применено немедленно.
15 дополнительных обновлений безопасности могут быть применены с помощью ESM Apps.
Подробнее о включении службы ESM Apps at https://ubuntu.com/esm
Last login: Mon Feb 12 16:49:27 2024 from 192.168.88.141 |