Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-29-2011, 08:28 AM
|
#1
|
LQ Newbie
Registered: May 2006
Posts: 15
Rep:
|
postfix address re-write
Hi,
I have a server which runs postfix. The same physical server is running web and mail services for several (3) domains, which I have reserved for future use (nothing serious or valuable, just freetime activities).
Server "physical" address (also static IP) is myhost.domain.com. Lets say the other domains it serves are first.fi, second.net ad third.com. I can receive mails OK sent to all of these, I have added those 3 "extra" domains to the mydestination line in main.cf.
Sending e-mails also works fine, but the sender is user@myhost.domain.com.
I want the sender to be firstname@first.fi
I tried setting sender_canonical_maps = hash:/etc/postfix/sender_canonical in main.cf, and sender_canonical contains:
user1 Firstname1@first.fi
user2 Firstname2@first.fi
and I run postmap /etc/postfix/sender_canonical, and e-started postfix.
But if I send e-mail as user1, the sender becomes Firstname1@myhost.domain.com, so it re-writed the username part, but hot the hostname/domain part.
I also tried setting smtp_generic_maps = hash:/etc/postfix/generic but the results were similar.
What do I need to do to re-write sender for user1 (regardless of host/domain) to Firstname1@first.fi?
-Paavo
|
|
|
03-30-2011, 11:12 AM
|
#2
|
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625
Rep: 
|
why don't you just set the sender address in the client?
|
|
|
03-31-2011, 05:35 AM
|
#3
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
Can you check what was replaced when by lokking at the various logfiles of postfix? For me it's working, but I'm using a regexp instead of a hash.
|
|
|
03-31-2011, 07:40 AM
|
#4
|
Senior Member
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125
|
I would look here: http://www.postfix.org/ADDRESS_REWRITING_README.html. The top part of the page says that you can rewrite the host and domain, and I assume that the article discusses how.
|
|
|
03-31-2011, 03:32 PM
|
#5
|
LQ Newbie
Registered: May 2006
Posts: 15
Original Poster
Rep:
|
Quote:
Originally Posted by Berhanie
why don't you just set the sender address in the client?
|
But I have tried this... somewhat.
This might not be an postfix problem, since outlook sends mails with Firstname1@first.fi as sender,
outlook configuration is Name = "Firstname Familyname" and E-mail-address = "Firstname1@first.fi".
So outlook works just like it should
BUT, if the client is SquirrelMail, and Optios -> Personal Information Full Name is empty and
also E-mail Address is empty, the "final" sender is user1@myhost.domain.com (like it should be);
SM uses user1@localhost as sender, but it gets "translated" to user1@myhost.domain.com somewhere.
If I configure SM Full Name = "Firstname Familyname" and E-mail-address = "Firstname1@first.fi",
then the final sender becomes Firstname1@myhost.domain.com. Relevat part of /var/log/maillog:
Quote:
Mar 31 23:20:50 myhost sendmail[17580]: xxx: Authentication-Warning: myhost.domain.com: apache set sender to Firstname1@first.fi using -f
Mar 31 23:20:51 myhost sendmail[17580]: xxx: from=Firstname1@first.fi, size=538, class=0, nrcpts=1, msgid=<aaa.squirrel@myhost.domain.com>, relay=apache@localhost
Mar 31 23:20:51 myhost postfix/smtpd[17581]: connect from myhost.domain.com[127.0.0.1]
Mar 31 23:20:51 myhost sendmail[17580]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Mar 31 23:20:51 myhost postfix/smtpd[17581]: yyy: client=myhost.domain.com[127.0.0.1]
Mar 31 23:20:51 myhost postfix/cleanup[17585]: yyy: message-id=<aaa.squirrel@myhost.domain.com>
Mar 31 23:20:51 myhost sendmail[17580]: zzz: to=someone@testmail.com, delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30538, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as bbb)
Mar 31 23:20:51 myhost postfix/qmgr[17573]: bbb: from=<Firstname1@myhost.domain.com>, size=993, nrcpt=1 (queue active)
Mar 31 23:20:51 myhost postfix/smtpd[17581]: warning: network_biopair_interop: error reading 5 bytes from the network: Connection reset by peer
Mar 31 23:20:51 myhost postfix/smtpd[17581]: disconnect from myhost.domain.com[127.0.0.1]
Mar 31 23:20:51 myhost postfix/smtp[17586]: bbb: to=<someone@testmail.com>, relay=mailsrv.someisp.fi[210.220.230.240]:25, delay=0.3, delays=0.13/0/0.11/0.06, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 808DA5D802D)
Mar 31 23:20:51 myhost postfix/qmgr[17573]: bbb: removed
|
So SM is using sendmail. Do I need to tell sendmail it's OK to send mails from first.fi domain?
-Paavo
Last edited by Paavo; 04-01-2011 at 12:51 AM.
|
|
|
03-31-2011, 04:07 PM
|
#6
|
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625
Rep: 
|
it's a little unusual, running both sendmail and postfix. what's the reason for that?
|
|
|
04-01-2011, 12:43 AM
|
#7
|
LQ Newbie
Registered: May 2006
Posts: 15
Original Poster
Rep:
|
Quote:
Originally Posted by Berhanie
it's a little unusual, running both sendmail and postfix. what's the reason for that?
|
I also have Dovecot IMAP server running in this, outlook uses that. Not sure if SM uses sendmail directly or via Dovecot?
-Paavo
|
|
|
04-01-2011, 12:46 AM
|
#8
|
LQ Newbie
Registered: May 2006
Posts: 15
Original Poster
Rep:
|
Hi,
here is received message header, when the message is sent from outlook:
Quote:
Return-Path: <Firstname1@first.fi>
X-Original-To: someone@testmail.com
Delivered-To: receiverrealusername@mailfront.someisp.fi
Received: from myhost.domain.com (unknown [110.120.130.140])
by mailfront.someisp.fi (Postfix) with ESMTP id xxx
for <someone@testmail.com>; Thu, 31 Mar 2011 hh:mm:ss +0300 (EEST)
Received: from myclient (myclient.wipsl.com [110.120.130.141])
by myhost.domain.com (Postfix) with ESMTPS id xxx
for <someone@testmail.com>; Thu, 31 Mar 2011 hh:mm:ss +0300 (EEST)
From: "Firstname Familyname" <Firstname1@first.fi>
To: <someone@testmail.com>
Subject: zzz
Date: Thu, 31 Mar 2011 hh:mm:ss +0300
Message-ID: xxx
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Acvv20bt7DJUdfmmSteBIOZZp8ksjw==
Content-Language: fi
x-cr-puzzleid: {bbb}
x-cr-hashedpuzzle: <<<very long line removed>>>
|
And here is received message header, when the message is sent from squirrelmail:
Quote:
Return-Path: <Firstname1@myhost.domain.com>
X-Original-To: someone@testmail.com
Delivered-To: receiverrealusername@mailfront.someisp.fi
Received: from myhost.domain.com (unknown [110.120.130.140])
by mailfront.someisp.fi (Postfix) with ESMTP id xxx
for <someone@testmail.com>; Thu, 31 Mar 2011 hh:mm:ss +0300 (EEST)
Received: from myhost.domain.com (myhost.domain.com [127.0.0.1])
by myhost.domain.com (Postfix) with ESMTPS id xxx
for <someone@testmail.com>; Thu, 31 Mar 2011 hh:mm:ss +0300 (EEST)
Received: (from apache@localhost)
by myhost.domain.com (8.14.4/8.14.4/Submit) id xxx;
Thu, 31 Mar 2011 hh:mm:ss +0300
X-Authentication-Warning: myhost.domain.com: apache set sender to Firstname1@first.fi using -f
Received: from 110.120.130.140
(SquirrelMail authenticated user user1)
by myhost.domain.com with HTTP;
Thu, 31 Mar 2011 hh:mm:ss +0300
Message-ID: xxx
Date: Thu, 31 Mar 2011 hh:mm:ss +0300
Subject: yyy
From: "Firstname Familyname" <Firstname1@myhost.domain.com>
To: someone@testmail.com
User-Agent: SquirrelMail/1.4.21-1.fc14
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
|
Not sure if these help, I need to take a closer look at SM configuration, and
maybe start from $useSendmail (now set to true, in /etc/squirrelmail/config.php).
-Paavo
Last edited by Paavo; 04-01-2011 at 12:52 AM.
|
|
|
04-01-2011, 02:16 AM
|
#9
|
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625
Rep: 
|
ah, ok, so it looks like squirrelmail is invoking sendmail's sendmail binary instead of postfix's sendmail binary.
my squirrelmail config is this:
Code:
$useSendmail = true;
$sendmail_path = '/usr/sbin/sendmail';
$sendmail_args = '-i -t';
note the line in bold. i don't have any sendmail packages on my system, but the line refers to
postfix's "sendmail" program, which submits mail through the file system instead of through the
tcp/ip stack (via the smtp). since you have both postfix and sendmail installed, there's a confusion
when taking about "the sendmail" binary. you can set sendmail_path to the location of the
sendmail that came with postfix, e.g. "$sendmail_path = '/usr/sbin/sendmail.postfix'", but this is
not a general solution, because you'll have problems again when you use the "mailx" program, for
example.
to fix it once and for all, you can do one of two things:
1. uninstall all sendmail packages.
2. keep both sendmail and postfix packages around, but tell your system (using your distro's configuration
tools) that postfix is the mail server that you're using. the system will then do such things as associate
/usr/sbin/sendmail with postfix's version.
|
|
|
04-01-2011, 04:19 AM
|
#10
|
LQ Newbie
Registered: May 2006
Posts: 15
Original Poster
Rep:
|
Hi,
I configured SM to use smtp (had to disable smtp tls, since my SM is 1.4.x and does not support STARTTLS yet), and now the sender domain is OK, i.e. what is set in Optios -> Personal Information E-mail Address field.
I also need to check if I should completely remove sendmail. I'm more familiar with postfix, and therefore I have just used chkconfig to disable sendmail and enable postfix (after congifuring postfix properly).
So this was not a postfix problem, it works well with my original settings. Also dovecot is OK, the only change I did was configure squirrelmail to use smtp (direct conection to postfix) instead id sendmail (wrappers).
Thanks for everybody do contributed, this problem has been bothering me for some time, but it seems to be working now.
-Paavo
|
|
|
04-01-2011, 07:57 AM
|
#11
|
LQ Newbie
Registered: May 2006
Posts: 15
Original Poster
Rep:
|
Hi,
> I also need to check if I should completely remove sendmail
I have Fedora 14, and 'alternatives --config mta' and choose postfix instead of sendmail
did the trick, I don't see a need to remove sendmail packages.
-Paavo
Quote:
# alternatives --display mta
mta - status is manual.
link currently points to /usr/sbin/sendmail.postfix
/usr/sbin/sendmail.sendmail - priority 90
slave mta-pam: /etc/pam.d/smtp.sendmail
slave mta-mailq: /usr/bin/mailq.sendmail
slave mta-newaliases: /usr/bin/newaliases.sendmail
slave mta-rmail: /usr/bin/rmail.sendmail
slave mta-sendmail: /usr/lib/sendmail.sendmail
slave mta-mailqman: /usr/share/man/man1/mailq.sendmail.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
/usr/sbin/sendmail.postfix - priority 30
slave mta-pam: /etc/pam.d/smtp.postfix
slave mta-mailq: /usr/bin/mailq.postfix
slave mta-newaliases: /usr/bin/newaliases.postfix
slave mta-rmail: /usr/bin/rmail.postfix
slave mta-sendmail: /usr/lib/sendmail.postfix
slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
Current `best' version is /usr/sbin/sendmail.sendmail.
# exit
|
|
|
|
All times are GMT -5. The time now is 03:10 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|