Calling GPG from Perl from Procmail from...

Dave Wilson
Thu, 25 May 2000 13:59:41 +0100

Hi there,

I have a script that I would like to run on incoming email messages,
conditional on the GnuPG signature on each incoming message being verified.

At the moment I'm using procmail to run a perl script containing
the following:

($message contains the signed message read from STDIN; I write to ao
tmpfile because I need to be able to access the message after GnuPG
is finished with it. If there's a cleaner way, please feel free to

open( OUT , ">$tmpfile" ) or die "Couldn't open $tmpfile: $!";
print OUT $message;
close OUT;

$good = system "/usr/local/bin/gpg --verify $tmpfile --output /dev/null"  ;

As far as I can tell, GnuPG returns an exit code of zero iff the signature
was successfully verified. The rest of the script is conditional on
$good == 0. This works fine when I run it from the command line. However,
when run on an incoming message from Procmail, STDERR presents this:

gpg: Signature made Wed May 24 23:40:34 2000 IST using DSA key ID 4C290F7E
gpg: Good signature from "HEAnet WBC address <>"
gpg: cannot open /dev/tty: Device not configured

What is the correct way to invoke GnuPG from a script?

Many thanks,

-- --------------------------------------- +353-1-662-3412
 It is one thing to pray; it is another to pray to entities who might not only
 be listening, but who will search you out on the road and beat you across the
 head with sticks if you say something that offends them.       -- Neil Gaiman
 ------------------ For crypto key send a blank message to