Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
nitrokey:arch:3a [16.12.2024 19:28. ] – [Nitrokey Start und Secure Shell] django | nitrokey:arch:3a [16.12.2024 20:52. ] (aktuell) – django | ||
---|---|---|---|
Zeile 230: | Zeile 230: | ||
Authentication key: [none] | Authentication key: [none] | ||
General key info..: [none]</ | General key info..: [none]</ | ||
+ | |||
+ | ==== nitropy ==== | ||
+ | FIXME | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | # pacman -S python-pynitrokey | ||
+ | |||
+ | |||
+ | # nitropy --help | ||
+ | < | ||
+ | |||
+ | Options: | ||
+ | -h, --help | ||
+ | |||
+ | Commands: | ||
+ | fido2 Interact with Nitrokey FIDO2 devices, see subcommands. | ||
+ | list List Nitrokey devices (in firmware or bootloader mode) | ||
+ | nethsm | ||
+ | nk3 Interact with Nitrokey 3 devices, see subcommands. | ||
+ | nkpk | ||
+ | pro Interact with Nitrokey Pro devices, see subcommands. | ||
+ | start Interact with Nitrokey Start devices, see subcommands. | ||
+ | storage | ||
+ | version | ||
+ | |||
+ | # nitropy nk3 test | ||
+ | < | ||
+ | THIS COMMAND SHOULD NOT BE RUN AS ROOT! | ||
+ | |||
+ | Please install udev rules and run `nitropy` as regular user (without sudo). | ||
+ | We suggest using: https:// | ||
+ | For more information, | ||
+ | |||
+ | Set ALLOW_ROOT=1 environment variable to disable this warning. | ||
+ | |||
+ | Found 1 NK3 device(s): | ||
+ | - Nitrokey 3 at / | ||
+ | |||
+ | Running tests for Nitrokey 3 at / | ||
+ | |||
+ | [1/ | ||
+ | [2/ | ||
+ | [3/ | ||
+ | Running SE050 test: | | ||
+ | [4/ | ||
+ | Please press the touch button on the device ... | ||
+ | Please press the touch button on the device ... | ||
+ | [5/ | ||
+ | |||
+ | 5 tests, 5 successful, 0 skipped, 0 failed | ||
+ | |||
+ | Summary: 1 device(s) tested, 1 successful, 0 failed</ | ||
+ | |||
+ | Das Protokoll im Verzeichnis **''/ | ||
+ | |||
+ | # ls -al / | ||
+ | < | ||
+ | |||
+ | # cat / | ||
+ | < | ||
+ | 368 INFO pynitrokey.cli OS: uname_result(system=' | ||
+ | 368 INFO pynitrokey.cli Python version: 3.12.7 | ||
+ | 369 INFO pynitrokey.cli Cli arguments: [' | ||
+ | 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=' | ||
+ | 512 | ||
+ | 512 | ||
+ | 512 | ||
+ | 520 | ||
+ | 528 | ||
+ | 536 INFO pynitrokey.cli.trussed.tests Device status: Status(init_status=< | ||
+ | 536 | ||
+ | 669 | ||
+ | 1782 DEBUG fido2.server Fido2Server initialized for RP: PublicKeyCredentialRpEntity(name=' | ||
+ | 1782 DEBUG fido2.server Starting new registration, | ||
+ | 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, | ||
+ | 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 | ||
+ | 10328 | ||
+ | 10588 | ||
+ | 10755 INFO fido2.server Credential authenticated: | ||
+ | 10755 | ||
+ | 10756 | ||
+ | 10756 | ||
+ | |||
+ | ==== 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, | ||
+ | |||
+ | 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:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | |||
===== Anwendungsfälle - Software ===== | ===== Anwendungsfälle - Software ===== | ||
Zeile 1407: | Zeile 1551: | ||
Nun stecken wir unseren Nitrokey Start an den USB-Port und fragen den Kartenstatus ab. | Nun stecken wir unseren Nitrokey Start an den USB-Port und fragen den Kartenstatus ab. | ||
$ gpg2 --card-status | $ gpg2 --card-status | ||
- | < | + | < |
- | Application ID ...: D276000124010200FFFE432437110000 | + | Application ID ...: D276000124010304000F6447F2530000 |
Application type .: OpenPGP | Application type .: OpenPGP | ||
- | Version ..........: | + | Version ..........: |
- | Manufacturer .....: | + | Manufacturer .....: |
- | Serial number ....: 43243711 | + | Serial number ....: 6447F253 |
Name of cardholder: Michael Nausch | Name of cardholder: Michael Nausch | ||
Language prefs ...: de | Language prefs ...: de | ||
Salutation .......: Mr. | Salutation .......: Mr. | ||
- | URL of public key : [not set] | + | URL of public key : https:// |
- | Login data .......: | + | Login data .......: |
Signature PIN ....: forced | Signature PIN ....: forced | ||
Key attributes ...: ed25519 cv25519 ed25519 | Key attributes ...: ed25519 cv25519 ed25519 | ||
Max. PIN lengths .: 127 127 127 | Max. PIN lengths .: 127 127 127 | ||
- | PIN retry counter : 3 3 2 | + | PIN retry counter : 3 0 3 |
- | Signature counter : 23 | + | Signature counter : 10 |
KDF setting ......: off | KDF setting ......: off | ||
UIF setting ......: Sign=off Decrypt=off Auth=off | UIF setting ......: Sign=off Decrypt=off Auth=off | ||
- | Signature key ....: 2C08 2445 CDFB 72DE CD65 0350 610E D9AE E553 353F | + | Signature key ....: F5F0 CD13 074B A693 D950 F92A 0A56 C9A3 A69F E291 |
- | created ....: 2024-01-03 21:17:32 | + | created ....: 2024-12-15 17:08:38 |
- | Encryption key....: | + | Encryption key....: |
- | created ....: 2024-01-03 21:17:32 | + | created ....: 2024-12-15 17:08:38 |
- | Authentication key: D5AF 3627 1220 7A2A 54BD 6C47 C72E 74B8 1A5C 4549 | + | Authentication key: EE7C 3807 4F0A 8F2A 5601 BF91 1E61 4A9A 36D4 DF53 |
- | created ....: 2024-01-03 21:17:32 | + | created ....: 2024-12-15 17:08:38 |
- | General key info..: pub ed25519/610ED9AEE553353F | + | General key info..: pub ed25519/0A56C9A3A69FE291 |
- | sec> | + | sec> |
- | card-no: | + | card-no: |
- | ssb> | + | ssb> |
- | card-no: | + | card-no: |
- | ssb> | + | ssb> |
- | card-no: | + | card-no: |
- | </ | + | |
Ein erneuter Blick in die Prozessliste zeigt nun den neu gestarteten Agenten. | Ein erneuter Blick in die Prozessliste zeigt nun den neu gestarteten Agenten. | ||
$ ps aux | grep gpg-agent | $ ps aux | grep gpg-agent | ||
- | django | + | django |
- | django | + | django |
+ | |||
+ | === Public-Key des ED25519 SSH exportieren === | ||
+ | Für den Zugriff auf unser Ziel-System mit Hilfe der SSH benötigen wir noch den öffentlichen Schlüssel unseres Authentication Keys, den wir nun exportieren werden. | ||
+ | Zunächst besorgen wir uns die betreffende Schlüsselkennung des Authentication Keys, genauer gesagt die 4 letzten Zahlenreihen des nachfolgenden Aufrufs. | ||
+ | $ gpg2 --card-status | grep Authentication\ key | ||
+ | |||
+ | 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 '' | ||
+ | |||
+ | Nun exportieren wir den öffentlichen Schlüssel und schreiben diesen in eine separate Datei. | ||
+ | $ gpg2 --export-ssh-key 1E614A9A36D4DF53 >> ~/ | ||
+ | |||
+ | Der Öffentliche Schlüssel in diesen Konfigurationsbeispiel lautet also: | ||
+ | $ cat ~/ | ||
+ | |||
+ | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILz8sjaPGlC16rOK7s8S8gzBmbfnCOsiz4jD77+BuLn4 openpgp: | ||
+ | |||
+ | Diesen Schlüssel kopieren wir nun auf das entsprechende Zielsystem an Ort und Stelle '' | ||
+ | $ scp ~/ | ||
+ | |||
+ | === 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 | ||
+ | |||
+ | 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. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | 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 '' | ||
+ | $ pkill gpg-agent | ||
+ | |||
+ | </ | ||
+ | |||
+ | 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! | ||