Skip to content

Commit

Permalink
Explain how to use with user mode systemd units
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Nov 13, 2024
1 parent 5792729 commit 11a9e48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Download the [systemd unit file](https://github.com/mollyim/mollysocket/raw/main
You can use [systemd-creds](https://systemd.io/CREDENTIALS/) to encrypt the vapid key:

```console
$ mollysocket vapid gen | systemd-creds encrypt --name=ms_vapid -p - -
# mollysocket vapid gen | systemd-creds encrypt --name=ms_vapid -p - -
SetCredentialEncrypted=ms_vapid: \
k6iUCUh0RJCQyvL8k8q1UyAAAAABAAAADAAAABAAAAC1lFmbWAqWZ8dCCQkAAAAAgAAAA \
AAAAAALACMA0AAAACAAAAAAfgAg9uNpGmj8LL2nHE0ixcycvM3XkpOCaf+9rwGscwmqRJ \
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,18 @@ To generate a new key, you can run this command `mollysocket vapid gen`. Or usin

This value can be passed to mollysocket via a file, location given with `vapid_key_file` parameter, or directly in the `vapid_privkey` parameter. _The key file takes the precedence_.

To pass this value to mollysocket, you may wish to use [systemd-creds](https://systemd.io/CREDENTIALS/):
#### If you want to use systemd-creds

To pass this value to mollysocket, you may wish to use [systemd-creds](https://systemd.io/CREDENTIALS/). This allows you to store securely the VAPID key.

If you have installed your systemd service in [user mode](https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Unit%20File%20Load%20Path), adds `--user` to systemd-creds commands.

```console
$ mollysocket vapid gen | systemd-creds encrypt --name=ms_vapid -p - -
$ # Service installed in user mode:
$ # mollysocket vapid gen | systemd-creds --user encrypt --name=ms_vapid -p - -
$
# # Service installed in system mode:
# mollysocket vapid gen | systemd-creds encrypt --name=ms_vapid -p - -
SetCredentialEncrypted=ms_vapid: \
k6iUCUh0RJCQyvL8k8q1UyAAAAABAAAADAAAABAAAAC1lFmbWAqWZ8dCCQkAAAAAgAAAA \
AAAAAALACMA0AAAACAAAAAAfgAg9uNpGmj8LL2nHE0ixcycvM3XkpOCaf+9rwGscwmqRJ \
Expand Down

0 comments on commit 11a9e48

Please sign in to comment.