Expand description
The dashboard’s human door: a username and a password, and the hash that stands in for the password on disk.
The dashboard used to have exactly one credential — a 64-character token you found in a config
file and pasted into a field labelled “password”. That is a key, not a login. This module is the
login: ECLIPSE_WEB_USER and ECLIPSE_WEB_PASSWORD_HASH in .env, the second one stored so
the file never holds the password itself.
Why PBKDF2 and not a plain hash. A password is a low-entropy secret a person can guess; the
whole defence is making each guess cost something. SHA-256 costs a microsecond, so a stolen
.env is a wordlist away from the password. PBKDF2-HMAC-SHA256 at 600,000 iterations costs
some hundreds of milliseconds per guess here — enough that a stolen file is a problem to think
about rather than a problem already solved.
Why the string carries its parameters. pbkdf2-sha256$600000$<salt>$<digest> can be raised
later — 600,000 will not be the number in five years — and a login hashes the password with the
stored iteration count to check it, so raising ITERATIONS only affects hashes made after
the change. A new password is a re-run of eclipse web passwd, not a migration.
Why ring. It is already in the tree (via rustls), it is a direct dependency of this
crate, and cargo build --offline resolves it — no new crate is available offline.
ring::pbkdf2::verify compares in constant time, and the username goes through
crate::token::constant_time_eq, so an unknown user and a wrong password take the same work
and the same time.
Structs§
- Stored
- A password hash, parsed from or destined for
.env.
Enums§
- Credentials
- What a sign-in is checked against.
Constants§
- HASH_
VAR - ITERATIONS
- How many PBKDF2-HMAC-SHA256 rounds a new hash gets. 600,000 is the figure OWASP names for
this construction; the number lives in each stored hash, so an old hash keeps working at its own
count and raising this is a re-run of
eclipse web passwd. - SCHEME
- The scheme tag at the front of a stored hash. Anything else —
sha256$,$argon2id$, a bare digest — is refused rather than approximated: a hash this build cannot read must fail loudly, not fall back to something weaker. - USER_
VAR - The variable names. Fixed, not configurable: the file a person edits is
.env, and aweb.auth_user_envthat named a variable would only add a second place to be wrong. The docs name these two,doctornames them when they are missing, andeclipse web passwdwrites them.
Functions§
- hash_
password - Hash a password into the string
.envholds. - verify_
password - Check a password against a stored hash string. A string this build cannot parse is
false: the caller has already refused to start on one (seeCredentials::resolve), so an unparsable value reaching here means something rewrote.envunder a running process, and refusing every password is the safe half of that. - write_
env_ vars - Set variables in the
.envthe loader reads, keeping everything else in the file.