- Add a test for mail splitting. - Cleanup the code, move common functionality into `common.sh`. - Reduce noise in the test output.
45 lines
1.3 KiB
Bash
45 lines
1.3 KiB
Bash
#!/usr/bin/bash
|
|
|
|
# source some functions
|
|
. common.sh
|
|
|
|
test_header "Signing"
|
|
|
|
SIGN_FPR_GEN=$(sq key generate --own-key --without-password --name "Signing Key" 2>&1 | grep "Fingerprint:" | cut -d ':' -f 2 | tr -d ' ')
|
|
|
|
cd $HUSK_DIR
|
|
|
|
$HUSK_BIN --config config/config.toml signkey set --cert $SIGN_FPR_GEN
|
|
SIGN_FPR=$($HUSK_BIN --config config/config.toml signkey show | cut -d ':' -f 2 | tr -d ' ')
|
|
echo "found signing key $SIGN_FPR"
|
|
|
|
if [ "$SIGN_FPR" != "$SIGN_FPR_GEN" ] ; then
|
|
echo "setting new siging key failed, found $SIGN_FPR expected $SIGN_FPR_GEN"
|
|
exit 1
|
|
fi
|
|
|
|
create_unix_user juliette
|
|
JULIETTE_FPR=$(sq key generate --own-key --without-password --name "Juliette" --email "juliette@example.com" 2>&1 | grep "Fingerprint:" | cut -d ':' -f 2)
|
|
# sq pki vouch add --certifier-userid "CA" --cert $JULIETTE_FPR --all > /dev/null 2>&1
|
|
|
|
# send a mail, husk should encrypt it
|
|
send_test_mail juliette@example.com
|
|
|
|
R=$(expect_mail juliette encrypted $SIGN_FPR)
|
|
if [ $R != 0 ] ; then
|
|
exit 1
|
|
fi
|
|
|
|
sleep 1
|
|
echo "set new signing key"
|
|
|
|
SIGN_FPR=$($HUSK_BIN --config config/config.toml signkey create | cut -d ':' -f 2 | tr -d ' ')
|
|
echo "new signing key $SIGN_FPR"
|
|
|
|
# remove old mail
|
|
rm /var/mail/juliette
|
|
|
|
send_test_mail juliette@example.com
|
|
|
|
exit $(expect_mail juliette encrypted $SIGN_FPR)
|