LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-06-2009, 08:54 AM   #1
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 50
Help setting up a mail server


I am creating a website using Ruby on Rails and I have come to the point where I am adding support for account recovery.

Using my gmail account did not work out since there was too much trouble getting the TLS stuff to work. So now I want to set up my own smtp server.

Here's the thing: it should be dead simple. I just want to use it for this webserver, no one else should be able to use it, I don't want anti-spam/virus stuff. I don't want some webbased email client. No pop, no imap. Just a dead simple way to send mails out from my server. I am running Debian Lenny, btw.

Please, help me. I am trying to Google for an answer but this is killing me. All the guides out there are just too darn complex. And they want me to install and configure a ton of packages.

Thanks,
 
Old 04-06-2009, 03:14 PM   #2
irishbitte
Senior Member
 
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 88
Is it an ubuntu box? This link is probably the most straight forward:http://flurdy.com/docs/postfix/ Now, it looks like a lot of work, but to be honest if you follow this, it's straightforward, and should only take about an hour, maybe less if you don't get into the detail. The sticking point for most people is the DNS and MX records, but if it's only for sending out mails, such as logs and such, this should not be an issue for you. I would still throw in the antivirus stuff for sure, just to be on the safe side.
 
Old 04-06-2009, 03:40 PM   #3
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by irishbitte View Post
Is it an ubuntu box?
No, Debian Lenny

Quote:
Originally Posted by irishbitte View Post
The sticking point for most people is the DNS and MX records
Luckily my DNS is handled by GoDaddy.com and besides, I do not need to handle incoming mails, just wanna send them out from my server.

Quote:
Originally Posted by irishbitte View Post
I would still throw in the antivirus stuff for sure, just to be on the safe side.
Why should I have anti-virus when the only mails that will go through the server are those for "account recovery" and "account confirmation"? I just don't see the point. Besides I will probably block all traffic to the smtp server from anything but localhost anyway. Just to prevent it from being a spam relay.
 
Old 04-07-2009, 03:42 PM   #4
irishbitte
Senior Member
 
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 88
Ok, that guide should also work with a Debian box.
Quote:
Luckily my DNS is handled by GoDaddy.com and besides, I do not need to handle incoming mails, just wanna send them out from my server.
I understand that you do not need to handle your own DNS global records, but the mail server will need to be configured to have a DNS name of some sort, or you will have unusual issues with mail not being received by recipients and so forth. So you will have to do some DNS configuration.
Quote:
Why should I have anti-virus when the only mails that will go through the server are those for "account recovery" and "account confirmation"?
The fact that you will not need to handle incoming mails, does not mean you should not have antivirus, since you do not want your reputable website to become the latest link in the chain of some script kiddy. And yes, I did read your last line:
Quote:
Just to prevent it from being a spam relay.
Besides all that, did you look through what is posted on that link? It really is quite comprehensive, and as I said in my earlier post, it does not take long to set up. Let me know how you get on.
 
Old 04-07-2009, 04:09 PM   #5
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Install postfix and during setup when prompted for the type choose "internet site"

aptitude update
aptitude install postfix

choose internet site when prompted

at that point it should be ready to send mail from your website. no further configuration should be necessary for basic operation.

There would be no domain info in the mydomains option in the postfix config so it should not accept mail for a specific domain, this is the default setting

the mynetworks option will be 127.0.0.1 so it won't relay mail from outside, it will only relay mail from the web host.

You are not receiving mail so I don't believe MX records would even be necessary for your web server. although without MX records many mail servers would reject mail from you. you could always configure postfix to use a relayhost (GoDaddys SMTP server for your domain) to avoid that issue.

There should be no need for anti-spam or anti-virus for this setup since it will not accept any mail to begin with.
 
Old 04-08-2009, 03:38 AM   #6
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Original Poster
Rep: Reputation: 50
Thumbs up

Quote:
Originally Posted by farslayer View Post
Install postfix and during setup when prompted for the type choose "internet site"

aptitude update
aptitude install postfix

choose internet site when prompted
Got it! Is there a way I can verify that postfix is working? A command line to send a test mail or something?

