Description
borg has no special interface / does not use some special api for smartcards or crypto usb sticks.
But there is this:
environment vars for the passphrase
https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables
-
BORG_PASSPHRASE
- directly give a passphrase to borg -
BORG_PASSCOMMAND
- execute a shell command which outputs the passphrase -
BORG_PASSPHRASE_FD
- read the passphrase from an open file descriptor
With these, some tool that might come with your hardware and some shell scripting, you can "glue together" the hardware and borg (no internal change in borg is needed for that).
You can use repokey
as well as keyfile
mode of borg for this, the passphrase that would unlock (decrypt) the key would from / via your special hardware, borg's encrypted key would be stored as usual.
environment vars for the key directory
Alternatively, for usb sticks with encrypted mass storage, the BORG_KEYS_DIR
(or BORG_KEY_FILE
) environment variable could be used to let borg read the keyfile directly from the storage on the stick (keyfile mode).
The storage needs to be mounted at some place and BORG_KEYS_DIR
(or BORG_KEY_FILE
) needs to point into there (doing that is also scripting and outside the scope of what borg does internally).