LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-26-2010, 10:13 AM   #1
voltron81
LQ Newbie
 
Registered: Sep 2009
Posts: 22

Rep: Reputation: 15
Need some help for postfix configuration (relay to different domains and more)


Hi to everybody.
I'm realizing a postfix mailserver following this howto: http://www.howtoforge.com/virtual-us...l-debian-lenny

Basically I want to hold all emails to be sent (I'll send them manually when I want), plus I want to relay all the emails to different smtp servers (depends of the email).

So, more or less the main.cf of postfix look like that (I'll post just the important parts):
Code:
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_received_header = yes
smtpd_tls_ask_ccert = yes
smtpd_tls_loglevel = 1

smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_tls_cert_file = /etc/postfix/smtpd.cert
smtp_tls_key_file = /etc/postfix/smtpd.key
smtp_use_tls = yes
smtp_tls_scert_verifydepth = 5
smtp_tls_loglevel = 1

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_type = cyrus
smtp_sasl_security_options = noanonymous

smtp_sasl_tls_security_options = $smtp_sasl_security_options
smtp_sasl_tls_verified_security_options = $smtp_sasl_security_options
smtp_tls_loglevel = 2

smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

relayhost =

virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /var/vmail

transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf

relay_domains =  mysql:/etc/postfix/mysql-virtual_relaydomains.cf

sender_dependent_relayhost_maps = hash:/etc/postfix/bysenderrelay


defer_transports = hold
default_transport = hold

proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains 

$relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks 

$virtual_mailbox_limit_maps
As users I've email from my main mailserver and emails from gmail, hotmail, yahoo, etc...
To relay emails to gmail(or every smtp server that require CA), I've created a CA (following this howto: http://www.marksanborn.net/linux/sen...tu-lts-server/).


The problems that I've are:
1) I've setup in bysenderrelay the relay policy dependent of the sender, and in the database mail_transport(used by mysql-virtual_transports.cf), I've write

all local emails, like that:
Code:
user1@domain.com	:
user2@domain2.com	:
I did't put the value:
Code:
*	smtp:[mail.domain.com]
because otherwise I was not able to use the feature sender_dependent_relayhost_maps (all the email not direct to an internal account will be relayed to mail.domain.com).
It's working fine for internal emails, but if I've as local email user@gmail.com and I want to send an email to another@gmail.com, postfix think that gmail is a local domain and he believe that another@gmail.com is a local email.


2) After the configuration of the CA, I'm able to relay correctly emails to gmail and hotmail, but not to yahoo (I know that yahoo is working even without SSL, but I want that postfix will work with all the servers)

3) about the mail queued(the ones that needs to be sent), there is a way to see the subject of them? With mailq I can not see it


I hope somebody can give me some suggestions...

Thanks
Michele

Last edited by voltron81; 01-27-2010 at 03:15 AM.
 
Old 01-27-2010, 05:33 AM   #2
voltron81
LQ Newbie
 
Registered: Sep 2009
Posts: 22

Original Poster
Rep: Reputation: 15
About the problem n.1, I guess the problem is in the tables mail_domains.

Basically in postfix I've:
Code:
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
and in that file there is this query:
Code:
SELECT domain AS virtual FROM mail_domains WHERE domain = '%s';
Now, in the table mail_domains I've the domain 'gmail.com', because I've some local email addresses with gmail.
So with 'gmail.com' in mail_domains, I can correctly send internal emails, but not to external gmail accounts.
If I remove 'gmail.com' from mail_domains, I'll send correctly emails to external gmail accounts, but no anymore to the internal gmail accounts...
What I'm doing wrong?

Thanks
Michele
 
Old 01-28-2010, 03:41 AM   #3
voltron81
LQ Newbie
 
Registered: Sep 2009
Posts: 22

Original Poster
Rep: Reputation: 15
As far as I can see, the idea to solve the point n.1 should be:
- since the nexthop destination is taken from relay_transport, sender_dependent_relayhost_maps and relayhost, I'll put the local emails as result of relay_domains (with relay_tranport=virtual) and the external emails in sender_dependent_relayhost_maps.

The problem is that the postfix variable %s is giving me the domain of the sender, not the complete email address... and I can not match what I want in the select of relay_domains.
I tried using also %u or %d, but nothing...

Any idea?

Thanks
Michele
 
Old 02-01-2010, 05:31 AM   #4
voltron81
LQ Newbie
 
Registered: Sep 2009
Posts: 22

Original Poster
Rep: Reputation: 15
nobody?
 
  


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
Setting up Postfix as outgoign mail relay for several domains/hosts koriban Linux - Server 1 10-06-2009 07:01 AM
Postfix relay trusted domains bulent Linux - Server 1 12-14-2008 08:42 AM
Postfix - relay domains noir911 Linux - Server 3 11-30-2008 10:38 PM
Postfix relay access denied multiple domains metalenkist Linux - Server 16 02-21-2008 02:43 PM
Postfix upgrade from 1.x to 2.0.19 can't relay to external domains issinflight Linux - Software 0 04-19-2004 10:42 PM

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

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