LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-25-2010, 06:59 PM   #1
crnz
LQ Newbie
 
Registered: Oct 2010
Location: NZ
Distribution: CentOS 7
Posts: 8

Rep: Reputation: 0
sendmail to postfix migration: struggling with config


Hi, I have a lightweight admin background, but good enough to set up most servers. I have switched from sendmail to postfix for the first time, but I keep going around in circles on the following...

In sendmail, I used to maintain a table (mailertable) where I would redirect email like this


Code:
user@hosteddomain1 smtp:user@gmail.com
user2@hosteddomain1 smtp:user2@yahoo.com
user3@hosteddomain1 local:james
user4@hosteddomain1 error:mailbox closed
hosteddomain1 smtp:someone@hotmail.com
I happily mapped any incoming email address of any valid hosted domain either to go out to it's final destination via smtp, or if the person has a local mailbox, it delivered locally. Any errors could be forced, and a catch-all for the domain could be directed also.

I've struggled with virtual hosts and transport and a combination of the two to come up with the same result for postfix. I have this feeling I'm missing something really simple, or I am not 'getting it' when I'm doing something postfixy and I still have sendmaily expectations...

Can someone please put me on the right path so I will at least know I'm pointing in the right direction and working with the right files to achieve my aims? Postfix is so amazingly powerful and flexible, I'm having trouble figuring this bit out.

I have this feeling I just need a calm hand on my shoulder, a friendly smile and a hand pointing me the right way....

Many thanks.
 
Old 10-25-2010, 07:18 PM   #2
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
Have you tried this document?

http://www.postfix.org/VIRTUAL_READM...irtual_mailbox

Are you using Linux accounts for your users or are you storing them in a database like LDAP?


Please post the output of
postconf -n

Last edited by jamrock; 10-25-2010 at 07:31 PM.
 
Old 10-25-2010, 07:49 PM   #3
crnz
LQ Newbie
 
Registered: Oct 2010
Location: NZ
Distribution: CentOS 7
Posts: 8

Original Poster
Rep: Reputation: 0
Hi.

I have some local accounts, and about 50 hosted domain names of which some addresses deliver locally, but most addresses get fowarded to other email addresses like gmail or hotmail accounts. Most catchalls trigger a "no such mailbox" error.

I have the O'Reilly Postfix book. I have read all the postfix readme documents, but they are not sinking in. Probably because I have such a hybrid requirement of wanting to do everything at once. That, and doing things by rote for the last 15 years with sendmail has made my brain go soft...

Code:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = secret.co.nz
myhostname = email.secret.co.nz
mynetworks = 127.0.0.0/8
mynetworks_style = host
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
relay_domains = $mydestination, secret1.co.nz, secret2.co.nz, secret3.co.nz, [...snip...] secret50.co.nz
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
 
Old 10-25-2010, 09:10 PM   #4
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
Quote:
Probably because I have such a hybrid requirement of wanting to do everything at once.
Hmmm...

This is more common than you would believe. The best approach is to get the basics working and then add layers of complexity one by one.

Can you send mail to and receive mail from your main domain? The one listed in mydestination? It would really be best to get that working properly before setting up virtual domains.

Quote:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = secret.co.nz
myhostname = email.secret.co.nz
Note that your mydestination command will pull these values from the fully qualified hostname of your server. The other lines are redundant.

http://www.postfix.org/BASIC_CONFIGURATION_README.html
 
Old 10-25-2010, 11:01 PM   #5
crnz
LQ Newbie
 
Registered: Oct 2010
Location: NZ
Distribution: CentOS 7
Posts: 8

Original Poster
Rep: Reputation: 0
All good advice.

Which is exactly what I have been doing. Getting things going bit by bit.

Yes, it's sending mail to the world.

Yes, it's accepting mail for the local users and for domains on the relay list.

The current bit I'm having to do is what my question is about.

Once that's going I'm probably going to look at TLS/SSL and other tougher issues.

But this is the small step I am trying to make now
 
Old 10-26-2010, 06:06 AM   #6
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
http://www.postfix.org/VIRTUAL_READM...irtual_mailbox

Quote:
With virtual alias domains, each hosted address is aliased to a local UNIX system account or to a remote address. The example below shows how to use this mechanism for the example.com domain.

1 /etc/postfix/main.cf:
2 virtual_alias_domains = example.com ...other hosted domains...
3 virtual_alias_maps = hash:/etc/postfix/virtual
4
5 /etc/postfix/virtual:
6 postmaster@example.com postmaster
7 info@example.com joe
8 sales@example.com jane
9 # Uncomment entry below to implement a catch-all address
10 # @example.com jim
11 ...virtual aliases for more domains...
You need to add two lines to your /etc/postfix/main.cf. The first line tells Postfix the list of virtual domains.

Quote:
virtual_alias_domains = example.com ...other hosted domains...
The second line tells Postfix where to find the list of email addresses that need to be mapped to other accounts. The accounts can be local accounts or remote email addresses.

Quote:
virtual_alias_maps = hash:/etc/postfix/virtual
Note that if you are mapping a virtual address to a local account you should use the Linux account and not the email address.

Make sure to use the postmap command when you have created the mappings. If your list is stored in a file called /etc/postfix/virtual you should type

postmap /etc/postfix/virtual

Then reload Postfix so it recognizes the changes.

postfix reload

Quote:
Note: virtual aliases can resolve to a local address or to a remote address, or both. They don't have to resolve to UNIX system accounts on your machine.
 
Old 10-26-2010, 01:40 PM   #7
crnz
LQ Newbie
 
Registered: Oct 2010
Location: NZ
Distribution: CentOS 7
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Note: virtual aliases can resolve to a local address or to a remote address, or both. They don't have to resolve to UNIX system accounts on your machine.
Oh my. That's the bit I've been missing because the examples don't show it. I've been looking at the examples to take my lead.

I am SO thankful.

Tested it, and it is, of course, working fine.

Thank your for your patience. You've been great.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Dovecot/Postfix migration pa.martin Linux - Server 4 02-26-2010 05:08 PM
Postfix/Dovecot migration kapaneus Linux - Software 1 08-14-2008 02:56 PM
Migration to postfix/sendmail/qmail Ammad Linux - Networking 1 05-20-2006 06:28 AM
Postfix/Sendmail GUI Config? dsschanze Linux - Networking 1 04-05-2005 10:43 PM

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

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