Skip to content

Configuration ​

lys-secrets has no configuration file. Its settings are command-line flags, and the Nix modules write those flags for you.

Command-line flags ​

FlagDefaultWhat it does
--unlock-fd NnoneRead the login password from inherited descriptor N and unlock the login collection with it, creating the collection if there is none
--collection-lock-after D0Lock a collection once no secret was read from it and nothing in it changed for this long; 0 keeps it open until something locks it
--collection-lock-on-screen-lockoffLock every collection when logind says the session locked
--vault-lock-after D15mLock the vault once no field was read from it for this long; 0 keeps it open until something locks it
--vault-sync-interval D30mSync the open vault this often; 0 syncs only on unlock and when asked
--vault-collection-folder NAMEemptyShow the logins of this vault folder as the read-only bitwarden collection; empty shows none

Durations use Go's syntax, such as 90s or 1h30m. A negative one is refused at start. The idle locks and the vault's sync interval act on time and count time the machine was suspended, acting within 30 seconds of it waking.

--collection-lock-on-screen-lock watches the logind session on the system bus: its Lock signal and its LockedHint turning true, which lys-login's lock screen sets. Unlocking through lys-login's lock screen reopens login; other collections ask for their password when next used. If logind cannot be reached, lys-secrets keeps serving and logs that collections will not lock with the screen. It does not touch the vault, which keeps to --vault-lock-after.

--unlock-fd reads the whole descriptor, at most 4096 bytes, and drops one trailing newline. A password that does not open the collection is logged and leaves it locked; lys-secrets keeps running.

--vault-collection-folder refuses to start if a keyring collection with the id bitwarden already exists. The error names the file to rename.

Passing flags to the packaged unit ​

On Debian, Ubuntu, Fedora or from the archive, override ExecStart in a drop-in, ~/.config/systemd/user/lys-secrets.service.d/vault.conf:

ini
[Service]
ExecStart=
ExecStart=/usr/bin/lys-secrets --vault-lock-after=30m --vault-collection-folder=Desktop

Then run systemctl --user daemon-reload and systemctl --user restart lys-secrets. A restart locks every collection and the vault.

Nix options ​

Both the NixOS and the home-manager module take these, under services.lys-secrets:

OptionDefaultFlag it sets
enablefalse
packagethe flake's package
collections.lockAfter0 (minutes)--collection-lock-after
collections.lockOnScreenLockfalse--collection-lock-on-screen-lock
vault.lockAfter15 (minutes)--vault-lock-after
vault.syncInterval30 (minutes)--vault-sync-interval
vault.collectionFolder""--vault-collection-folder

The bitwarden collection ​

With a folder set, libsecret clients find its logins while the vault is open:

sh
secret-tool lookup username ada

Each item's secret is the password. Its attributes are xdg:schema (dev.stubbe.lys.Bitwarden.Login), bitwarden:id, name, and the username, uri (the first one) and folder it has.

A login shows only if it has a password, is fully decrypted, and is not behind Bitwarden's master password reprompt. While the vault is locked the collection is locked and has no items, so a search finds nothing and does not prompt. A client that unlocks the collection is asked for the master password through the dialog. The collection is read-only: creating, changing or deleting in it is refused.

Files ​

$XDG_DATA_HOME and $XDG_STATE_HOME fall back to their usual places under $HOME. $XDG_RUNTIME_DIR must be set to an absolute path, or lys-secrets exits.

PathWhat it holds
$XDG_DATA_HOME/lys-secrets/<id>.keyringOne collection
$XDG_DATA_HOME/lys-secrets/aliases.jsonWhich collection each alias, such as default, points at
$XDG_STATE_HOME/lys-secrets/bitwarden/session.jsonThe Bitwarden session
$XDG_STATE_HOME/lys-secrets/bitwarden/device-idThe device id the Bitwarden server knows this client by
$XDG_RUNTIME_DIR/lys-secrets/controlThe unlock socket

How secrets are protected says what is in them and who can read them.

Released under the MIT License.