iptables question: restricting access to port 2500 to Apache Web Server Proxy...

This is a discussion on iptables question: restricting access to port 2500 to Apache Web Server Proxy... within the Linux Security forums, part of the System Security and Security Related category; Howdy, I'm brand new to using iptables and I am trying use Apache (on port 80) as a proxy ...


Go Back   Usenet Forums > System Security and Security Related > Linux Security

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-31-2004
Ryan Kuykendall
 
Posts: n/a
Default iptables question: restricting access to port 2500 to Apache Web Server Proxy...

Howdy,

I'm brand new to using iptables and I am trying use Apache (on port
80) as a proxy to content on port 2500 (on which I have a ruby webrick
server running). I have apache setup to proxy in content on port 2500
as:

http://subdomain.domain.com/

And that works fine. However for security reasons, I need to prevent
users from accessing port 2500 directly like this:

http://domain.com:2500/

Since this circumvents the Apache authorization I have in my
httpd.conf file.

Currently, when I run iptables -L, I see this (which I realize is
having no firewall at all):

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

How would I use iptables to restrict direct access to port 2500 and
still allow my Apache webserver to proxy it?

Thanks,

Ryan
Reply With Quote
  #2 (permalink)  
Old 09-01-2004
Tim Haynes
 
Posts: n/a
Default Re: iptables question: restricting access to port 2500 to ApacheWeb Server Proxy...

exposhare@gmail.com (Ryan Kuykendall) writes:

> I'm brand new to using iptables and I am trying use Apache (on port 80)
> as a proxy to content on port 2500 (on which I have a ruby webrick server
> running).


Cool... :)

> I have apache setup to proxy in content on port 2500 as:

[snip]
> Currently, when I run iptables -L, I see this (which I realize is
> having no firewall at all):

[snip]
> How would I use iptables to restrict direct access to port 2500 and
> still allow my Apache webserver to proxy it?


So the difference is that anyone can access port 80, while port 2500 is
only open for connections from localhost?

Try <http://spodzone.org.uk/packages/secure/iptables.sh>; this is a
succinct tidy starting-point configuration where no new packets are
permitted inbound unless to a provided service. Observe that I allow
anything on the loopback interface (lo) so apache talking up to your ruby
server will be allowed only, and if you clone+edit the `22' line (to
provide ssh) then you'll permit access to the webserver on 80.
Hey presto, one firewall with 80 open, 2500 accessible from the box itself
only, happiness.
Integrate it into however your box normally does firewalling, as you wish. :)

~Tim
--
14:26:07 up 14 days, 22:00, 4 users, load average: 0.06, 0.04, 0.07
piglet@stirfried.vegetable.org.uk |Move a mountain / Fill the ground
http://spodzone.org.uk/cesspit/ |Take death on wheels / Re-create the land
Reply With Quote
  #3 (permalink)  
Old 09-01-2004
NeoSadist
 
Posts: n/a
Default Re: iptables question: restricting access to port 2500 to Apache Web Server Proxy...

Ryan Kuykendall wrote:

> Howdy,
>
> I'm brand new to using iptables and I am trying use Apache (on port
> 80) as a proxy to content on port 2500 (on which I have a ruby webrick
> server running). I have apache setup to proxy in content on port 2500
> as:
>
> http://subdomain.domain.com/
>
> And that works fine. However for security reasons, I need to prevent
> users from accessing port 2500 directly like this:
>
> http://domain.com:2500/
>
> Since this circumvents the Apache authorization I have in my
> httpd.conf file.
>
> Currently, when I run iptables -L, I see this (which I realize is
> having no firewall at all):
>
> Chain INPUT (policy ACCEPT)
> target prot opt source destination
>
> Chain FORWARD (policy ACCEPT)
> target prot opt source destination
>
> Chain OUTPUT (policy ACCEPT)
> target prot opt source destination
>
> How would I use iptables to restrict direct access to port 2500 and
> still allow my Apache webserver to proxy it?
>
> Thanks,
>
> Ryan


Iptables -A INPUT -i eth0 -p tcp --dport 2500 -j DROP
(etc)

--
Mother is far too clever to understand anything she does not like.
-- Arnold Bennett

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:45 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0