Files
husk-milter/e2e-tests/tests/40_introducer_create.sh
T
Malte Meiboom 8b2f284916 Improve e2e tests
- Add a test for mail splitting.
- Cleanup the code, move common functionality into `common.sh`.
- Reduce noise in the test output.
2026-07-09 12:55:10 +02:00

41 lines
1.1 KiB
Bash

#!/usr/bin/bash
# source some functions
. common.sh
test_header "Add introducer"
ELLEN_FPR=$(sq key generate --shared-key --without-password --name "Ellen" --email "ellen@example.com" 2>&1 | grep "Fingerprint:" | cut -d ':' -f 2)
cd $HUSK_DIR
$HUSK_BIN introducer add --cert $ELLEN_FPR --domains "example.org" --config config/config.toml
$HUSK_BIN introducer list --config config/config.toml
create_unix_user fred
FRED_FPR=$(sq key generate --shared-key --without-password --name "Fred" --email "fred@example.org" 2>&1 | grep "Fingerprint:" | cut -d ':' -f 2)
sleep 1
sq pki link retract --cert $FRED_FPR --all > /dev/null 2>&1
sq pki vouch add --certifier $ELLEN_FPR --cert $FRED_FPR --email "fred@example.org" > /dev/null 2>&1
send_test_mail fred@example.org
RESULT_CODE=$(expect_mail fred encrypted)
if [ "$RESULT_CODE" == "1" ] ; then
exit 1
fi
test_header "Remove introducer"
$HUSK_BIN introducer remove --cert $ELLEN_FPR --config config/config.toml
$HUSK_BIN introducer list --config config/config.toml
rm /var/mail/fred
send_test_mail fred@example.org
RESULT_CODE=$(expect_mail fred unencrypted)
delete_unix_user fred
exit $RESULT_CODE