Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Описание стенда:

  1. Сервер: ОС Ubuntu 22.04, openssh 8.9p1.
  2. Клиент: ОС Ubuntu 23.10, openssh 8.9p1.

 Перед началом работы установим пакеты для работы с устройствами FIDO2 на клиенте и сервере. Для этого необходимо открыть терминал и выполнить команду:

$ sudo apt-get install libpam-u2f pamu2fcfg fido2-tools

Настройка клиента:

  1. открываем терминал и создаем папку для ключей:
    $ mkdir ~/.ssh
  2. Генерируем ключи:
    $ 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]-----+
  3. Копируем открытый ключ на сервер
    $ 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.
  4. На сервере необходимо добавить ключ "verify-required" в строку с ключем подключения в файле ~/.ssh/authorized_keys
    //Пример вывода содержимого файла:
    $ cat /home/tester/.ssh/authorized_keys 
    sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBJgH8rLL3QBdtNFmtsbLqHvj78ql3W8xLA3ktuQ5MVXLE/5eXMmBMrMhwTstdU9JO4cKU2Amw0EZLCncShdEC10AAAAQc3NoOllvdXJUZXh0SGVyZQ== tester@192.168.88.129 verify-required
  5. Подключаемся к серверу:
    //Необходимо будет ввести пароль от закрытого ключа, пин-код Рутокен 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


  • No labels