You are not logged in.

#1 2014-02-04 03:34:01

vorpalblade
Member
Registered: 2013-11-07
Posts: 13

[Solved]Filtering PGP/GPG messages in Evolution

EDIT: I solved this with a bash script (see the below post, post #2)

I'm trying to set up Evolution so that it moves all messages signed or encrypted with PGP to the main "Inbox" folder and marks them as important. I can get most of the messages that I want with:

Specific Header >> X-Enigmail-Version >> Exists

which is definately the wrong approach, but works for the majority of people that I communicate with.

My other method was missing some messages (the X-Enigmail-Version got some of those).

<<Any of the Following Conditions>>
Specific Header >> Content-type >> contains >> encrypted
Specific Header >> Content-type >> contains >> signed
Specific Header >> Content-type >> contains >> pgp-keys
Message Body >> Contains >> -----BEGIN PGP MESSAGE----- 
Message Body >> Contains >> -----BEGIN PGP SIGNATURE-----

All of the messages have the -----BEGIN PGP MESSAGE|SIGNATURE----- in the message source (I was trying to get the "Message Body" option to filter all of them out; doesn't work that way).

Some of the messages could be filtered with:

Specific Header >> Content-type >> contains >> mixed

E.g., the message source contained:

Content-Type: multipart/mixed

I know that I could right a bash script to filter them, but I would prefer filters.
If I were to write a bash script, it would look something like this:

out=$(cat $message | grep "-----BEGIN PGP")
if [ -n $out ]
then
exit 10
else
exit -10
fi

What I have googled for:
filter PGP OR GPG messages evolution OR thunderbird

Useful links:
http://tools.ietf.org/html/rfc2015

EDIT: Known content types that I have encrypted/signed messages for:

text/plain # This one has me doubting.
multipart/mixed
multipart/encrypted
multipart/signed

The ones that have weird content types (text/plain) also don't have the protocol from the rfc.
Enigmail seems to be buggy (that's what most of the bad messages are coming from).

Last edited by vorpalblade (2014-02-04 14:38:32)

Offline

#2 2014-02-04 14:37:24

vorpalblade
Member
Registered: 2013-11-07
Posts: 13

Re: [Solved]Filtering PGP/GPG messages in Evolution

I ended up making a bash file.

#!/bin/bash
file="/tmp/message-$(date +%Y-%m-%d-%H_%M_%s)"
if [ -a $file ]
then
        rm -rf $file

fi
while read line
do
        echo "$line" >> $file

done
output=$(cat $file | grep -e "-----BEGIN PGP \(MESSAGE\|ENCRYPTION\|SIGNATURE\)-----")

if [ -n "$output" ]
then

        exit 1
elif [ -z "$output" ]
then

        exit -1
else

        exit 42
fi

Offline

Board footer

Powered by FluxBB