View previous topic :: View next topic |
Author |
Message |
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Mon Aug 18, 2003 9:53 pm Post subject: Setting up a Mail Server |
|
|
Hello,
Sorry if this is a dupe, but I've searched and searched and it looks like everyone who talks about setting up mail servers talks about fetching mail from a POP3 server or something then ferrying it or storing it for machines on the LAN.
However, I don't want to fetch mail from another server - I want to BE that server.
When the people on my company's LAN use outlook or whatever to use mail.companyname.com as their "incoming" and "outgoing" server, I need to be that server.
This will be replacing the mail hosting service some other company does for us, so what information do I need from them?
Could anyone please point me in the right direction??
Thanks in advance,
--Richie, the Onion Avenger |
|
Back to top |
|
|
devon l33t
Joined: 23 Jun 2003 Posts: 943
|
Posted: Mon Aug 18, 2003 10:03 pm Post subject: |
|
|
I would check out the Virtual Mailhosting System Guide. You may not need everything in that Guide, but it will give you some direction. |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Mon Aug 18, 2003 10:31 pm Post subject: |
|
|
Thanks, I was scanning through it before, but I got really confused. Why do they call it "Virtual" mailhosting? It talks about using multiple domains and I think that's what it meant, but I only need to use one domain.
It looks like in postfix's config that I can specify Code: | myhostname = $host.domain.name
mydomain = $domain.name | Would this be where I would say mail.company.com ??
Thanks for the speedy reply,
--Richie, the Onion Avenger |
|
Back to top |
|
|
kashani Advocate
Joined: 02 Sep 2002 Posts: 2032 Location: San Francisco
|
Posted: Mon Aug 18, 2003 11:48 pm Post subject: |
|
|
If you just have one domain or are fine with one to one mapping of your domains (ie user@acme.com and user@acme.net go the same place) you can ignore the greater part of the Virtual Mail Guide. A general Postfix and Courier-IMAP install should get you most of what you want. In a corporate enviroment you might think about adding the following.
1. Cyrus SASL so people can send mail from anywhere if they can authenticate.
2. Some http based method to change passwords for the users to use.
3. Web mail
4. Some spam filtering.
The Virtual Guide convers 1 and 3. You're on your own for 3 and I'd recommend http://advosys.ca/papers/postfix-filtering.html for 4.
kashani _________________ Will personally fix your server in exchange for motorcycle related shop tools in good shape. |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 1:22 am Post subject: |
|
|
Ah, well I had a LOT of my confusion cleared up by a visit to http://computer.howstuffworks.com
After reading the articles on Web Servers, Email, and most especially the DNS servers, I feel much more enlightened and think that I now have the basic knowledge to follow the Virtual Mailhosting System Guide. Definitely a good read for anyone.
I'll update this post on my progress and problems, thank you very much for the help!
--Richie, the Onion Avenger |
|
Back to top |
|
|
uzik Apprentice
Joined: 17 Apr 2003 Posts: 257
|
Posted: Tue Aug 19, 2003 5:41 pm Post subject: |
|
|
There are a bunch of mail servers. I had a lot of security problems
with sendmail. I switched to postfix and had very good results.
much easier configuration and no security problems ( so far! ).
An outlook compatible (not pop3/smtp) is a different animal.
I understand a new program was recently released to replace
microsoft's email server software. I don't recall the name of
the software though, sorry. |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 7:51 pm Post subject: |
|
|
Quote: | An outlook compatible (not pop3/smtp) is a different animal. |
Our current mail server is either pop3 or imap, I think. I'm not using M$ Exchange if that's what you're refering to.
Well, I installed postfix and courier-imap and I can send and receive messages to myself on the local machine! Good start I think.
The mail server is connected to a LAN with all of our other workstations, which all connect to a router. I configured the router to forward port 25 (for smtp) and 110 (for pop3) directly to the mail server. Now to mail the mail server, (for right now) I'd shoot a mail to bob@123.456.789.100, right?
When the server is all ready, then I'd let the guy who manages the DNS servers know to change it so instead of pointing to mail.company.com, it'd point to the IP we get for the router, right? Then when someone emails, the router forwards it to the mail server because ports 25 and 110 get forwarded just to it, right?
This seems to all make sense to me. I'll keep on going through the Virtual Mailhosting doc and see what happens.
Thanks again for the help,
--Richie, the Onion Avenger |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 9:05 pm Post subject: |
|
|
Okay, I think all I want to install for now is postfix and courier-imap.
I can send messages to anywhere just peachy with postfix and mutt, but I cannot receive mail.
I tried root@my.ip.address.here but it was undeliverable.
Any suggestions? Which logs should I check?
Thanks,
--Richie, the Onion Avenger |
|
Back to top |
|
|
Liathus Apprentice
Joined: 21 Mar 2003 Posts: 163 Location: Fargo, ND
|
Posted: Tue Aug 19, 2003 9:09 pm Post subject: |
|
|
I woudl look at sendmail if you really want a configurable mail server. Contrary to popular belief sendmail is a very secure solution if you keep up on patches (just like any other server application).
We use sendmail as a mail server for our ISP, we have about 30-40 domain names that the 1 server hosts, about 1200 users.
It's true that sendmail can be a bear to get used to, but that can be greatly eased using something like webmin. In fact sendmail is very easy to use via webmin.
I have looked at postfix in the past but i feel it doesnt have the flexability that we require. |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 9:10 pm Post subject: |
|
|
Ok, I can telnet the router's WAN IP on ports 25 and 110 and it is indeed forwarded to the server. Perhaps I should double-check off-site (after all, the machine is sitting right next to me) but if I'm going out through our external IP, coming back in, connecting to a specific port, it should be okay.
Therefore it seems like emailing root@the.ip.i.use SHOULD work. Hardware-wise, it looks good. Therefore it's some configuration in the machine. What should I look at?
Thanks again,
--Richie, the Onion Avenger |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 9:15 pm Post subject: |
|
|
Thanks Liathus for the post. (Looks like I was one minute too slow making my reply )
However, it seems that the problem is not in the sending, but in the receiving. Unless sendmail can do that too.
Any other suggestions?
Thanks,
--Richie, the Onion Avenger |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 9:39 pm Post subject: |
|
|
Okay, I checked the /var/log/mail/current file, and it looks like the hotmail server I was sending the test message from was rejected. Here:
Code: |
Aug 19 15:25:04 [postfix/smtpd] connect from bay8-dav21.bay8.hotmail.com[64.4.26.125]
Aug 19 15:25:04 [postfix/smtpd] > bay8-dav21.bay8.hotmail.com[64.4.26.125]: 220 efs-server.company.com ESMTP Postfix
Aug 19 15:25:04 [postfix/smtpd] watchdog_pat: 0x808ebc0
Aug 19 15:25:04 [postfix/smtpd] < bay8-dav21.bay8.hotmail.com[64.4.26.125]: EHLO hotmail.com
Aug 19 15:25:04 [postfix/smtpd] > bay8-dav21.bay8.hotmail.com[64.4.26.125]: 250-efs-server.company.com
Aug 19 15:25:04 [postfix/smtpd] > bay8-dav21.bay8.hotmail.com[64.4.26.125]: 250-PIPELINING
Aug 19 15:25:04 [postfix/smtpd] > bay8-dav21.bay8.hotmail.com[64.4.26.125]: 250-SIZE 10240000
Aug 19 15:25:04 [postfix/smtpd] > bay8-dav21.bay8.hotmail.com[64.4.26.125]: 250-VRFY
Aug 19 15:25:04 [postfix/smtpd] > bay8-dav21.bay8.hotmail.com[64.4.26.125]: 250-ETRN
Aug 19 15:25:04 [postfix/smtpd] match_hostname: bay8-dav21.bay8.hotmail.com ~? 192.168.0.0/24
Aug 19 15:25:04 [postfix/smtpd] match_hostaddr: 64.4.26.125 ~? 192.168.0.0/24
Aug 19 15:25:04 [postfix/smtpd] match_hostname: bay8-dav21.bay8.hotmail.com ~? 127.0.0.0/8
Aug 19 15:25:04 [postfix/smtpd] match_hostaddr: 64.4.26.125 ~? 127.0.0.0/8
|
So this would be the mynetworks parameter in /etc/postfix/main.cf, right? |
|
Back to top |
|
|
fimblo Guru
Joined: 19 Feb 2003 Posts: 306 Location: European Union, Stockholm
|
Posted: Tue Aug 19, 2003 9:56 pm Post subject: |
|
|
just to clarify the dns and smtp part:
The outgoing mail server (smtp) gets a message from a client with a To: field saying that the email is to be sent to, say abc@domain.com.
The mail server asks its resolver (the dns server), for the MX post for domain.com. (if it doesnt find it it continues to lookup the A and CNAME)
The resolver does a recursive lookup (unless its cached), gets an ip number (1.2.3.4), which it returns to the smtp server as a reply.
Now the smtp server knows where to send the mail. It connects to 1.2.3.4 port 25, passes the message on, and disconnects.
hmm hope that helped... oh read rfc 2821 and 2822 if you want some more juicy details _________________ http://blahonga.yanson.org - little geekblog
http://blahona.yanson.org/howtos/livecd - yet another livecd howto |
|
Back to top |
|
|
fimblo Guru
Joined: 19 Feb 2003 Posts: 306 Location: European Union, Stockholm
|
Posted: Tue Aug 19, 2003 10:02 pm Post subject: |
|
|
Quote: | Therefore it seems like emailing root@the.ip.i.use SHOULD work. Hardware-wise, it looks good. Therefore it's some configuration in the machine. What should I look at?
|
um avoid using ip numbers to the right of the @. It might work, but its discouraged in the rfc, and both sendmail and postfix are quite rfc compliant.
but if you got it to work, well, thats another story. _________________ http://blahonga.yanson.org - little geekblog
http://blahona.yanson.org/howtos/livecd - yet another livecd howto |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 10:10 pm Post subject: |
|
|
Hmmmm, okay.
But I was temporarily doing root@123.456.789.012 because I wanted to make sure it was working before I tell the DNS guy to re-route mail.company.com to our router's external ip.
But it seems like it can connect....it just gets rejected or something. At least the server knows that hotmail is trying to connect to it.
Thanks for the replies,
--Richie, the Onion Avenger |
|
Back to top |
|
|
fimblo Guru
Joined: 19 Feb 2003 Posts: 306 Location: European Union, Stockholm
|
Posted: Tue Aug 19, 2003 11:09 pm Post subject: |
|
|
hi!
just got home, i realised what your problem could be. I think its two separate problems you have here.
1) you're testing using abc@1.2.3.4 (or something). I tested it (using postfix) and I didnt get a error message immediately either. (I tested by telnetting to localhost, port 25, and interfacing the postfix api directly)
but, afterwards I got an error sent to my From: address, saying that the domain name 1.2.3.4 could not be resolved. So i suggest you test sending email using either a local alias (localhost) or a FQDN.
2) the other problem is receiving email. try turning off courier-imap and just using postfix. telnet in to localhost and do the following:
Code: | fimblo@waoh:~> telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 waoh.pilsnet.sunet.se ESMTP Postfix
helo localhost
250 waoh.pilsnet.sunet.se
mail from: user@anything
250 Ok
rcpt to: user@domain.name
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: this is my subject
This is the message payload.
.
250 Ok: queued as AAD55C7DE3
quit
221 Bye
Connection closed by foreign host.
|
Assuming that
1) the address user@domain.name is real, and
2) you have told postfix in main.cf that relaying is ok from locahost,
this email should arrive safely.
Then at least we know that that sending part works...
/fimblo _________________ http://blahonga.yanson.org - little geekblog
http://blahona.yanson.org/howtos/livecd - yet another livecd howto |
|
Back to top |
|
|
fimblo Guru
Joined: 19 Feb 2003 Posts: 306 Location: European Union, Stockholm
|
Posted: Tue Aug 19, 2003 11:12 pm Post subject: |
|
|
oh sorry another thing- you dont need to reroute dns to send mail. only to receive mail.
I, like many others, have an MTA on my laptop so that I can always send mail, no matter where I am. I dont receive email on my MTA, I connect to my courier-imap service on my stationary computer.
heh hope this isnt confusing... Im going to bed now, good luck!!! _________________ http://blahonga.yanson.org - little geekblog
http://blahona.yanson.org/howtos/livecd - yet another livecd howto |
|
Back to top |
|
|
uzik Apprentice
Joined: 17 Apr 2003 Posts: 257
|
Posted: Tue Aug 19, 2003 11:14 pm Post subject: |
|
|
Before you turn it on make sure you have relaying disabled.
This is default on most servers now. This will prevent spammers
from using your machine to send email. |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Tue Aug 19, 2003 11:33 pm Post subject: |
|
|
Wow! Thanks for the last three replies, guys!
I'll test this tomorrow and give you the status. So if postfix sends AND receives, what exactly does courier-imap do??
I've only read the posts once, maybe if I read them again they'll make more sense, but I have to leave soon - it seems that I didn't make myself completely clear: I have no problems whatsoever sending mail from my new mail server. It's peachy. It's just receiving mail. If I send a mail from my hotmail account to root@123.123.123.123, it never gets delievered.
But when I return tomorrow, I'll read your posts more carefully - it's my bad either way (not reading them better or not explaining better).
Thanks again for the help - it looks promising!
--Richie, the Onion Avenger |
|
Back to top |
|
|
taskara Advocate
Joined: 10 Apr 2002 Posts: 3763 Location: Australia
|
Posted: Wed Aug 20, 2003 12:13 am Post subject: |
|
|
why don't you set up a temporary domain using dyndns.org
and then u can have a domain to test everything is working, then either stick with dyndns.org or get your dns guy you mentioned to make the changes.
dyndns.org works great just create an account (dynamic dns) and tell your router to update, (or log in to their webpage and tell them your new ip)
instantly resolving. _________________ Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer! |
|
Back to top |
|
|
Liathus Apprentice
Joined: 21 Mar 2003 Posts: 163 Location: Fargo, ND
|
Posted: Wed Aug 20, 2003 12:51 am Post subject: |
|
|
Just as a followup... Sendmail also sends and receives. It is a very common smtp server on the internet. |
|
Back to top |
|
|
splooge l33t
Joined: 30 Aug 2002 Posts: 636
|
Posted: Wed Aug 20, 2003 3:00 am Post subject: |
|
|
Have your DNS admin make a new dns entry, test.yourdomain.com, have him point it to the external IP of the router, and then send a message to you@test.yourdomain.com _________________ http://get.a.clue.de |
|
Back to top |
|
|
fimblo Guru
Joined: 19 Feb 2003 Posts: 306 Location: European Union, Stockholm
|
Posted: Wed Aug 20, 2003 8:21 am Post subject: |
|
|
Both sendmail and postfix (Mail transfer agents) send and receive mail, like liathus said. Your Q was What does courier-imap do?.
in example you send mail to abc@domain.com.
When you use your mua (pine, mutt) to send mail, what happens is that your mua connects to your mta, port 25 (or if they are on the same box you also can just use the command sendmail...anyway).
Your MTA rece9ives the email and relays it to the other MTA (which belongs to domain.com), after doing all the dns stuff I wrote about (above). This second MTA has an ip number which is described in the MX post in the dns tree.
Now we've got a fork:
1) user abc could ssh to the server, and check mail on the MTA server using pine or mutt or some other MUA.
2) you could install a program which allows users to fetch mail from the MTA to their workstations. there are two popular protocols used to do this: imap (Internet Message Access Protocol) and pop3 (Post Office Protocol v3) , and their secure cousins imaps and pop3s.
courier-imap is an implementation of imap.
hmm did that explain what courier-imap does? _________________ http://blahonga.yanson.org - little geekblog
http://blahona.yanson.org/howtos/livecd - yet another livecd howto |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Wed Aug 20, 2003 3:43 pm Post subject: |
|
|
Wow! So many posts over the night! Thanks again for all the help!
Let's see:
taskara - Wow! I didn't know that service was available! I'm setting up a temporary domain now so I can email without relying on an IP.
Liathus - Thanks for the followup. I wouldn't have guessed Sendmail receives from the name
<EDIT=I read your post too quickly >
splooge - Hmmm, that's a possibility. Thanks for the suggestion.
</EDIT>
fimblo - so courier-imap will provide the protocol for a client (mutt, outlook, etc) to get the mail from the MTA?
I'm going to keep on trying today when I have the times to do so.
Thanks again for all the help!
--Richie, the Onion Avenger |
|
Back to top |
|
|
Onion Avenger Apprentice
Joined: 23 Apr 2003 Posts: 164 Location: New England
|
Posted: Wed Aug 20, 2003 5:26 pm Post subject: |
|
|
Hmmm, when I email root@efs.mine.nu from my hotmail account, I still don't receive (courier-imap is disabled, postfix is enabled).
Here's some of my /var/log/mail/current:
Code: | Aug 20 11:17:18 [postfix/smtpd] connect from bay8-dav55.bay8.hotmail.com[64.4.26.63]
Aug 20 11:17:18 [postfix/smtpd] > bay8-dav55.bay8.hotmail.com[64.4.26.63]: 220 efs-server.emeraldforest.com ESMTP Postfix
Aug 20 11:17:18 [postfix/smtpd] watchdog_pat: 0x808ebc0
Aug 20 11:17:18 [postfix/smtpd] < bay8-dav55.bay8.hotmail.com[64.4.26.63]: EHLO hotmail.com
Aug 20 11:17:18 [postfix/smtpd] > bay8-dav55.bay8.hotmail.com[64.4.26.63]: 250-efs-server.emeraldforest.com
Aug 20 11:17:18 [postfix/smtpd] > bay8-dav55.bay8.hotmail.com[64.4.26.63]: 250-PIPELINING
Aug 20 11:17:18 [postfix/smtpd] > bay8-dav55.bay8.hotmail.com[64.4.26.63]: 250-SIZE 10240000
Aug 20 11:17:18 [postfix/smtpd] > bay8-dav55.bay8.hotmail.com[64.4.26.63]: 250-VRFY
Aug 20 11:17:18 [postfix/smtpd] > bay8-dav55.bay8.hotmail.com[64.4.26.63]: 250-ETRN
Aug 20 11:17:18 [postfix/smtpd] match_hostname: bay8-dav55.bay8.hotmail.com ~? 192.168.0.0/24
Aug 20 11:17:18 [postfix/smtpd] match_hostaddr: 64.4.26.63 ~? 192.168.0.0/24
Aug 20 11:17:18 [postfix/smtpd] match_hostname: bay8-dav55.bay8.hotmail.com ~? 127.0.0.0/8
Aug 20 11:17:18 [postfix/smtpd] match_hostaddr: 64.4.26.63 ~? 127.0.0.0/8
Aug 20 11:17:18 [postfix/smtpd] match_hostname: bay8-dav55.bay8.hotmail.com ~? 63.117.233.245/0
Aug 20 11:17:18 [postfix/smtpd] match_hostaddr: 64.4.26.63 ~? 63.117.233.245/0
Aug 20 11:17:18 [postfix/smtpd] fatal: bad net/mask pattern: 63.117.233.245/0
Aug 20 11:17:19 [postfix/master] warning: process /usr/lib/postfix/smtpd pid 2488 exit status 1
Aug 20 11:17:19 [postfix/master] warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Aug 20 11:18:19 [postfix/smtpd] match_string: mynetworks ~? debug_peer_list
Aug 20 11:18:19 [postfix/smtpd] match_string: mynetworks ~? fast_flush_domains
Aug 20 11:18:19 [postfix/smtpd] match_string: mynetworks ~? mynetworks
Aug 20 11:18:19 [postfix/smtpd] match_string: relay_domains ~? debug_peer_list
Aug 20 11:18:19 [postfix/smtpd] match_string: relay_domains ~? fast_flush_domains
Aug 20 11:18:19 [postfix/smtpd] match_string: relay_domains ~? mynetworks
Aug 20 11:18:19 [postfix/smtpd] match_string: relay_domains ~? permit_mx_backup_networks
Aug 20 11:18:19 [postfix/smtpd] match_string: relay_domains ~? qmqpd_authorized_clients
Aug 20 11:18:19 [postfix/smtpd] match_string: relay_domains ~? relay_domains
Aug 20 11:18:19 [postfix/smtpd] match_string: permit_mx_backup_networks ~? debug_peer_list
Aug 20 11:18:19 [postfix/smtpd] match_string: permit_mx_backup_networks ~? fast_flush_domains
Aug 20 11:18:19 [postfix/smtpd] match_string: permit_mx_backup_networks ~? mynetworks
Aug 20 11:18:19 [postfix/smtpd] match_string: permit_mx_backup_networks ~? permit_mx_backup_networks
|
Is this still a problem with the mynetworks setting in /etc/postfix/main.cf ?? |
|
Back to top |
|
|
|