static-auth-rocket requires a configuration file to run. The executable file
contains a template configuration file that can be created using the
make-config
subcommand:
$ static-auth-rocket make-config
Running this command should cause a Rocket.toml
file to be created in the
current working directory.
Edit this file and make the appropriate modifications. Notably:
htdocs
is the base directory that will act as the HTTP server's root. The server will share all files within this directory.database
should point to a sqlite database file that will be used to read the account database from. This file will be created by static-auth-rocket if it does not already exist.
The configuration parameters under debug
section are used for debug builds,
and the ones under release
are used for release builds (which is the default
when installing crates using cargo install
).
Populate account database
To grant a new user permission access the server's contents, they must have an account in the database. There's no custom user interface for managing the account database -- any sufficiently recent SQLite database management tool will do.
The account database is stored in the accs
table, where the account name is
stored int he name
column and a hex-encoded SHA2/256 hash of the account's
passphrase is stored in the pass
column.
The database is read at startup, which means that modifications of the database will not be picked up until the service is restarted.
Manual creation of accs table
To manually create the accounts database the following query can be used:
CREATE TABLE accs (
name TEXT UNIQUE,
pass TEXT NOT NULL,
CHECK (length(pass) == 64)
);