Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: postfix help needed
PostPosted: Thu Mar 27, 2008 4:46 am 
Offline
Senior Newbie

Joined: Thu Mar 27, 2008 3:30 am
Posts: 7
Hi,

I am new to Linux so I hope to get some help setting up my mail server.

The host name of my linode is lixxx.members.linode.com and I am running Ubuntu 7.10. I installed postfix by "apt-get install postfix".

I am hosting multiple domains (e.g. foo.com and bar.com) I'd like to setup an email server so that I can send mails from user@foo.com and user@bar.com. I am basically following the tutorial at http://www.akadia.com/services/postfix_ ... boxes.html

My main.cf is as follows:
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = lixxx.members.linode.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = lixxx.members.linode.com, localhost.members.linode.com, , localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

#my own stuff
virtual_mailbox_domains = foo.com, bar.com
virtual_mailbox_base = /var/spool/mail

The content in /var/spool/mail:
root@lixxx:/var/spool/mail # ll
total 24
drwxr-sr-x 2 root mail 4096 Mar 27 01:26 foo.com
drwxr-sr-x 2 root mail 4096 Mar 27 01:26 bar.com


I also modified the DNS settings of my domains in my registrar:

A record foo.com (my linode's IP)
C record mail.foo.com (my linode's host name, i.e. lixxx.members.linode.com)
MX record lixxx.members.linode.com

After all this, when I send mails to user@foo.com I got all of them bounced back. The error message was like:
<user@foo.com>: unknown user: "user@foo.com"
Reporting-MTA: dns; lixxx.members.linode.com
X-Postfix-Queue-ID: F0889C8C6
X-Postfix-Sender: rfc822; jamesl@yahoo.ca
Arrival-Date: Thu, 27 Mar 2008 04:47:54 -0400 (EDT)


What have I done wrong? Is it a file permission problem since the mail folders belong to root? Do I need a client besides postfix to read mail? Any help is much appreciated!


Top
   
 Post subject:
PostPosted: Thu Mar 27, 2008 5:54 am 
Offline
Senior Member
User avatar

Joined: Fri Oct 24, 2003 3:51 pm
Posts: 965
Location: Netherlands
You don't seem to have virtual_mailbox_maps implemented. This maps user@domain.tld to /var/spool/domain/user_mailbox.

_________________
/ Peter


Top
   
 Post subject:
PostPosted: Thu Mar 27, 2008 3:49 pm 
Offline
Junior Member

Joined: Sun Dec 02, 2007 1:17 am
Posts: 27
Website: http://www.nabber.org
You might also want to look at virtual_alias_maps. This is similar to a normal /etc/aliases file and allows you to deliver the mail to a local user as usual, or forward:

postmaster@foo.com root
user@bar.com localuser
forward@bar.com user@someother.com

This way you can read your mail any way you normally would on that system.


Top
   
 Post subject:
PostPosted: Thu Mar 27, 2008 5:06 pm 
Offline
Senior Newbie

Joined: Thu Mar 27, 2008 3:30 am
Posts: 7
pclissold wrote:
You don't seem to have virtual_mailbox_maps implemented. This maps user@domain.tld to /var/spool/domain/user_mailbox.



Thank you very much pclissold! It's right on! I created the virtual_mailbox_maps text file but forget to linked to it in the main.cf. I should mentioned that postfix expects a .db file so I convert the text file to .db using the postmap command.

After that, I created a "vmail" user with uid and gid = 5000 and add the following lines to the main.cf file:
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

I also changed the mailbox folders to be owned by the "vmail" user. Now things seem to work. I grep the mail files and can see the incoming emails as text. What I really want to do is to access my mails from the web. Any recommendations on the software I should use? One thing I still can't wrap my head around is that, since my mails are owned by the vmail user which doesn't have login password/previlege, how are my mails password protected when I access them from the Web?

Thanks again!
James


Top
   
 Post subject:
PostPosted: Thu Mar 27, 2008 5:07 pm 
Offline
Senior Newbie

Joined: Thu Mar 27, 2008 3:30 am
Posts: 7
nabber00 wrote:
You might also want to look at virtual_alias_maps. This is similar to a normal /etc/aliases file and allows you to deliver the mail to a local user as usual, or forward:

postmaster@foo.com root
user@bar.com localuser
forward@bar.com user@someother.com

This way you can read your mail any way you normally would on that system.


Thank you nabber00, I am going to look into this soon.


Top
   
 Post subject:
PostPosted: Thu Mar 27, 2008 5:29 pm 
Offline
Senior Member
User avatar

Joined: Fri Oct 24, 2003 3:51 pm
Posts: 965
Location: Netherlands
jamesl wrote:
What I really want to do is to access my mails from the web. Any recommendations on the software I should use?

I use SquirrelMail for my web mail. SquirrelMail needs an IMAP server - I use Dovecot, which also serves all my other IMAP and POP needs.

_________________
/ Peter


Top
   
 Post subject:
PostPosted: Thu Mar 27, 2008 10:03 pm 
Offline
Senior Member
User avatar

Joined: Mon Dec 10, 2007 4:30 pm
Posts: 341
Website: http://markwalling.org
and Dovecot also integrates back into Postfix to provide SASL (what Postfix uses to auth users trying to send mail) quite nicely


Top
   
 Post subject:
PostPosted: Thu Mar 27, 2008 10:42 pm 
Offline
Junior Member

Joined: Sun Dec 02, 2007 1:17 am
Posts: 27
Website: http://www.nabber.org
Quote:
I use SquirrelMail for my web mail. SquirrelMail needs an IMAP server - I use Dovecot, which also serves all my other IMAP and POP needs.

Quote:
and Dovecot also integrates back into Postfix to provide SASL (what Postfix uses to auth users trying to send mail) quite nicely


I use this same setup, works nicely.


Top
   
 Post subject:
PostPosted: Fri Mar 28, 2008 10:05 pm 
Offline
Senior Newbie

Joined: Tue Jan 08, 2008 12:01 pm
Posts: 7
pclissold wrote:
jamesl wrote:
What I really want to do is to access my mails from the web. Any recommendations on the software I should use?

I use SquirrelMail for my web mail. SquirrelMail needs an IMAP server - I use Dovecot, which also serves all my other IMAP and POP needs.


I use RoundCube mail and wu-imapd (with a patch I wrote to report spam/ham to spamassassin). RC's interface is far more modern/slicker than squirrel mail, although it's still lacking in terms of plugins.

You can use both webmail clients on the same server if you want to try things out. Just install them to different directories.


Top
   
 Post subject:
PostPosted: Fri Mar 28, 2008 11:29 pm 
Offline
Senior Newbie

Joined: Thu Mar 27, 2008 3:30 am
Posts: 7
I installed dovecot and squirrelmail yesterday and so far so good. I agree that RoundCube's interface is way better looking than squirrelmail's but it seems too new (2 year?) for me to trust it with my emails. Anyways, thank a lot folks. Your advice has been very helpful!


Top
   
 Post subject:
PostPosted: Wed Apr 02, 2008 6:04 am 
Offline
Junior Member

Joined: Fri Jun 02, 2006 10:02 am
Posts: 26
I've been using roundcube for some time and i don't think you should be put off because it is still young. It's a very nice system, and as it matures I am sure they will improve the plugin API and more people will write more useful plugins. (I'm thinking of creating one myself to integrate some basic functionality of postfixadmin into it.)

I certainly wouldn't worry about trusting it with your email because the stable release is very solid, and compared to squirrelmail the UI is a dream.

BTW, if you're hosting lots of domains and users, then a system like postfixadmin to store your virtual maps and aliases in a database would make life much easier for you. There are some good guides at howtoforge for setting it up. If you only have a few domains and mailboxes it's probably not worth it though.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group