Re: help with a procmailrc recipe
Mathias Bauer <[email protected]> Sat, 29 Nov 2014 12:01:25 +0100
| Newsgroups | gmane.mail.procmail |
|---|---|
| Message-ID | <[email protected]> |
Zhiliang,
* Zhiliang Hu schrieb am Sa, 29. Nov 2014, um 00:19 (-0600):
> For this "small" portion of mails, I wrote a recipe to send
> automated inquery mails to verify if a suspecious mail is from
> a human-being: if it gets a human reply to confirm, the saved
> mail gets further delivered; if the inquery mail gets bounced,
> the saved mail gets deleted. So far everything works fine
> except this last
> recipe to process bounce/delete:
>
> :0
> * ^FROM_DAEMON|^FROM_MAILER
you only need ^FROM_DAEMON because ^FROM_MAILER covers a subset
of ^FROM_DAEMON. See procmailrc(5) for details. So:
* ^FROM_DAEMON
> {
> :0 w:bb.lock
> * B ?? Subject: verify mail you sent: ([0-9\.]{15}[A-Z]{9})
> THEMATCH = $MATCH
>
> :0 a
> | rm -f /var/mail/QUARRENTEEN/$THEMATCH
First, there is no \/ in the condition line. So, nothing will be
found and MATCH is empty, or even worse, it contains some value
set previously.
Second, you are right: {<number>} does not work in procmail
regexps. See procmailrc(5) for details. You have to specify it
explicitly: [0-9][0-9][0-9][0-9][0-9]....
Third, you can combine things this way (example with a simple
token regexp):
:0 w:bb.lock
* B ?? ^Subject: verify mail you sent: \/[0-9]+$
|echo "rm -f /var/mail/QUARRENTEEN/$MATCH" >>$HOME/somefile
But, do you *really* want to do this automatic deletion? This
will become very dangerous: What will happen if MATCH contains
something like "../../../home/you/somefile"?
You have to take care about your tokens and filter them very
strictly. I cannot emphasize this enough: the more you allow for
your tokens, the more dangerous and fragile your solution will
become. Please note that your solution is widely open for all
kinds of (shell) attacks!
Your suggested token regexp ([0-9\.]{15}[A-Z]{9}) resembles much
like some Message-ID value. If it is, do not use them! You
cannot control it.
You see, things get complicated very fast :-)
Kind regards,
Mathias
--
CAcert Assurer - See http://www.CAcert.org for details or ask me
GnuPG/OpenPGP: B100 5DC4 9686 BE64 87E9 0E22 44C3 983F A762 9DE8
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
[email protected]
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
signature.asc
(application/pgp-signature, 455 B)
-----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJUeaeFAAoJEAC+R9yZE+vYn8EIALvfY6e2eScyL/FZnfrk29Va fpSIpBQ3+MMOfXUOiyqd2R3+uv4WjhUN14zv+sKJJ2GCd1K9Z7STv28dWwlczbpf 88YE1l1QQsSob6aTWNFzpaWjcYWoee0pq5Wv6vSxiq0UUsDdLFzB8TbJGDa51GCA RruSiEPhody15sKDQKPD2gH6D85vkQPAvuXtWgaVt65ESi1n10SFfq3kmOfTciRT gfphUkBJJUxro7jMchjOfwXIGW30oOMPEDn58pmG03z4uVWvy+wiTkz/kIyqQHJ4 onvpyUXGXoD9LeIzLSf7ZvuIcAmMlTLw9ttxnv/yCn98cb/kBup1aYFJVidzJk8= =JsE/ -----END PGP SIGNATURE-----