Greetings, Dave Dodd!
>> > My amavisd-new installation is using mysql for logging and reporting so I
>> > can
>> > use MailZu. My quarantine is currently working fine with plain files. I
>> > can
>> > release quarntined files via MailZu.
>>
>> > I would now like the quarantine to be in mbox file format.
>>
>> I can't help with your question, but I feel I should raise a flag for your
>> consideration.
>> If you store your whole quarantine in a single file, to release one message
>> and remove it from quarantine, you would need to rewrite whole file.
>> Each time.
>> Do you REALLY want to do it?
>>
>> > My understanding from the docs and experimenting is that $QUARANTINEDIR
>> > should
>> > be set to the mbox file name to achieve this.
>>
>> > The quarantine works as expected but when I try to release via MailZu I
>> > see the following in /var/log/maillog
>>
>> > Feb 24 12:29:58 ben amavis[49018]: (!!)policy_server FAILED: Unsafe
>> > filename
>> > '/var/amavis/quarantine/dgdmbox' at (eval 112) line 309, <GEN26> line 7.
>>
>> > After a bit of poking around I realized the regular expression that
>> > triggers
>> > the Unsafe message does not like a leading / .
>>
>> > If I set $QUARANTINEDIR to just a filename without path information where
>> > would amavisd think the file would be located ?
>>
>> > Does anyone have a working example of what to set $QUARANTINEDIR to to
>> > havei
>> > this new setup work successfully ?
> My description was not clear. I am trying to ultimately have an individual
> mbox format file for each qurantined item.
Oh, then our intentions may be quite similar, if not identical.
I'm looking for a solution to have a carbon copy of every message received by
postfix. I've tried to inject a script as an additional content filter on
receiving smtpd transport, but this didn't worked well. When I resubmit a
message through local pickup, bayesian analyser in SA suddenly refuse to work.
BCC maps are not quite working (i'm loosing about 15% of all messages in test
setup).
I'm now looking for a way to make AMaViS either submit an unmodified copy of
the message to the specified SMTP backend, or to call a script directly from
inside AMaViS and pass a message to it before any modifications.
The script I'm using is rather simple, it just delivering a message into
specified Maildir/ format folder. The advantage of Maildir is that it store
every message as a separate file, so it's quite easy to operate.
> Your English is certainly better than my Russian :-)
You all say that...
P.S.
I'm attaching a full version of my carbon copier script - the one that is
suitable to use as content-filter. But, again, be warned that if you inject it
before AMaViS, your SPAM filtering would break.
--
WBR,
Andrey Repin ([email protected]) 25.02.2014, <01:45>
Sorry for my terrible english...
#!/bin/bash
# ! # ! # ! # ! # ! # ! # ! #
# #
# DO NOT set -e #
# #
# ! # ! # ! # ! # ! # ! # ! #
# Username to deliver carbon copies to
USER=username
# Maildir root, MUST exist. MUST be in proper Maildir format.
# MUST end in `/'
MAILDIR=/home/$USER/Maildir/.Carbon/
# sendmail command.
# Don't change it, unless you are absolutely, totally sure.
# Do NOT, never EVER use "-t" here.
SENDMAIL="/usr/sbin/sendmail -G -i -f"
# We don't want to overwrite existing files.
set -C
##############################################################################
# Exit codes courtesy <sysexits.h>
# /* command line usage error */
EX_USAGE=64
# /* data format error */
EX_DATAERR=65
# /* cannot open input */
EX_NOINPUT=66
# /* addressee unknown */
EX_NOUSER=67
# /* host name unknown */
EX_NOHOST=68
# /* service unavailable */
EX_UNAVAILABLE=69
# /* internal software error */
EX_SOFTWARE=70
# /* system error (e.g., can't fork) */
EX_OSERR=71
# /* critical OS file missing */
EX_OSFILE=72
# /* can't create (user) output file */
EX_CANTCREAT=73
# /* input/output error */
EX_IOERR=74
# /* temp failure; user is invited to retry */
EX_TEMPFAIL=75
# /* remote error in protocol */
EX_PROTOCOL=76
# /* permission denied */
EX_NOPERM=77
# /* configuration error */
EX_CONFIG=78
# /* database access error */
EX_DB=79
test "${MAILDIR:${#MAILDIR}-1}" = "/" -a "$MAILDIR" -ef "${MAILDIR%/}" || {
echo \$MAILDIR is not configured >&2; exit $EX_USAGE; }
test -d "${MAILDIR}tmp" -a -w "${MAILDIR}tmp" -a -O "${MAILDIR}tmp" || { echo
\$MAILDIR is not configured >&2; exit $EX_USAGE; }
test -d "${MAILDIR}new" -a -w "${MAILDIR}new" -a -O "${MAILDIR}new" || { echo
\$MAILDIR is not configured >&2; exit $EX_USAGE; }
# Construct unique name following procedures in
http://cr.yp.to/proto/maildir.html
_SALT=R$(od -An -N 8 -t x8 < /dev/urandom | sed -e 's/[[:blank:]]//')P$$
MSG="${MAILDIR}tmp/$(date +%s).$_SALT.$(hostname)"
# Clean up when done or aborting.
trap "rm -f \"$MSG\"" 0 1 2 3 15
# Uncomment the next line to drop program arguments into message copy header.
# Keep in mind it is BAD idea to keep this line enabled, it may startle
SpamAssassin.
# Only ever enable it when you test your system setup, and disable it
immediately
# following successful configuration.
#DEBUG_HEADERS=yes
# Create a carbon copy of the message.
{
if [ "$DEBUG_HEADERS" ]; then
echo "X-Params: $*"
fi
cat
} > "$MSG" || { echo Error writing to \$MAILDIR >&2; exit $EX_CANTCREAT; }
# Deliver the message
{
$SENDMAIL "$@" < "$MSG"
mv -t "${MAILDIR}new" "$MSG"
} || { echo Error finishing submission >&2; exit $EX_TEMPFAIL; }
exit $?