Skip to main content

A FUSE filesystem for YubiKey PIV

Project description

YubiKey PIV FileSystem

A FUSE filesystem for YubiKey PIV

Ever wanted to use your YubiKey as a USB flash drive for storing your innermost thoughts? Well...

Features

Transparent compression

Filesystem content and metadata are compressed using ZSTD at its' highest level of compression.

Transparent encryption

Filesystem content and metadata are protected using ARGON2ID at the data block level using a key derived from the allocated slots in conjunction with the private key of the chosen KEY SLOT. The current implementation yields the following properties:

  • READ access is only possible by knowledge of the allocated slots and their correct order and having the ability to perform private key operations using the KEY SLOT
  • WRITE access is granted by knowledge of the PIV MANAGEMENT KEY

Read-only operating mode

In this mode, the filesystem can just perform READ operations, if WRITE operations are attempted then the EROFS: read-only file system error will be raised. To work in read-only mode, the --management-key and/or --management-key-type argument(s) must be omitted from the commandline.

Usage

usage: ykpivfs [-h] --pin PIN [--format {no,yes,force}] [--management-key MANAGEMENT_KEY] [--management-key-type {TDES,AES128,AES192,AES256}] [--key-slot KEY_SLOT] [--data-slots DATA_SLOTS [DATA_SLOTS ...]]
               [--block-size BLOCK_SIZE] [--device-serial DEVICE_SERIAL] [--debug]
               mount_point

PIV-slots: {AUTHENTICATION, SIGNATURE, KEY_MANAGEMENT, CARD_AUTH, RETIRED1, RETIRED2, RETIRED3, RETIRED4, RETIRED5, RETIRED6, RETIRED7, RETIRED8, RETIRED9, RETIRED10, RETIRED11, RETIRED12, RETIRED13, RETIRED14, RETIRED15,
RETIRED16, RETIRED17, RETIRED18, RETIRED19, RETIRED20, ATTESTATION}

positional arguments:
  mount_point

options:
  -h, --help            show this help message and exit
  --pin PIN             PIN used for private key operations (e.g. "123456")
  --format {no,yes,force}
                        if the data-slots should be formatted: "no" - does not format; "yes" - formats only if unable to find existing filesystem; "force" - formats even if filesystem already exists
  --management-key MANAGEMENT_KEY
                        key in bytes (e.g. "010203040506070801020304050607080102030405060708")
  --management-key-type {TDES,AES128,AES192,AES256}
                        type of key (e.g. "TDES")
  --key-slot KEY_SLOT   PIV-slot containing the private-key used for deriving the encryption-key
  --data-slots DATA_SLOTS [DATA_SLOTS ...]
                        PIV-slots used for storing data and that represent the keying-material used in deriving the encryption-key
  --block-size BLOCK_SIZE
                        maximum amount of data that can fit into each of the data-slots
  --device-serial DEVICE_SERIAL
                        used with multiple devices to select the desired one based on the serial number
  --debug               shows verbose output

example: "ykpivfs --format yes --pin 123456 --management-key 010203040506070801020304050607080102030405060708 mountpoint"

Setup

Please decide which PIV slots you want to use for:

  • KEY SLOT - private key operations, defaults to KEY_MANAGEMENT
  • DATA SLOTS - store the filesystem data, defaults to RETIRED1 RETIRED2 RETIRED3 RETIRED4 RETIRED5 RETIRED6 RETIRED7 RETIRED8 RETIRED9 RETIRED10 RETIRED11 RETIRED12 RETIRED13 RETIRED14 RETIRED15 RETIRED16 RETIRED17 RETIRED18 RETIRED19 RETIRED20

And apply your selection using the --key-slot and --data-slots parameters in commandline.

Please note:

  1. formatting means that all data that resides in the DATA SLOTS will be lost!
  2. the order for the slot names in the --data-slots parameter matters!

First-time startup

Mount the filesystem using --format yes, such as:

python main.py --format yes --pin 123456 --management-key 010203040506070801020304050607080102030405060708 mountpoint

The --format yes argument will ensure that the YubiKey is formatted for first use (i.e. it does not already have a valid filesystem).

Regular startup

Mount the filesystem using --format no, such as:

python main.py --format no --pin 123456 --management-key 010203040506070801020304050607080102030405060708 mountpoint

The --format no argument will ensure that the YubiKey will not be formatted even in the case that no valid filesystem is recognized, this is to safeguard against accidental formatting that may arise due to transient issues.

Disclaimer

This in an experimental project that may contain a multitude of bugs and may lead to damage of your YubiKey, loss of data and/or other unintended consequences and is provided mainly for educational or research purposes without any guarantees; please read the full disclaimer in the associated LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yubikey-pivfs-0.0.7.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yubikey_pivfs-0.0.7-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file yubikey-pivfs-0.0.7.tar.gz.

File metadata

  • Download URL: yubikey-pivfs-0.0.7.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for yubikey-pivfs-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e4faf45e0dc3533d3e64e67bead5d27efcf2fda172a6a8b9a6caf2cb6be54692
MD5 fd411ab306a68c72be50718e206b864f
BLAKE2b-256 b929eeb582f3a2994bbc833f417f4c7b2bbc4add4ca761ced64632b5b2f58443

See more details on using hashes here.

File details

Details for the file yubikey_pivfs-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: yubikey_pivfs-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for yubikey_pivfs-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 74a8f2f47a916eb0412923bf4cfed64937310c64885367a14fd544aaf15d09dd
MD5 58a64dc8d70d551fe550fc271e30c02c
BLAKE2b-256 db687340a95c6bb3c16a10b2149b34970f9f246c590928754df423a0d0bbe800

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page