26 lines
520 B
Bash
26 lines
520 B
Bash
#!/usr/bin/bash
|
|
|
|
echo "Simple: Test encryption for available certificate"
|
|
|
|
# There is an authenticated certificate for bob in the cert store
|
|
adduser --shell /bin/bash --disabled-password --gecos "" bob
|
|
echo "test mail" | sendmail bob@example.com
|
|
|
|
sleep 1
|
|
|
|
if [ -f /var/mail/bob ] ; then
|
|
if grep -q "BEGIN PGP MESSAGE" /var/mail/bob ; then
|
|
RESULT_CODE=0
|
|
else
|
|
echo "no encryption detected"
|
|
RESULT_CODE=1
|
|
fi
|
|
else
|
|
echo "no mail detected"
|
|
RESULT_CODE=1
|
|
fi
|
|
|
|
deluser --remove-home bob
|
|
|
|
exit $RESULT_CODE
|