Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
nitrokey:arch:3a [16.12.2024 19:34. ] – [SSH Client vorbereiten] djangonitrokey:arch:3a [16.12.2024 20:52. ] (aktuell) django
Zeile 230: Zeile 230:
 Authentication key: [none] Authentication key: [none]
 General key info..: [none]</code> General key info..: [none]</code>
 +
 +==== nitropy ====
 +FIXME 
 +
 +
 +
 +
 +   # pacman -S python-pynitrokey
 +
 +
 +   # nitropy --help
 +<code>Usage: nitropy [OPTIONS] COMMAND [ARGS]...
 +
 +Options:
 +  -h, --help  Show this message and exit.
 +
 +Commands:
 +  fido2    Interact with Nitrokey FIDO2 devices, see subcommands.
 +  list     List Nitrokey devices (in firmware or bootloader mode)
 +  nethsm   Interact with NetHSM devices, see subcommands.
 +  nk3      Interact with Nitrokey 3 devices, see subcommands.
 +  nkpk     Interact with Nitrokey Passkey devices, see subcommands.
 +  pro      Interact with Nitrokey Pro devices, see subcommands.
 +  start    Interact with Nitrokey Start devices, see subcommands.
 +  storage  Interact with Nitrokey Storage devices, see subcommands.
 +  version  Version of pynitrokey library and tool.</code>
 +
 +   # nitropy nk3 test
 +<code>Command line tool to interact with Nitrokey devices 0.6.0
 +THIS COMMAND SHOULD NOT BE RUN AS ROOT!
 +
 +Please install udev rules and run `nitropy` as regular user (without sudo).
 +We suggest using: https://raw.githubusercontent.com/Nitrokey/libnitrokey/master/data/41-nitrokey.rules
 +For more information, see: https://docs.nitrokey.com/software/nitropy/linux/udev.html
 +
 +Set ALLOW_ROOT=1 environment variable to disable this warning.
 +
 +Found 1 NK3 device(s):
 +- Nitrokey 3 at /dev/hidraw0
 +
 +Running tests for Nitrokey 3 at /dev/hidraw0
 +
 +[1/5] uuid      UUID query              SUCCESS  6447F2534D3A582D0000000000000000
 +[2/5] version  Firmware version query  SUCCESS  v1.7.2
 +[3/5] status    Device status            SUCCESS  Status(init_status=<InitStatus: 0>, ifs_blocks=241, efs_blocks=471, variant=<Variant.NRF52: 2>)
 +Running SE050 test: |                                                                                                                                                                                 
 +[4/5] se050    SE050                    SUCCESS  SE050 firmware version: 3.1.1 - 1.11, (persistent: (30140,), transient_deselect: (271,), transient_reset: (256,))
 +Please press the touch button on the device ...
 +Please press the touch button on the device ...
 +[5/5] fido2    FIDO2                    SUCCESS 
 +
 +5 tests, 5 successful, 0 skipped, 0 failed
 +
 +Summary: 1 device(s) tested, 1 successful, 0 failed</code>
 +
 +Das Protokoll im Verzeichnis **''/tmp''** von **''nitropy''** zeigt im Zweifelsfall weitere Informationen die bei der weiteren Betrachtung oder Fehlereingrenzung wertvolle Informationen liefern kann.
 +
 +   # ls -al /tmp/nitropy.log.gkod8a3k 
 +<code>-rw-r--r-- 1 root root 5795 Dec 16 21:16 /tmp/nitropy.log.gkod8a3k</code>
 +
 +   # cat /tmp/nitropy.log.gkod8a3k
 +<code>368        INFO pynitrokey.cli Timestamp: 2024-12-16 21:16:27.120247
 +368        INFO pynitrokey.cli OS: uname_result(system='Linux', node='pml010074', release='6.6.65-1-lts', version='#1 SMP PREEMPT_DYNAMIC Wed, 11 Dec 2024 15:35:54 +0000', machine='x86_64')
 +368        INFO pynitrokey.cli Python version: 3.12.7
 +369        INFO pynitrokey.cli Cli arguments: ['nk3', 'test']
 +372        INFO pynitrokey.cli pynitrokey version: 0.6.0
 +373        INFO pynitrokey.cli cryptography version: 43.0.3
 +374        INFO pynitrokey.cli ecdsa version: 0.19.0
 +374        INFO pynitrokey.cli fido2 version: 1.1.3
 +375        INFO pynitrokey.cli pyusb version: 1.2.1
 +376        INFO pynitrokey.cli.trussed.test platform: Linux-6.6.65-1-lts-x86_64-with-glibc2.40
 +376        INFO pynitrokey.cli.trussed.test uname: uname_result(system='Linux', node='pml010074', release='6.6.65-1-lts', version='#1 SMP PREEMPT_DYNAMIC Wed, 11 Dec 2024 15:35:54 +0000', machine='x86_64')
 +512       DEBUG       root print: Found 1 NK3 device(s):
 +512       DEBUG       root print: - Nitrokey 3 at /dev/hidraw0
 +512       DEBUG       root print: Running tests for Nitrokey 3 at /dev/hidraw0
 +520       DEBUG       root print: [1/5] uuid      UUID query              SUCCESS  6447F2534D3A582D0000000000000000
 +528       DEBUG       root print: [2/5] version  Firmware version query  SUCCESS  v1.7.2
 +536        INFO pynitrokey.cli.trussed.tests Device status: Status(init_status=<InitStatus: 0>, ifs_blocks=241, efs_blocks=471, variant=<Variant.NRF52: 2>)
 +536       DEBUG       root print: [3/5] status    Device status            SUCCESS  Status(init_status=<InitStatus: 0>, ifs_blocks=241, efs_blocks=471, variant=<Variant.NRF52: 2>)
 +669       DEBUG       root print: [4/5] se050    SE050                    SUCCESS  SE050 firmware version: 3.1.1 - 1.11, (persistent: (30140,), transient_deselect: (271,), transient_reset: (256,))
 +1782      DEBUG fido2.server Fido2Server initialized for RP: PublicKeyCredentialRpEntity(name='Example RP', id='example.com')
 +1782      DEBUG fido2.server Starting new registration, existing credentials: 
 +1786      DEBUG       root print: Please press the touch button on the device ...
 +1796      DEBUG fido2.client Register a new credential for RP ID: example.com
 +1838      DEBUG fido2.ctap2.base Calling CTAP2 make_credential
 +1996      DEBUG  fido2.hid Got keepalive status: 01
 +2248      DEBUG  fido2.hid Got keepalive status: 01
 +2496      DEBUG  fido2.hid Got keepalive status: 01
 +2748      DEBUG  fido2.hid Got keepalive status: 01
 +2996      DEBUG  fido2.hid Got keepalive status: 01
 +3248      DEBUG  fido2.hid Got keepalive status: 01
 +3496      DEBUG  fido2.hid Got keepalive status: 01
 +3744      DEBUG  fido2.hid Got keepalive status: 01
 +3996      DEBUG  fido2.hid Got keepalive status: 01
 +4244      DEBUG  fido2.hid Got keepalive status: 02
 +4496      DEBUG  fido2.hid Got keepalive status: 01
 +4744      DEBUG  fido2.hid Got keepalive status: 01
 +4996      DEBUG  fido2.hid Got keepalive status: 01
 +5244      DEBUG  fido2.hid Got keepalive status: 01
 +5492      DEBUG  fido2.hid Got keepalive status: 01
 +5744      DEBUG  fido2.hid Got keepalive status: 01
 +5992      DEBUG  fido2.hid Got keepalive status: 01
 +6244      DEBUG  fido2.hid Got keepalive status: 01
 +6492      DEBUG  fido2.hid Got keepalive status: 01
 +6740      DEBUG  fido2.hid Got keepalive status: 01
 +6992      DEBUG  fido2.hid Got keepalive status: 01
 +7240      DEBUG  fido2.hid Got keepalive status: 01
 +7492      DEBUG  fido2.hid Got keepalive status: 01
 +7740      DEBUG  fido2.hid Got keepalive status: 01
 +7992      DEBUG  fido2.hid Got keepalive status: 01
 +8256      DEBUG  fido2.hid Got keepalive status: 01
 +8512      DEBUG  fido2.hid Got keepalive status: 01
 +8796      DEBUG  fido2.hid Got keepalive status: 01
 +9056      DEBUG  fido2.hid Got keepalive status: 01
 +9199      DEBUG fido2.server Verifying attestation of type packed
 +9200       INFO fido2.server New credential registered: a3005878bd496f7f5e7c10b12264abdc7274b8a2a8a1724eab6a6b2cf29737921dfb1c4793c1b3645547b7287ca5cd6087b3cd0c06e03c9115de4aeba206f2cfc14da879c4cf8c2045165008c9b3aa4591cee5b2cb825ee6c86f4ebe2f6bc8c4769902a550d389e11b235485931334234f15bf64de04d075aa27d394014c680a5adb95a30d02ed6d9e7f02505d85c63ba65a973e074ce94856cbb2a0
 +9201      DEBUG fido2.server Starting new authentication, for credentials: a3005878bd496f7f5e7c10b12264abdc7274b8a2a8a1724eab6a6b2cf29737921dfb1c4793c1b3645547b7287ca5cd6087b3cd0c06e03c9115de4aeba206f2cfc14da879c4cf8c2045165008c9b3aa4591cee5b2cb825ee6c86f4ebe2f6bc8c4769902a550d389e11b235485931334234f15bf64de04d075aa27d394014c680a5adb95a30d02ed6d9e7f02505d85c63ba65a973e074ce94856cbb2a0
 +9202      DEBUG       root print: Please press the touch button on the device ...
 +9206      DEBUG fido2.client Assert a credential for RP ID: example.com
 +9237      DEBUG fido2.ctap2.base Calling CTAP2 get_assertion
 +9304      DEBUG  fido2.hid Got keepalive status: 02
 +9552      DEBUG  fido2.hid Got keepalive status: 01
 +9804      DEBUG  fido2.hid Got keepalive status: 01
 +10052     DEBUG  fido2.hid Got keepalive status: 01
 +10328     DEBUG  fido2.hid Got keepalive status: 01
 +10588     DEBUG  fido2.hid Got keepalive status: 01
 +10755      INFO fido2.server Credential authenticated: a3005878bd496f7f5e7c10b12264abdc7274b8a2a8a1724eab6a6b2cf29737921dfb1c4793c1b3645547b7287ca5cd6087b3cd0c06e03c9115de4aeba206f2cfc14da879c4cf8c2045165008c9b3aa4591cee5b2cb825ee6c86f4ebe2f6bc8c4769902a550d389e11b235485931334234f15bf64de04d075aa27d394014c680a5adb95a30d02ed6d9e7f02505d85c63ba65a973e074ce94856cbb2a0
 +10755     DEBUG       root print: [5/5] fido2    FIDO2                    SUCCESS
 +10756     DEBUG       root print: 5 tests, 5 successful, 0 skipped, 0 failed
 +10756     DEBUG       root print: Summary: 1 device(s) tested, 1 successful, 0 failed</code>
 +
 +==== webauthn.io ====
 +
 +Was ist WebAuthn?
 +
 +Willkommen auf webauthn.io! Diese Website wurde von Duo Labs entwickelt, um WebAuthn und Passkeys zu testen. WebAuthn wird von allen gängigen Browsern, einschließlich Chrome, Safari und Firefox, sowie von allen modernen Betriebssystemen, einschließlich Android, iOS, macOS und Windows, unterstützt.
 +
 +Eine Einführung in WebAuthn und seine Funktionen finden Sie unter webauthn.guide. Wenn Sie Ihre Website um WebAuthn-Unterstützung erweitern möchten, sind Sie bei passkeys.dev richtig. Der Code für diese Demo ist auf GitHub verfügbar.
 +
 +https://webauthn.guide/
 +
 +https://webauthn.io/
 +
 +
  
 ===== Anwendungsfälle - Software ===== ===== Anwendungsfälle - Software =====
