LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-07-2010, 06:52 AM   #1
bloki
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Rep: Reputation: 0
Configure sendmail to only allow outgoing email from server IP/hostname


Hello.

How do I check/setup that only the server can send mail (maybe by IP or hostname)?

I have a debian server that sends mail through the PHP mail() function with no problems. The server uses sendmail. My concern is how do I make sure only the server itself can send mails through that server. Because it would be bad if spammers would use it as a relay server.


System:
- Debian Lenny
- PHP5
- Apache2
- MySQL 5
- PHPmyadmin
- Sendmail
 
Old 06-07-2010, 07:18 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,938

Rep: Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341
Hi,

In most distros sendmail is configure to listen only on the local loopback interface. Run:
Code:
netstat -tan|grep 25
and see if it's listening only on 127.0.0.1.
In this case only localhost can use it as a relay to send mail.
You can also use /etc/mail/relay-domains to add the hosts/IPs you want to use your server as a relay.
Another possibility is to use /etc/mail/access to allow relay based on hosts, IPs, the "From:" field, etc

Regards
 
Old 06-07-2010, 07:31 AM   #3
bloki
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Original Poster
Rep: Reputation: 0
...

Thanks for the quick reply. I did what you said and I get this. Is that ok?

Code:
netstat -tan|grep 25
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
tcp        0      0 xxx.xx.xxx.x:567        xx.xx.xxx.xxx:20254     ESTABLISHED
 
Old 06-07-2010, 07:38 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,938

Rep: Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341
Yes, since it's listening only on 127.0.0.1:25 it can be used from localhost only

Regards
 
Old 06-07-2010, 07:42 AM   #5
bloki
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you very much. Have a nice day.
 
  


Reply

Tags
debian, sendmail


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
outgoing registration email is not going I running webserver server behind a proxy tkmsr Linux - Server 3 04-17-2010 07:29 AM
Configure mail server for outgoing only lukesc Linux - Server 6 01-16-2010 12:32 AM
How to configure incomming/outgoing Servers for Email/Thunderbird akhattak Fedora 4 11-03-2009 01:57 PM
[Sendmail] Email Bounce. (żBad Hostname?) IPAddress Linux - Server 13 09-01-2009 09:18 AM


All times are GMT -5. The time now is 10:32 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration