On 2007-04-07, Nils Vogels wrote:
> I'm trying to get TMDA to behave differently on a per-keyword basis.
> 
> Specifically, I would like TMDA to accept gpg-signed messages to the
> "signed" keyword, and if not send out a specific template. How would I
> go about that in the config file?
> 
> Offcourse, accepting the "signed" part is easy:
> 
> pipe "/usr/local/bin/gpg -q" accept
 
  I don't think it's quite so easy as that.
  In particular, the above solution will only work for messages that have an 
'inline' signature.  The newer-style (and, at least according to the Mutt 
people, preferred) messages with a detached signature will be missed by this 
one.
  I've attached a perl script that I use for this purpose.

> But, how do I make this dependant on a certain keyword address, and
> how do I perform multiple actions on a single address?
 
  I'm not sure if there's a way to do this directly from within TMDA.  I'm 
sure someone more knowledgeable will jump in here if there is.
  If you're calling TMDA from procmail, then you could do something like:

:0
* to: REGEXP_FOR_YOUR_KEYWORD_ADDRESS
| tmda-filter -c CONFIG_FOR_KEYWORD

:0
| tmda-filter

  That would use a separate config file for general messages vs keyworded 
ones, which would let you specify different templates to send.
  
crh
#!/usr/bin/perl
# check_gpg - examine a message for a valid PGP signature
# by Corey Halpin <[EMAIL PROTECTED]>
# Expects the message on stdin.

use MIME::Parser;
use Mail::GnuPG;

# chdir to a temp
mkdir "/tmp/$$",0700;
chdir "/tmp/$$";

my $parser = new MIME::Parser;
$entity = $parser->parse(\*STDIN) or die "parse failed\n";
my $mg = new Mail::GnuPG();

$rc=1;
if( $mg->is_signed($entity) ){
  my ($code, $keyid, $email) = $mg->verify($entity);
  $rc = $code;
} elsif( $mg->is_encrypted($entity) ){
  $rc = 0;  # encrypted messages are assumed good.
}

# Delete the tempdir
`rm -rf /tmp/$$`;

exit $rc;

Attachment: pgpBxrAExikF1.pgp
Description: PGP signature

_____________________________________________
tmda-users mailing list (tmda-users@tmda.net)
http://tmda.net/lists/listinfo/tmda-users

Reply via email to