Zeile 1450: Zeile 1594:
    $ gpg2 --card-status | grep Authentication\ key    $ gpg2 --card-status | grep Authentication\ key
  
-  Authentication key: D5AF 3627 1220 7A2A 54BD  6C47 C72E 74B8 1A5C 4549 +  Authentication key: EE7C 3807 4F0A 8F2A 5601  BF91 1E61 4A9A 36D4 DF53 
-In diesem Konfigurationsbeispiel ist die Schlüssel-ID des Autentication Keys also die Nummer ''**C72E74B81A5C4549**''.+In diesem Konfigurationsbeispiel ist die Schlüssel-ID des Autentication Keys also die Nummer ''**1E614A9A36D4DF53**''.
  
 Nun exportieren wir den öffentlichen Schlüssel und schreiben diesen in eine separate Datei. Nun exportieren wir den öffentlichen Schlüssel und schreiben diesen in eine separate Datei.
-   $ gpg2 --export-ssh-key C72E74B81A5C4549 >> ~/.ssh/C72E74B81A5C4549.pub+   $ gpg2 --export-ssh-key 1E614A9A36D4DF53 >> ~/.ssh/1E614A9A36D4DF53.pub
  
 Der Öffentliche Schlüssel in diesen Konfigurationsbeispiel lautet also: Der Öffentliche Schlüssel in diesen Konfigurationsbeispiel lautet also:
-   $ cat ~/.ssh/C72E74B81A5C4549.pub+   $ cat ~/.ssh/1E614A9A36D4DF53.pub
  
-  ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHMD4OSvbbTRAs88C5jQeUX7HOR0TYd+EIQLcKmGCBll openpgp:0x1A5C4549+  ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILz8sjaPGlC16rOK7s8S8gzBmbfnCOsiz4jD77+BuLn4 openpgp:0x36D4DF53
  
 Diesen Schlüssel kopieren wir nun auf das entsprechende Zielsystem an Ort und Stelle ''**~/.ssh/authorized_keys**''. Diesen Schlüssel kopieren wir nun auf das entsprechende Zielsystem an Ort und Stelle ''**~/.ssh/authorized_keys**''.
-   $ scp ~/.ssh/C72E74B81A5C4549.pub zielhost.dmz.nausch.org: && ssh zielhost.dmz.nausch.org 'cat authorized_keys >> ~/.ssh/authorized_keys'+   $ scp ~/.ssh/1E614A9A36D4DF53.pub zielhost.dmz.nausch.org: && ssh zielhost.dmz.nausch.org 'cat authorized_keys >> ~/.ssh/authorized_keys' 
 + 
 +=== SSH-Verbindung aufbauen === 
 +Nun können wir wie gewohnt eine Verbindung zu unserem entfernten System aufbauen, sofern der GPG-Agent am laufen ist. Wir können dazu entweder erst einmal abfragen, ob dieser gestartet wurde, mit Hilfe des folgenden Aufrufs: 
 +   $ ps -aux | grep gpg-agent 
 + 
 +  django      1430  0.0  0.0 376092  3636 ?        SLsl 20:32   0:00 /usr/bin/gpg-agent --supervised 
 + 
 +Oder wir fragen einfach den Karten-Status ab, was unweigerlich den Neustart des GPG-Agenten nach sich zieht. 
 +   $ gpg2 --card-status 
 + 
 +Nun können wir die gewünschte Verbindung zum Zielsystem aufbauen. 
 +   $ ssh zielhost.dmz.nausch.org 
 + 
 +Da der SSH-Key zur Authentication nicht im Dateisystem liegt, sondern auf der SmartCard des Nitrokey werden wir nun nach der User-PIN gefragt, damit auf den privaten Schlüssel der Karte zugegriffen werden kann. 
 + 
 +{{ :nitrokey:arch:ssh_001.png?nolink&280 |Bild: PIN Abfrage beim Zugriff auf den Authentication Key der SmartCard des Nitrokeys}} 
 + 
 +Der entsperrte Schlüssel der SmartCard des Nitrokey Start wird nun im Speicher gehalten solange wir den USB-Hardwareschlüssel nicht abziehen.  
 + 
 +<WRAP center round important 90%> 
 +**WICHTIG:** \\ 
 +Da wir den Schlüssel **__nicht__** aus einer Datei geladen hatten, können wir diese auch nicht mit Hilfe von ''**ssh-add**'' wieder entladen! Wollen wir verhindern, dass auf den im Speicher vorgehaltenen Schlüssel zugegriffen wird, müssen wir manuell den GPG-Agenten beenden. 
 +   $ pkill gpg-agent 
 + 
 +</WRAP> 
 + 
 +Anschliessend lassen sich Verbindungen zu unseren Remote-Systemen erst wieder aufbauen, wenn der GPG-Agent geladen und die Karte nach Eingabe der PIN entsperrt wurde!
  
  • nitrokey/arch/3a.1734377699.txt.gz
  • Zuletzt geändert: 16.12.2024 19:34.
  • von django