LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-27-2009, 08:08 PM   #1
Mogget
Member
 
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
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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
Mogget
Member
 
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
reptiler
Member
 
Registered: Mar 2009
Location: Hong Kong
Distribution: Fedora
Posts: 184

Rep: Reputation: 42
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.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:54 AM.

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