-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
RFE: per-service credentials system #15778
Copy link
Copy link
Closed
Labels
RFE 🎁Request for Enhancement, i.e. a feature requestRequest for Enhancement, i.e. a feature requestpid1
Description
Moved over from @poettering's post in NixOS/rfcs#59 (comment):
BTW, I thought about a creds concept in systemd the past weeks. It's a big topic, but this is what I'd probably propose in systemd:
- Introduce a new setting per service setting
LoadCredential=<name>:<path>for loading a credential off disk. The name is some user chosen ID, the path is some file system path to load the credential from. - Similar, add
PassCredential=<newname>:<oldname>which takes a credential systemd itself received (think: pid1 in a container gets some creds from the container manager, or systemd --user from its parent). - Similar, add
AskCredential=<name>for querying a credential from the user via thesystemd-ask-passwordframework. - Then, add
CredentialMode=for configuring how to pass credentials to the service. Can be a combination of options:file(pass as file in the fs),keyring(for kernel keyring),fd(for passing as fd via socket activation). We'd default tofileandkeyring. We should be graceful here, i.e. ifkeyringcannot work (because we are in a container where kernel keyring is blocked), use only the fs. We'd always attempt to pass all configured creds through all methods in parallel. - Then, let's add
CredentialDirectory=, similar toRuntimeDirectory=and its friends, for defining a subdir of/run/credentials/to pass the creds in in casefilemode is used. There'd be$CREDENTIAL_DIRECTORY(again, similar to$RUNTIME_DIRECTORYand friends) we'd set for services to the resulting dir) - When passing via file system, we'd mount a
ramfs(and not atmpfs!) to/run/credentials//and place the creds there.ramfshas the benefit of never being swapped out. needs graceful fallback logic to using the dir without mount however, to cover for containers. we'd populate the fs atomically, and keep it read-only afterwards. - We'd never pass creds in env vars, they suck since they propagate down the process tree, even to suid programs.
everything passed will be immutable and only accessible to the user of the service, nothing else. there'd be no API for dynamically requesting more creds.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
RFE 🎁Request for Enhancement, i.e. a feature requestRequest for Enhancement, i.e. a feature requestpid1