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 feel like am close with a solution but I need a little help fine tuning my iptables commands. ...


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 09-02-2004
Ryan Kuykendall
 
Posts: n/a
Default iptables question: restricting access to port 2500 to Apache Web Server Proxy...

Howdy,

I feel like am close with a solution but I need a little help fine
tuning my iptables commands. I am running two webservers on a linux
box, Apache(1.3.29) on port 80 and WeBrick on port 2500. I have set
up a virtual host in my Apache conf file to proxy the WeBrick server.
Hence I want users coming to my site to access the content on the
WeBrick server like this:

http://subdomain.domain.com/

and prevent them from accessing it like this:

http://domain.com:2500/

These are the most recent iptables commands I have tried (this is
mostly guesswork, so please correct me if I am going about this the
wrong way...I've include comment with each):

# Lock down port 2500 to all connections...
iptables -A INPUT -p tcp --dport 2500 -m state --state
NEW,ESTABLISHED,RELATED -j REJECT

# Open it back up for connections originating from IP address
NNN.NNN.NNN.NN...
iptables -A INPUT -p tcp --dport 2500 -s NNN.NNN.NNN.NN -m state
--state NEW,ESTABLISHED,RELATED -j ACCEPT

# Probably silly redundancy, but open it up to IP address with a
source port...
iptables -A INPUT -p tcp --dport 2500 -s NNN.NNN.NNN.NN --sport 80 -m
state --state NEW,ESTABLISHED,RELATED -j ACCEPT


So the complete locking out works but then my Apache proxy cannot
connect to the port...I get this error message in a browser:

################################################## ######

Proxy Error
The proxy server received an invalid response from an upstream server.

The proxy server could not handle the request GET*/.

Reason: Could not connect to remote machine: Connection refused

Apache/1.3.29 Server at subdomain.domain.com Port 80

################################################## ######

Is there anyone out there who could help me fine tune those iptables
commands?

Many thanks,

Ryan
Reply With Quote
  #2 (permalink)  
Old 09-03-2004
NeoSadist
 
Posts: n/a
Default Re: iptables question: restricting access to port 2500 to Apache Web Server Proxy...

Ryan Kuykendall wrote:

> Howdy,
>
> I feel like am close with a solution but I need a little help fine
> tuning my iptables commands. I am running two webservers on a linux
> box, Apache(1.3.29) on port 80 and WeBrick on port 2500. I have set
> up a virtual host in my Apache conf file to proxy the WeBrick server.
> Hence I want users coming to my site to access the content on the
> WeBrick server like this:
>
> http://subdomain.domain.com/
>
> and prevent them from accessing it like this:
>
> http://domain.com:2500/
>
> These are the most recent iptables commands I have tried (this is
> mostly guesswork, so please correct me if I am going about this the
> wrong way...I've include comment with each):
>
> # Lock down port 2500 to all connections...
> iptables -A INPUT -p tcp --dport 2500 -m state --state
> NEW,ESTABLISHED,RELATED -j REJECT
>
> # Open it back up for connections originating from IP address
> NNN.NNN.NNN.NN...
> iptables -A INPUT -p tcp --dport 2500 -s NNN.NNN.NNN.NN -m state
> --state NEW,ESTABLISHED,RELATED -j ACCEPT
>
> # Probably silly redundancy, but open it up to IP address with a
> source port...
> iptables -A INPUT -p tcp --dport 2500 -s NNN.NNN.NNN.NN --sport 80 -m
> state --state NEW,ESTABLISHED,RELATED -j ACCEPT
>
>
> So the complete locking out works but then my Apache proxy cannot
> connect to the port...I get this error message in a browser:
>
> ################################################## ######
>
> Proxy Error
> The proxy server received an invalid response from an upstream server.
>
> The proxy server could not handle the request GET*/.
>
> Reason: Could not connect to remote machine: Connection refused
>
> Apache/1.3.29 Server at subdomain.domain.com Port 80
>
> ################################################## ######
>
> Is there anyone out there who could help me fine tune those iptables
> commands?
>
> Many thanks,
>
> Ryan


Just block that port outright.

--
Hark ye, Clinker, you are a most notorious offender. You stand
convicted of sickness, hunger, wretchedness, and want.
-- Tobias Smollet

Reply With Quote
  #3 (permalink)  
Old 09-03-2004
Robert Nichols
 
Posts: n/a
Default Re: iptables question: restricting access to port 2500 to Apache Web Server Proxy...

In article <c507d6de.0409021016.44197eee@posting.google.com >,
Ryan Kuykendall <exposhare@gmail.com> wrote:
:Howdy,
:
:I feel like am close with a solution but I need a little help fine
:tuning my iptables commands. I am running two webservers on a linux
:box, Apache(1.3.29) on port 80 and WeBrick on port 2500. I have set
:up a virtual host in my Apache conf file to proxy the WeBrick server.
:Hence I want users coming to my site to access the content on the
:WeBrick server like this:
:
:http://subdomain.domain.com/
:
:and prevent them from accessing it like this:
:
:http://domain.com:2500/
:
:These are the most recent iptables commands I have tried (this is
:mostly guesswork, so please correct me if I am going about this the
:wrong way...I've include comment with each):
:
:# Lock down port 2500 to all connections...
:iptables -A INPUT -p tcp --dport 2500 -m state --state
:NEW,ESTABLISHED,RELATED -j REJECT
:
:# Open it back up for connections originating from IP address
:NNN.NNN.NNN.NN...
:iptables -A INPUT -p tcp --dport 2500 -s NNN.NNN.NNN.NN -m state
:--state NEW,ESTABLISHED,RELATED -j ACCEPT
:
:# Probably silly redundancy, but open it up to IP address with a
:source port...
:iptables -A INPUT -p tcp --dport 2500 -s NNN.NNN.NNN.NN --sport 80 -m
:state --state NEW,ESTABLISHED,RELATED -j ACCEPT

If you're issuing the commands in that order, then all packets to
destination port 2500 match the REJECT rule and none of the following
rules are ever used.

--
Bob Nichols AT comcast.net I am "rnichols42"
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 12:34 PM.


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