Skip to content

Commit 6ce3d33

Browse files
committed
test: add a couple of tests for FSS journals
1 parent 9e94023 commit 6ce3d33

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/units/testsuite-04.fss.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: LGPL-2.1-or-later
3+
set -eux
4+
set -o pipefail
5+
6+
# Forward Secure Sealing
7+
8+
if ! journalctl --version | grep -qF +GCRYPT; then
9+
echo "Built without gcrypt, skipping the FSS tests"
10+
exit 0
11+
fi
12+
13+
journalctl --force --setup-keys --interval=2 |& tee /tmp/fss
14+
FSS_VKEY="$(sed -rn '/([a-f0-9]{6}\-){3}[a-f0-9]{6}\/[a-f0-9]+\-[a-f0-9]+/p' /tmp/fss)"
15+
[[ -n "$FSS_VKEY" ]]
16+
17+
# Generate some buzz in the journal and wait until the FSS key is changed
18+
# at least once
19+
systemd-cat cat /etc/os-release
20+
sleep 4
21+
# Seal the journal
22+
journalctl --rotate
23+
# Verification should fail without a valid FSS key
24+
(! journalctl --verify)
25+
(! journalctl --verify --verify-key="")
26+
(! journalctl --verify --verify-key="000000-000000-000000-000000/00000000-00000")
27+
# FIXME: ignore --verify result until #27532 is resolved
28+
journalctl --verify --verify-key="$FSS_VKEY" || :
29+
30+
# Sealing + systemd-journal-remote
31+
/usr/lib/systemd/systemd-journal-remote --getter="journalctl -n 5 -o export" \
32+
--split-mode=none \
33+
--seal=yes \
34+
--output=/tmp/sealed.journal
35+
(! journalctl --file=/tmp/sealed.journal --verify)
36+
(! journalctl --file=/tmp/sealed.journal --verify --verify-key="")
37+
(! journalctl --file=/tmp/sealed.journal --verify --verify-key="000000-000000-000000-000000/00000000-00000")
38+
# FIXME: ignore --verify result until #27532 is resolved
39+
journalctl --file=/tmp/sealed.journal --verify --verify-key="$FSS_VKEY" || :
40+
rm -f /tmp/sealed.journal
41+
42+
# Return back to a journal without FSS
43+
rm -fv "/var/log/journal/$(</etc/machine-id)/fss"
44+
journalctl --rotate --vacuum-size=1
45+
# FIXME: ignore --verify result until #27532 is resolved
46+
journalctl --verify || :

0 commit comments

Comments
 (0)