Configuration
Define your own wordlists, presets, master passphrases and logins in a configuration file.
The configuration defines wordlists, presets, master passphrases and logins, so that you do not have to give them on the command line every time.
Files
On startup, Passgen reads its configuration files, if they exist, in this order:
/usr/share/passgen/config.toml, which is installed along with Passgen. If Passgen is installed somewhere else, such as/usr/local, the file is inshare/passgenthere. It defines the EFF wordlists and the presetseffandeff-markov. The static Linux archives do not come with this file./etc/passgen/config.toml, for all users of the system.~/.config/passgen/config.toml, which is your own. IfXDG_CONFIG_HOMEis set, it is$XDG_CONFIG_HOME/passgen/config.tomlinstead.
Each file can replace or remove what the ones before it define. Command-line flags come last, and override all of them.
Format
The files are written in TOML. Here is an example:
[wordlists]
english = "/usr/share/dict/words"
german = { path = "german.txt", hash = "8cc9e1a3257ee992" }
[presets]
pin = '[0-9]{6}'
long = '[a-zA-Z0-9]{32}'
apple1 = false
Presets and wordlists defined here can be used like the built-in ones:
$ passgen -p pin
977707
$ passgen '\w{english}-\w{english}'
goban-withdrawment
Wordlists
The [wordlists] table gives every wordlist a name and the path of its file. A
relative path is relative to the directory of the configuration file, not to where
you run Passgen.
A wordlist is only opened when a pattern uses it. One whose file is missing is not a problem until then.
A wordlist can also be written as { path = "...", hash = "..." }. Passgen then
checks that the file has this hash, and refuses to use it if it does not. The hash
is what b2sum prints for the file, or any start of it:
$ b2sum german.txt
8cc9e1a3257ee992... german.txt
This matters with a master passphrase, where a wordlist that changed would silently change your passphrases.
Presets
The [presets] table gives every preset a name and its pattern. Write the pattern
in single quotes, where TOML leaves backslashes alone. The
Presets page has more on presets.
Removing things
Setting a preset or a wordlist to false removes it. This also works for the
built-in presets and for anything an earlier file defines. In the example above,
apple1 is no longer available.
Master passphrases and logins
The configuration also holds [master.NAME] tables and [[login]] entries. These
are explained on the Master passphrase page.
Using other files
With --config PATH, Passgen reads that file instead of the usual ones. You can
repeat the flag to read several files, in order. The files have to exist. To read
no configuration at all, use --config /dev/null.
The environment variable PASSGEN_CONFIG does the same with a list of files,
separated by colons. Files in the list that do not exist are skipped.
Errors
A configuration file that cannot be read, is not valid TOML, or contains something that Passgen does not know is an error. Passgen says where the problem is and exits with status 14.