LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-13-2008, 03:36 AM   #1
mkiler
LQ Newbie
 
Registered: Nov 2007
Posts: 22

Rep: Reputation: 15
postfix + altermime = error with delivery


Hi
I have postfix. I need to add disclaimer to outgoing mail. I do that but some users have problem with delivery.

/etc/postfix/disclaimer

Code:
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
DOMAIN="test.pl"

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15

# Start processing.
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }

cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }

grep "From:" in.$$ | grep -i $DOMAIN > /dev/null
let R=$?

if [ $R -eq 0 ]; then
  /usr/bin/altermime --input=in.$$ \
                   --disclaimer=/etc/postfix/disclaimer.txt \
                   --disclaimer-html=/etc/postfix/disclaimer.txt \
                   --xheader="X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm" || \
                   { echo Message content rejected; exit $EX_UNAVAILABLE; }
fi

$SENDMAIL "$@" <in.$$

exit $?

/etc/postfix/

Code:
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
  -o content_filter=dfilt:
#submission inet n       -       n       -       -       smtpd
#  -o smtpd_enforce_tls=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps     inet  n       -       n       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#628      inet  n       -       n       -       -       qmqpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
        -o fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix  -       n       n       -       -       pipe
  flags=R user=cyrus argv=/usr/lib/cyrus/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
cyrus     unix  -       n       n       -       -       pipe
  flags=hu user=cyrus argv=/usr/lib/cyrus/deliver -e -r ${sender} -m ${extension} ${user}
# Cyrus with "virtdomains: yes"
# Also specify in main.cf: virtual_transport = virt-cyrus
virt-cyrus     unix  -       n       n       -       -       pipe
  flags=hu user=cyrus argv=/usr/lib/cyrus/deliver -e -r ${sender} -m ${recipient} ${user}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#
###############################AMAVIS SPAMASSASSIN######################
#
smtp-amavis     unix -          -       n       -       2       smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes

127.0.0.1:10025 inet n          -       n       -       -       smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_restriction_classes=
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o mynetworks=127.0.0.0/8
    -o strict_rfc821_envelopes=yes
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000

dfilt     unix    -       n       n       -       -       pipe
    flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}

When I send only test message it's ok, but users send jpg, doc etc as attachments and they have error:
(microsoft outlook 2003)

Code:
This is the mail system at host papa.test.pl.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<katarzynas@atlasestates.com>: service unavailable. Command output:
    /etc/postfix/disclaimer: line 29: 31384 Segmentation fault
    /usr/bin/altermime --input=in.$$
--disclaimer=/etc/postfix/disclaimer.txt
    --disclaimer-html=/etc/postfix/disclaimer.txt
    --xheader="X-Copyrighted-Material: Please visit
    http://www.company.com/privacy.htm" Message content rejected



Reporting-MTA: dns; papa.test.pl
X-Postfix-Queue-ID: 4CE3050830D
X-Postfix-Sender: rfc822; a.fuente@test.pl
Arrival-Date: Tue, 10 Jun 2008 09:14:40 +0200 (CEST)

Final-Recipient: rfc822; katarzynas@atlasestates.com
Original-Recipient: rfc822;katarzynas@atlasestates.com
Action: failed
Status: 5.3.0
Diagnostic-Code: x-unix; /etc/postfix/disclaimer: line 29: 31384 Segmentation
    fault      /usr/bin/altermime --input=in.$$
    --disclaimer=/etc/postfix/disclaimer.txt
    --disclaimer-html=/etc/postfix/disclaimer.txt
    --xheader="X-Copyrighted-Material: Please visit
    http://www.company.com/privacy.htm" Message content rejected
What is wrong?
 
Old 06-17-2008, 10:19 PM   #2
d3ckard
LQ Newbie
 
Registered: May 2007
Posts: 13

Rep: Reputation: 0
Guess 1:
/var/spool/filter directory not writable by user executing /etc/postfix/disclaimer script (writing to in.$$ fails, program doesn't handle it nicely and has segmentation fault). If this is the case chown nobody /var/spool/filter, or chmod 1777 /var/spool/filter and try again, watch files get created there or not


Guess 2:
Problems with piping mail through scripts specified in master.cf often have issues with:

1) ownership/permissions
2) once running, some action inside of the script fails for the executing user

So as a quick first guess (never tried dfilt), double check ownership or permissions for /etc/postfix/disclaimer - try chown nobody:mail /etc/postfix/disclaimer; chmod 0755 or 0750 /etc/postfix/disclaimer see if that fixes the problem.
 
Old 06-23-2008, 12:40 AM   #3
mkiler
LQ Newbie
 
Registered: Nov 2007
Posts: 22

Original Poster
Rep: Reputation: 15
Hi
I do chown and chmod. Now I need try client inf office, but now from my thunderbird something is wrong.
When I paste picture to email (not as attachment)disclaimer is:

Code:
Informacja o poufności: Ten e - mail może zawierać wiadomości poufne lub prawne, które są przeznaczone tylko i wyłącznie dla odbiorcy wyszczególnionego w nagłówku wiadomości. Jeżeli nie jesteś wskazanym adresatem, niniejszym informujemy, że jakiekolwiek ujawnienie, kopiowanie, lub poleganie na zawartości niniejszej wiadomości jest zabronione. Jeżeli otrzymałeś ten e - mail w wyniku błędu, proszę o poinformowanie o tym nadawcy pod numerem telefonu +48228864090, w celu umożliwienia prawidłowego doręczenia przez GRUPĘ GSZ, a następnie prosimy o skasowanie wiadomości w swojej skrzynce pocztowej. Dziękujemy. Confidentiality Notice: This e-mail transmission may contain confidential or legally privileged information that is intended only for the individual or entity named in the e-mail address. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or reliance upon the contents of this e-mail is strictly prohibited. If you have received this e-mail transmission in error, please reply to the sender at +48228864090, so that GRUPA GSZ can arrange for proper delivery, and then please delete the message from your inbox. Thank you.
Oryginal, that I need is:
Code:
Informacja o poufności: Ten e - mail może zawierać wiadomości poufne lub prawne, które są przeznaczone tylko i wyłącznie dla odbiorcy wyszczególnionego w nagłówku wiadomości. Jeżeli nie jesteś wskazanym adresatem, niniejszym informujemy, że jakiekolwiek ujawnienie, kopiowanie, lub poleganie na zawartości niniejszej wiadomości jest zabronione. Jeżeli otrzymałeś ten e - mail w wyniku błędu, proszę o poinformowanie o tym nadawcy pod numerem telefonu +48228864090, w celu umożliwienia prawidłowego doręczenia przez GRUPĘ GSZ, a następnie prosimy o skasowanie wiadomości w swojej skrzynce pocztowej. Dziękujemy.

Confidentiality Notice: This e-mail transmission may contain confidential or legally privileged information that is intended only for the individual or entity named in the e-mail address. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or reliance upon the contents of this e-mail is strictly prohibited. If you have received this e-mail transmission in error, please reply to the sender at +48228864090, so that GRUPA GSZ can arrange for proper delivery, and then please delete the message from your inbox. Thank you.
Error is they don't have any format, everything is in one line.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Postfix Delivery Failure carlosinfl Linux - Server 1 04-16-2008 10:57 AM
Postfix Maildir delivery. NaCo Linux - Server 3 02-01-2008 09:38 AM
Postfix and local delivery shawnbishop Linux - Software 20 10-28-2006 01:11 PM
Postfix and Altermime drumltd Linux - Software 8 08-24-2006 04:13 PM
postfix mail delivery berrance Linux - Networking 4 02-28-2005 06:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration