Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 26th January 2010, 17:13
voltron81 voltron81 is offline
Senior Member
 
Join Date: Sep 2009
Posts: 292
Thanks: 1
Thanked 4 Times in 3 Posts
Default 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/send-mail-postfix-

through-gmails-smtp-on-a-ubuntu-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
Reply With Quote
Sponsored Links
  #2  
Old 27th January 2010, 12:32
voltron81 voltron81 is offline
Senior Member
 
Join Date: Sep 2009
Posts: 292
Thanks: 1
Thanked 4 Times in 3 Posts
Default

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
Reply With Quote
  #3  
Old 28th January 2010, 10:40
voltron81 voltron81 is offline
Senior Member
 
Join Date: Sep 2009
Posts: 292
Thanks: 1
Thanked 4 Times in 3 Posts
Default

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
Reply With Quote
  #4  
Old 1st February 2010, 12:30
voltron81 voltron81 is offline
Senior Member
 
Join Date: Sep 2009
Posts: 292
Thanks: 1
Thanked 4 Times in 3 Posts
 
Default

nobody?

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:42.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.