#!/usr/bin/bash # source some functions . common.sh test_header "Add locals" sq key generate --shared-key --without-password --email 'hubert@example.com' --output /tmp/hubert.pgp --rev-cert /tmp/hubert_rev.pgp > /dev/null 2>&1 cd $HUSK_DIR $HUSK_BIN locals add --cert-file /tmp/hubert.pgp --config config/config.toml if ! $HUSK_BIN locals list --config config/config.toml | grep -q "hubert@example.com" ; then echo "adding failed" exit 1 fi # send a mail, husk should encrypt it create_unix_user hubert send_test_mail hubert@example.com R=$(expect_mail hubert encrypted) if [ $R != 0 ] ; then delete_unix_user hubert exit 1 fi sleep 1 echo "removing hubert as local" HUBERT_FPR=$(sq cert list --cert-email hubert@example.com 2>/dev/null | head -n 1 | cut -d ' ' -f 3) $HUSK_BIN locals remove --cert $HUBERT_FPR --config config/config.toml rm /var/mail/hubert send_test_mail hubert@example.com R=$(expect_mail hubert unencrypted) delete_unix_user hubert exit $R