Are there any accounts created or do I need to setup them manually?
The smtp settings in Ruby on Rails looks like this if I am correct (not sure since I haven't got it working yet):
Code:
ActionMailer::Base.smtp_settings =
{
   :address => "localhost",
   :port => 25,
   :domain => "jovianvoid.com",
   :authentication => :login, # <- or :plain, not sure what the difference is
   :user_name => "myaccount",
   :password => "secretpass"
}
Quote:
Originally Posted by farslayer View Post
There would be no domain info in the mydomains option in the postfix config so it should not accept mail for a specific domain, this is the default setting
I am not following you here. "[..] accepting mail for a specific domain"?

Quote:
Originally Posted by farslayer View Post
the mynetworks option will be 127.0.0.1 so it won't relay mail from outside, it will only relay mail from the web host.
Exactly what I want!

Quote:
Originally Posted by farslayer View Post
You are not receiving mail so I don't believe MX records would even be necessary for your web server. although without MX records many mail servers would reject mail from you. you could always configure postfix to use a relayhost (GoDaddys SMTP server for your domain) to avoid that issue.
Here's my MX records:

$ host jovianvoid.com
jovianvoid.com has address 70.38.31.21
jovianvoid.com mail is handled by 0 smtp.secureserver.net.
jovianvoid.com mail is handled by 10 mailstore1.secureserver.net.


Is this something I should change or can I just leave it there? Not sure how changes to the MX record would impact the webmail at GoDaddy.

Quote:
Originally Posted by farslayer View Post
There should be no need for anti-spam or anti-virus for this setup since it will not accept any mail to begin with.
I was hoping that would be the case. Just didn't know if I would risk being blacklisted if I skipped scanning my own outgoing mails from the webserver, something that seems totally unnecessary IMO.
 
Old 04-08-2009, 08:45 AM   #7
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
http://www.postfix.org/BASIC_CONFIGURATION_README.html
http://www.postfix.org/postconf.5.html

My mistake myhostname and mydomain should be filled out.. it's mydestination you should leave as default.
Nope I don't configure these every day.. so mind is a bit rusty

No there are no user accounts, since you are only looking to send mail.. you could configure accounts and secure login if you wanted, but I don't think there really is a need since it's all local to the machine.

Then if you will probably want to configure the relayhost settings
Code:
  What delivery method: direct or indirect

By default, Postfix tries to deliver mail directly to the Internet. Depending on your 
local conditions this may not be possible or desirable. For example, your system may 
be turned off outside office hours, it may be behind a firewall, or it may be connected 
via a provider who does not allow direct mail to the Internet. In those cases you 
need to configure Postfix to deliver mail indirectly via a relay host.

Examples (specify only one of the following):

    /etc/postfix/main.cf:
        relayhost =                   (default: direct delivery to Internet)
        relayhost = $mydomain         (deliver via local mailhub)
        relayhost = [mail.$mydomain]  (deliver via local mailhub)
        relayhost = [mail.isp.tld]    (deliver via provider mailhub)

The weak spot for SPAMMING from a website is usually caused by bad code on the website itself that is vulnerable. So overall site security is what you need to focus on. If they can exploit a portion of the site to drop code onto your server, or get hte code on your server to work for them, that's when the spamming usually occurs.

Last edited by farslayer; 04-08-2009 at 08:46 AM.
 
Old 04-08-2009, 09:07 AM   #8
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by farslayer View Post
No there are no user accounts, since you are only looking to send mail.. you could configure accounts and secure login if you wanted, but I don't think there really is a need since it's all local to the machine.
So if I do not need accounts, what credentials should I send to the server from the website? Or maybe I don't even need to fill out login/password to send mails?


Quote:
Originally Posted by farslayer View Post
The weak spot for SPAMMING from a website is usually caused by bad code on the website itself that is vulnerable. So overall site security is what you need to focus on. If they can exploit a portion of the site to drop code onto your server, or get hte code on your server to work for them, that's when the spamming usually occurs.
Of course. I always try my best too keep security in mind.


EDIT:
I just tested and it worked! Great. Now I can finally have account recovery and verification.

Thanks!

Last edited by Ephracis; 04-08-2009 at 09:19 AM.
 
Old 04-08-2009, 03:45 PM   #9
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Glad you got it all sorted out, Not too bad to get working ehh ?
 
  


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
setting up a mail server: unable to recieve mail Valkyrie_of_valhalla Linux - Networking 3 09-15-2006 01:29 PM
Setting up a Mail Server TaaDow Linux - Software 3 06-23-2006 07:53 PM
Setting up mail server gslater Linux - Newbie 2 05-16-2004 09:42 AM
Setting a mail server. hubergeek Linux - Networking 0 04-26-2002 12:38 PM
Setting up a mail server linuxguruwannabe Linux - Networking 13 08-07-2000 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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