LinuxQuestions.org
Review your favorite Linux distribution.
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 05-20-2009, 06:32 AM   #1
mattclements
LQ Newbie
 
Registered: May 2009
Posts: 7

Rep: Reputation: 0
Postfix Transport Problem


Hello,
I have been setting up a new server (mail.domain.com) to redirect mail to server1.domain.com and server2.domain.com depending on the domain the mail is sent to. I.e.


MX Record to mail.domain.com
Mail sent to hello.com -----------------------------> mail.domain.com uses Transport DB to redirect hello.com to server2.domain.com where another SMTP Server exists.


postconf -n
Code:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = /etc/postfix/local-host-names
myhostname = mail.domain.com
mynetworks = <<-Outside Domain->>, 127.0.0.0
myorigin = $mydomain
recipient_delimiter = +
relayhost = hello.com
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 450
master.cf
Code:
smtp      inet    n     -       n       -       -       smtpd -o content_filter=spamassassin

......

spamassassin
          unix  -       n       n       -       -       pipe
   flags=Rq user=nobody argv=/var/spamassassin/filter.sh -oi -f ${sender} ${recipient}
filter.sh
Code:
#!/bin/sh

# filter.sh
#
# This script redirects mail flagged as spam to a separate account
# You must first create a user account named "spamvac" to hold the flagged mail

SENDMAIL="/usr/sbin/sendmail -i"
SPAMASSASSIN=/usr/bin/spamc
COMMAND="$SENDMAIL $@"
#If your SQL preferences set to "user"
USER=`echo $COMMAND | awk '{ print $NF }' | sed 's/@.*$//'`
#If your SQL preferences set to "user@domain"
#USER=`echo $COMMAND | awk '{ print $NF }'`

NEW_COMMAND=`echo $COMMAND | awk '{ $6 = "spamvac"; NF = 6; print }'`

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

umask 077

OUTPUT="`mktemp /tmp/mailfilter.XXXXXXXXXX`"

if [ "$?" != 0 ]; then
    /usr/bin/logger -s -p mail.warning -t filter "Unable to create temporary file."
    exit $EX_TEMPFAIL
fi

# Clean up when done or when aborting.
trap "rm -f $OUTPUT" EXIT TERM

$SPAMASSASSIN -x -E -u $USER > $OUTPUT
return="$?"
if [ "$return" = 1 ]; then
    $NEW_COMMAND < $OUTPUT
    exit $?
elif [ "$return" != 0 ]; then
    /usr/bin/logger -s -p mail.warning -t filter "Temporary SpamAssassin failure (spamc returned $return)"
    exit $EX_TEMPFAIL
fi

$SENDMAIL "$@" < $OUTPUT
exit $?

Error on Logfile when mail sent to user@hello.com
Code:
May 20 12:21:47 s15348938 postfix/smtpd[15898]: connect from queueout01-winn.ispmail.ntl.com[81.103.221.31]
May 20 12:21:47 s15348938 postfix/smtpd[15898]: NOQUEUE: reject: RCPT from queueout01-winn.ispmail.ntl.com[81.103.221.31]: 450 4.1.1 <user@hello.com>: Recipient address rejected: User unknown in loca$
May 20 12:21:47 s15348938 postfix/smtpd[15898]: disconnect from queueout01-winn.ispmail.ntl.com[81.103.221.31]
transport db
Code:
hello.com      smtp:server2.domain.com
Sorry there is a lot of code etc there.
Basically:
hello.com is the domain that should redirect
server1 & server2.domain.com are the servers that the mail should be redirected to
mail.domain.com is the redirecting server which I am having problems with (with SpamAssassin filter)

I seem to think that the mail arrives at mail.domain.com, and Postfix can't work out where to route the mail to.

Regards,
Matt
 
Old 05-20-2009, 09:44 AM   #2
mattclements
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
<<-Outside Domain->> is meant to say Outside IP - this is the external IP
 
Old 05-20-2009, 10:24 AM   #3
archangel_617b
Member
 
Registered: Sep 2003
Location: GMT -08:00
Distribution: Ubuntu, RHEL/CentOS, Fedora
Posts: 234

Rep: Reputation: 42
You have "relayhost" set to "hello.com", I think you may mean "relay_domains". The "relayhost" is for smarthosts.

- Arch
 
Old 05-20-2009, 12:44 PM   #4
mattclements
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Nope - Afraid still getting the problem.

Code:
450 4.1.1 <user@hello.com>: Recipient address rejected: User unknown in local recipient table;
I seem to think that the Postfix Configuation doesn't seem to look properly at the Transport DB?!


Cheers,
Matt
 
Old 05-20-2009, 01:14 PM   #5
archangel_617b
Member
 
Registered: Sep 2003
Location: GMT -08:00
Distribution: Ubuntu, RHEL/CentOS, Fedora
Posts: 234

Rep: Reputation: 42
Can you give a fresh postconf -n and the contents of "/etc/postfix/local-host-names"?

- Arch
 
Old 05-20-2009, 01:15 PM   #6
archangel_617b
Member
 
Registered: Sep 2003
Location: GMT -08:00
Distribution: Ubuntu, RHEL/CentOS, Fedora
Posts: 234

Rep: Reputation: 42
And just FYI, this is a great doc if you haven't read through it already:

http://www.postfix.org/BASIC_CONFIGURATION_README.html

- Arch
 
Old 05-20-2009, 02:12 PM   #7
mattclements
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Sorted thanks!
I just looked through the main.cf config file - as this server should never look at local mail users and thats all it seemed to be doing - and I came to this which worked!
Code:
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
local_recipient_maps =
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
myhostname = mail.domain.com
mynetworks = <<Outside IP>>, 127.0.0.0
recipient_delimiter = +
relay_domains = hello.com
relayhost =
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 450
 
  


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
Postfix Transport(5) Wheddod Linux - Software 5 10-20-2008 11:15 AM
Postfix and Transport.cf i56kfm Linux - Newbie 1 06-19-2008 01:33 PM
postfix mail transport problem ayush1440 Linux - Server 3 03-17-2008 05:45 AM
Postfix: slow transport? Chowroc Linux - Networking 0 02-04-2006 02:49 AM
HELP postfix transport error HELP Sammy2ooo Linux - Networking 1 08-26-2004 05:17 AM

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

All times are GMT -5. The time now is 04:27 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