aboutsummaryrefslogtreecommitdiffstats
path: root/tests/account-encrypted-gpg
blob: 7cb978d4c46cc0a6ed71dccd3ef95358bfb698b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# GnuPG-encrypted account key (WARN: this test is not interactive)

PASSPHRASE="test"

DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends gpg gpg-agent

gpg --batch --passphrase "$PASSPHRASE" --quick-generate-key "nobody <noreply@example.net>"
keyid="$(gpg --list-secret-key --with-colons | grep -m1 ^fpr: | cut -sd: -f10)"
gpg --encrypt -r "$keyid" /etc/lacme/account.key
sed -ri '0,\|^#?privkey\s*=.*| {s||privkey = gpg:/etc/lacme/account.key.gpg|}' /etc/lacme/lacme-accountd.conf

export GPG_TTY="$(tty)" TERM="linux"
lacme account

# vim: set filetype=sh :