Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 03-27-2009, 08:08 PM   #1
Registered: Dec 2008
Location: Norway
Distribution: Debian
Posts: 43

Rep: Reputation: 15
Using hosts.allow to allow only postfix to use port 25

My question is.

Is it possible to use /etc/hosts.allow or something similar to block everything except postfix smtp on my port 25 out and in? I've opened up the port with iptables but after walking through the man pages i don't see any option to say which program can use the open port in iptables.

Thanks in advance for taking your time to answer this question.
Old 03-28-2009, 01:27 AM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,204

Rep: Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310Reputation: 2310
Only one program at a time can bind to a specific port, so if postfix has attached to that port (ie usual setup) then you don't need to worry.
Postfix if an SMTP server, so it won't give up that port unless you kill postfix.
Note that a port isn't really 'open' unless a program is attached to it. Its a bit of a misnomer, its not like a porthole on a ship...
Old 03-28-2009, 04:32 AM   #3
Registered: Dec 2008
Location: Norway
Distribution: Debian
Posts: 43

Original Poster
Rep: Reputation: 15
I do know that if there is nothing listening to the port then the port can be considered "closed" but i didn't know that one can only have one listening service per port. Thank you very much to for clearing that up for me.
Old 03-28-2009, 04:36 AM   #4
Registered: Mar 2009
Location: Hong Kong
Distribution: Fedora
Posts: 184

Rep: Reputation: 41
The only thing I know of that is capable of limiting a service to a specific port, or the other way around, is SELinux.
Possibly also AppArmor can do it, but I can't confirm that.


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
LXer: How To Whitelist Hosts/IP Addresses In Postfix LXer Syndicated Linux News 0 06-11-2008 05:20 PM
Postfix mail bounce backs to linux hosts humbletech99 Linux - Networking 1 12-31-2006 10:21 AM
postfix with /etc/hosts, /etc/hostname file setting taiwf Linux - Newbie 1 05-24-2006 10:56 AM
Postfix + Virtual Hosts Problem vbfischer Linux - Networking 1 03-30-2005 08:42 PM
Virtual hosts and port forwarding fr_laz Linux - Networking 0 02-03-2005 02:46 PM

All times are GMT -5. The time now is 12:27 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration