Re: getmail configuration problem with "%(recipient)" and "%(local)" in [destination] MDA_external
Charles Cazabon <[email protected]>
| Newsgroups | gmane.mail.getmail.user |
|---|---|
| Message-ID | <[email protected]> |
Martin Gregorie <[email protected]> wrote: > > Now, however, I want to direct incoming mail for the 'landout' user to a > local user on the system that is running getmail. So, I modified the > configuration by replacing "kiwi" in the [destination] MDA_external > arguments, first with "(%recipient)" and, when that failed to deliver > any incoming mail, I changed "%(recipient)" to "%(local)". This too > failed to work. So, I set "[options] verbose = 2" and got an error > report (attached as "error_report.txt"). As far as I can tell from > reading the configuration section of the manual, both versions should > work, but don't. You missed the part about those substitution variables: If the message is retrieved with a multidrop retriever class, the message recipient (and parts of it) are also available with the following replacement substrings: [... (local), (recipient), etc...] Those substitutions don't exist if you don't use a multidrop retriever class. Note that such classes require your account to actually *be* a proper multidrop/domain mailbox. See the FAQ for more on this. > In case you're wondering, /usr/local/bin/postfixfilter is a locally > written shell script. It passes each received message through > Spamassassin, quarantines spam and uses the Postfix version of sendmail > to pass ham to my local Postfix MTA for delivery in my LAN via Dovecot. > The script expects four arguments in the order shown and has been > working well until I changed getmailrc as I described. OT but probably needs looking at: within that script you appear to be constructing a shell command to pass to something else: > SimplePOP3Retriever:[email protected]@shcp17.hosting.zen.net.uk:110: > command MDA_external postfixfilter (allow_root_commands="True", arguments="('-f', '%(sender)', '--', '%(local)')", command="postfixfilter", group="None", ignore_stderr="True", path="/usr/local/bin/postfixfilter", unixfrom="False", user="None"): sh: -c: line 0: syntax error near unexpected token `(' See the embedded shell command complaining about the string you're passing to the -c option? That's probably *very* bad. If you're doing passing any of the values getmail extracts from the message or metadata into this script, and that script then puts it in a string it passes to a shell, you're probably opening yourself up to a remote exploit. > - should my requirement be rewritten as two getmail configuration > files, one to filter off messages for 'landout' and the rest for > delivery to 'kiwi'? You're not going to be able to do this unless you have a multidrop/domain mailbox and change your retriever config. If you want to filter based on the To:, cc:, etc fields, use a MultiGuesser destination, which can then handle landout and the rest differently. Or you can always use a filtering MDA. Charles -- ----------------------------------------------------------------------- Charles Cazabon GPL'ed software available at: http://pyropus.ca/software/ -----------------------------------------------------------------------