Skip to contentSkip to conversation

Need help have some questions...

DISCUSSION SBlaze 5 participants 16 messages Aug 18, 2003 – Aug 25, 2003 1 message not in the archive

lore
Share & tools
lore

SBlaze

author
#1 lore raw
In reply to a message not in the archive

To Ralf, the netfilter team, and the whole of the OS community

How am I supposed to proxy apache? Why should I have to? Is it not a firewalls job to protect a system(and LAN behind it)? This is a very valid form of protection I'm asking for here.

A more detailed explanation of what I need is this and I know I'm not alone in this as I have been corresponding with people who want the very same thing(cc if ya our there lemme hear ya..post up with me here.)

Anyone who runs apache and logs(which is EVERYONE who runs apache unless they are brain dead or don't care about security) is constantly BOMBARDED DAILY with CODE/RED and NIMDA(and I'm sure other types of invalid requests they would like to protect against).

Knowing this... and knowing that the discard service is a very nice and clean way to sort of send things like this to the great packet /dev/null , I do not think it is too much to ask that iptables provide me a way to keep those invalid requests AWAY from my web server. I should be able to route packets to the discard service without having to use the NAT table(although if that was even an option I would use it.) All my services run on ONE machine NAT should not be nessecery.

If this can not be done I would love for someone to give me a half technical
half lamen's terms explanation. I honestly don't think I'm asking so much of the iptables firewall that I should have to go proxying things and circumventing things here and there.

Much Respect to the netfilter team and the OS Community SBlaze

Quoted 17 lines · --- Ralf Spenneberg

Am Sam, 2003-08-16 um 00.09 schrieb SBlaze:

Quoted 2 lines

How can I sepperate requests to a machine by a matched string? Once this is done how can I then direct certain requests one way and certain request

another

Quoted 1 line

way(doesn't need to be another IP but does need to be another port)?

Use a proxy. They were made for application filtering.

Cheers,

Ralf

Signature · 6 lines
Ralf Spenneberg
RHCE, RHCX

Book: Intrusion Detection für Linux Server   http://www.spenneberg.com
IPsec-Howto				     http://www.ipsec-howto.org
Honeynet Project Mirror:                     http://honeynet.spenneberg.org

=====
"Winky is not knowing how sir, winky is not knowing how?" -=Winky / Harry Potter and the Goblet of Fire=-"

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#2 lore raw
Quoted 5 lines · SBlaze

To Ralf, the netfilter team, and the whole of the OS community

How am I supposed to proxy apache? Why should I have to? Is it not a firewalls job to protect a system(and LAN behind it)? This is a very valid form of protection I'm asking for here.

First of all, cool down. Secondly, read up on layered model of networking and try to understand, each layer and its functionality, like, IP is meant for routing, TCP is meant for reliable end to end communication and HTTP is meant for retrieval of the hyper text (and images and audio and video...).

Once you get there, you'll understand the goals of netfilter and the layer(s) it's supposed to function upon. However, there have been some adhoc developements here and there by means of different (pom) modules which have extended the borders of what netfilter can/should do like the "string" module. But when you get to the bits and bytes of how things work you would realize that, eg, the "string" module kills your system by its extensive scan of the packets. It does not know that an "invalid" HTTP request happens at the very beginning of the HTTP communication after a "GET" command... And again because of some technical issues like fragmentation (which can be found in the readings you've already done) this "string" module is not bullet-proof for catching the HTTP requests you don't like.

What Ralf mentioned earlier is absolutely valid. If you want to filter based on an application specific property (eg, "Get cmd.exe", or whatever the M$ hacks look like) then you need to make use of a filter at the application level. In this case, a process which terminates the HTTP dialog, looks for (in)valid requests and acts upon it accordingly.

This is a .02$ explanation you asked for.

Ramin

#14 lore raw
In reply to SBlaze
Quoted 3 lines · SBlaze

How am I supposed to proxy apache? Why should I have to? Is it not a firewalls job to protect a system(and LAN behind it)? This is a very valid form of protection I'm asking for here.

You are asking for a different sort of protection than what firewalls are generally expected to provide.

Quoted 4 lines

Anyone who runs apache and logs(which is EVERYONE who runs apache unless they are brain dead or don't care about security) is constantly BOMBARDED DAILY with CODE/RED and NIMDA(and I'm sure other types of invalid requests they would like to protect against).

Yeah, so what? Apache can handle that. You can configure Apache to discard those requests without filling up your log files, if that's the concern. You can run a proxy to deal with it. You have plenty of options.

Quoted 4 lines

If this can not be done I would love for someone to give me a half technical
half lamen's terms explanation. I honestly don't think I'm asking so much of the iptables firewall that I should have to go proxying things and circumventing things here and there.

Rejecting packets based on source or destination or port number or a number of other things is easy. Building an awareness of the HTTP protocol into the kernel modules so that netfilter can parse an HTTP conversation isn't appropriate. Inspecting lots of packets is better handled outside the kernel.

IP, TCP, UDP, and ICMP are all low-level protcols.

HTTP is a high-level protocol.

Rejecting based on content is more appropriately handled by a user-level tool which is designed to handle the specific user-level protocol involved, in this case an HTTP proxy would be a good choice.

#15 lore raw
In reply to SBlaze

Am Mon, 2003-08-18 um 22.13 schrieb SBlaze:

Quoted 5 lines

To Ralf, the netfilter team, and the whole of the OS community

How am I supposed to proxy apache? Why should I have to? Is it not a firewalls job to protect a system(and LAN behind it)? This is a very valid form of protection I'm asking for here.

You sure are correct in pointing out that firewalls are supposed to protect a system and maybe a LAN behind it.
You have to remember (or read up on) that there are basically 3 different technologies available to technically implement a firewall:
1. Packetfilter like netfilter and ipchains
2. Circuit Relays like socks
3. Application level gateways like fwtk

All three work on different network layers and have access to different information.
Basically a packet filter has only access to the headers of the IP packet (yes, I know that netfilter has the string match), but they cannot reassemble the whole datastream and base their decision on it (at least not yet). This means, that a packetfilter cannot find the destination email address in an smtp data stream. It just does not have the intelligence built in.

A circuit relay is a quite dumb proxy that just filters connections but still cannot see inside.

An application level gateway is more or less a proxy written for the specific protocol. It cannot access the packet headers anymore but it sees the data stream. It can understand and parse the SMTP protocol and filter based on the data send.

Now since Netfilter is a packet filter, you do not (and probably will never) have the possibility to filter based on domains but only on IP addresses.
If your domains use two different IP addresses it is easy to redirect because netfilter can access the IP header holding the information.

By the way, even commercial packet filters like Checkpoint use a proxy for this functionality.

Cheers,

Ralf

Signature · 6 lines
Ralf Spenneberg
RHCE, RHCX

Book: Intrusion Detection für Linux Server   http://www.spenneberg.com
IPsec-Howto				     http://www.ipsec-howto.org
Honeynet Project Mirror:                     http://honeynet.spenneberg.org
#16 lore raw
In reply to SBlaze
Quoted 6 lines · --On Monday, August 18, 2003 13:13:33 -0700 SBlaze <[email protected]> wrote:

To Ralf, the netfilter team, and the whole of the OS community

How am I supposed to proxy apache? Why should I have to? Is it not a firewalls job to protect a system(and LAN behind it)? This is a very valid form of protection I'm asking for here.

Quoted 8 lines

A more detailed explanation of what I need is this and I know I'm not alone in this as I have been corresponding with people who want the very same thing(cc if ya our there lemme hear ya..post up with me here.)

Anyone who runs apache and logs(which is EVERYONE who runs apache unless they are brain dead or don't care about security) is constantly BOMBARDED DAILY with CODE/RED and NIMDA(and I'm sure other types of invalid requests they would like to protect against).

'Bombarded' is a relative term. On a busy site they aren't even noticable unless you're looking for them.

Quoted 8 lines

Knowing this... and knowing that the discard service is a very nice and clean way to sort of send things like this to the great packet /dev/null , I do not think it is too much to ask that iptables provide me a way to keep those invalid requests AWAY from my web server. I should be able to route packets to the discard service without having to use the NAT table(although if that was even an option I would use it.) All my services run on ONE machine NAT should not be nessecery.

Quoted 4 lines

If this can not be done I would love for someone to give me a half technical
half lamen's terms explanation. I honestly don't think I'm asking so much of the iptables firewall that I should have to go proxying things and circumventing things here and there.

You might want to take a look at http://www.securityfocus.com/infocus/1553
It's about IDS signatures, but it shows the complexity of the problem of string-matching URLs due to path obuscation and character encoding, and doesn't even mention that the URL could possibly be spread over fragmented packets.
Even with plain URL's, string matching takes time and CPU, increasing
the latency through your firewall. You could probably do what you want by shunting your port 80 packets to userspace and filtering it there.
A proxy really is the best tool for the job, it already has everything
you need and is well-optimized for the task.

Frank

Quoted 4 lines

Much Respect to the netfilter team and the OS Community SBlaze

Signature · 3 lines
Frank Smith                                      [email protected]
Systems Administrator                           Voice: 512-374-4673
Hoover's Online                                   Fax: 512-374-4501
author
#3 lore raw
In reply to Ramin Dousti

Going to try to fit all my comments for this thread into one email and hope everyone reads. Here we go.

First off I would like to say a big thanks to Ralf and Ramin. They gave really good explanations that I needed to see why this hasn't been addressed. While I still would like to see this kind of functionality in iptables I can see why it is not.

To those stressing that it would be too much on the CPU and memory I have to wonder how valid this is. I know it would certainly increase the load but I do not believe it would overload most systems.

Ralf made some really good points. He says I should use a proxy. Ok so how do I go about proxying my two web sites that are hosted with apache? Honestly I'm not being sacrastic I really don't know. Going along with what Ramin says is the third level of a fully implemented firewall(the application level) am I to assume then that it is then to fall to a proxy(I again don't know what sort of proxy I need here...not sure squid is what I need) or I would really like to ask should it fall to apache(if so anyone know of how to define what apache logs?)

A question to Ralf about the second lawyer of a firewall. Is a circut relay also known as a bridge?

Also a question to Ramin. You make note in that last post of basically dealing with the HTTP protocol on the HTTP application level.... are you referreing to web server(apache) ?

Thanks to all who are helping out. I see a soloution coming about. With a little more help I and some others I know may get there.

Thanks
SBlaze

=====
"Winky is not knowing how sir, winky is not knowing how?" -=Winky / Harry Potter and the Goblet of Fire=-"

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#4 lore raw
Quoted 2 lines · SBlaze

A question to Ralf about the second lawyer of a firewall. Is a circut relay also known as a bridge?

In general:

layer 1 -> repeater
layer 2 -> bridge
layer 3 -> router

Now, what does the circuit relay do? Does it just amplify the signal? Or does it terminate, reconstruct and forward the information?

Quoted 4 lines

Also a question to Ramin. You make note in that last post of basically dealing with the HTTP protocol on the HTTP application level.... are you referreing to web server(apache) ?

No. What I said is: Filtering based on the specifics of an application is best done by a specialized module which knows enough about that particular protocol.

Ramin

Quoted 14 lines

Thanks to all who are helping out. I see a soloution coming about. With a little more help I and some others I know may get there.

Thanks
SBlaze

=====
"Winky is not knowing how sir, winky is not knowing how?" -=Winky / Harry Potter and the Goblet of Fire=-"

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#13 lore raw
In reply to SBlaze

Am Sam, 2003-08-23 um 22.51 schrieb SBlaze:

Quoted 8 lines

Ralf made some really good points. He says I should use a proxy. Ok so how do I go about proxying my two web sites that are hosted with apache? Honestly I'm not being sacrastic I really don't know. Going along with what Ramin says is the third level of a fully implemented firewall(the application level) am I to assume then that it is then to fall to a proxy(I again don't know what sort of proxy I need here...not sure squid is what I need) or I would really like to ask should it fall to apache(if so anyone know of how to define what apache logs?)

Apache can serve as a webserver and as a proxy. You can serve one site while proxying the other.

Quoted 3 lines

A question to Ralf about the second lawyer of a firewall. Is a circut relay also known as a bridge?

No. A curcuit relay is something like a very dumb proxy.

Quoted 4 lines

Also a question to Ramin. You make note in that last post of basically dealing with the HTTP protocol on the HTTP application level.... are you referreing to web server(apache) ?

Probably yes. see above.

Cheers,

Ralf

Signature · 6 lines
Ralf Spenneberg
RHCE, RHCX

Book: Intrusion Detection für Linux Server   http://www.spenneberg.com
IPsec-Howto				     http://www.ipsec-howto.org
Honeynet Project Mirror:                     http://honeynet.spenneberg.org
author
#5 lore raw
In reply to Ramin Dousti
Quoted 5 lines · --- Ramin Dousti
Quoted 2 lines · SBlaze

A question to Ralf about the second lawyer of a firewall. Is a circut relay also known as a bridge?

Quoted 9 lines

In general:

layer 1 -> repeater
layer 2 -> bridge
layer 3 -> router

Now, what does the circuit relay do? Does it just amplify the signal? Or does it terminate, reconstruct and forward the information?

Ralf seems to disagree that the second layer is a bridge... I never though of a bridge as a dumb proxy...but thats essentially what it is right?? Anyway this isn't really the focus of what I want to know...

Quoted 5 lines
Quoted 2 lines

Also a question to Ramin. You make note in that last post of basically

dealing

Quoted 1 line

with the HTTP protocol on the HTTP application level.... are you referreing

to

Quoted 8 lines
Quoted 1 line

web server(apache) ?

No. What I said is: Filtering based on the specifics of an application is best
done by a specialized module which knows enough about that particular protocol.

Ramin

So if I understand what Ramen is saying. It is possible to do this with a module that could be loaded into iptables. Aside from the CPU argument is there any other reason why this isn't being done? It seems to come up time and time again.

Quoted 6 lines
Quoted 6 lines

Thanks to all who are helping out. I see a soloution coming about. With a little more help I and some others I know may get there.

Thanks
SBlaze

Again no one really shed any light on what I'm supposed to do here. What proxy am I supposed to use? Everyone is saying use a proxy but no one is giving any specifics as to what kind or what software?.

Thanks
SBlaze

=====
"Winky is not knowing how sir, winky is not knowing how?" -=Winky / Harry Potter and the Goblet of Fire=-"

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#6 lore raw

Am Mon, 2003-08-25 um 22.05 schrieb SBlaze:

Quoted 6 lines
Quoted 3 lines

Now, what does the circuit relay do? Does it just amplify the signal? Or does it terminate, reconstruct and forward the information?

Ralf seems to disagree that the second layer is a bridge... I never though of a bridge as a dumb proxy...but thats essentially what it is right?? Anyway this isn't really the focus of what I want to know...

Circuit Relay operates on Application layer. A typical circuit relay is socks. It just forwards connections.

Quoted 5 lines

So if I understand what Ramen is saying. It is possible to do this with a module that could be loaded into iptables. Aside from the CPU argument is there any other reason why this isn't being done? It seems to come up time and time again.

You could, if you would write the module. But this is better done in userspace.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

Again no one really shed any light on what I'm supposed to do here. What proxy am I supposed to use? Everyone is saying use a proxy but no one is giving any specifics as to what kind or what software?.

Sure, I did: Use Apache. Apache can work as a webserver for you on your Linux box and at the same time as a proxy for the Windows box.

Cheers,

Ralf

Signature · 6 lines
Ralf Spenneberg
RHCE, RHCX

Book: Intrusion Detection für Linux Server   http://www.spenneberg.com
IPsec-Howto				     http://www.ipsec-howto.org
Honeynet Project Mirror:                     http://honeynet.spenneberg.org
author
#7 lore raw
Quoted 22 lines · --- Ralf Spenneberg

Am Mon, 2003-08-25 um 22.05 schrieb SBlaze:

Quoted 1 line
Quoted 1 line

Now, what does the circuit relay do? Does it just amplify the signal? Or

does

Quoted 3 lines
Quoted 2 lines

it terminate, reconstruct and forward the information?

Ralf seems to disagree that the second layer is a bridge... I never though

of a

Quoted 1 line

bridge as a dumb proxy...but thats essentially what it is right?? Anyway

this

Quoted 1 line

isn't really the focus of what I want to know...

Circuit Relay operates on Application layer. A typical circuit relay is socks. It just forwards connections.

Quoted 3 lines

So if I understand what Ramen is saying. It is possible to do this with a module that could be loaded into iptables. Aside from the CPU argument is there any other reason why this isn't being done? It seems to come up time

and

Quoted 2 lines

time again.

You could, if you would write the module. But this is better done in userspace.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 1 line

Again no one really shed any light on what I'm supposed to do here. What

proxy

Quoted 1 line

am I supposed to use? Everyone is saying use a proxy but no one is giving

any

Quoted 1 line

specifics as to what kind or what software?.

Sure, I did: Use Apache. Apache can work as a webserver for you on your Linux box and at the same time as a proxy for the Windows box.

Currently I am using Apache and I have two sites vhosted on it. The only sort thing I really use my windows box for is web browsing/multimedia that sort...it has no services available to the world. So thats whats confusing me is that everyone says use a proxy but I don't see how using a proxy can stop those unwanted requests. I'm trying to stop certain requests from reaching my web server which is my router/firewall/web/file server. So how is a proxy supposed to help in this case? Everyone says it is but I just don't know much about "proxying" or proxying soloutions for that matter

Thanks alot
SBlaze

Quoted 10 lines

Cheers,

Ralf

Signature · 6 lines
Ralf Spenneberg
RHCE, RHCX

Book: Intrusion Detection für Linux Server   http://www.spenneberg.com
IPsec-Howto				     http://www.ipsec-howto.org
Honeynet Project Mirror:                     http://honeynet.spenneberg.org

=====
"Winky is not knowing how sir, winky is not knowing how?" -=Winky / Harry Potter and the Goblet of Fire=-"

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#8 lore raw

Am Mon, 2003-08-25 um 22.39 schrieb SBlaze:

Quoted 8 lines

Currently I am using Apache and I have two sites vhosted on it. The only sort thing I really use my windows box for is web browsing/multimedia that sort...it has no services available to the world. So thats whats confusing me is that everyone says use a proxy but I don't see how using a proxy can stop those unwanted requests. I'm trying to stop certain requests from reaching my web server which is my router/firewall/web/file server. So how is a proxy supposed to help in this case? Everyone says it is but I just don't know much about "proxying" or proxying soloutions for that matter

Oh, that i might not remember your original post correctly. Lets see ... Well, yeah you are right, you never said you wanted to redirect but just reject. Ok, my fault.
Then you could just put a proxy in between. Run your Apache on 8080 and run a reverse proxy like apache or squid on 80. But I doubt, that you would be happy with it, because it will eat up resources. Make a long thread short:
There is no good way to do it on one machine. Since you are using Apache and not IIS, you will be fine. If the log messages annoy you, bad luck. This is just life if you don't filter the request first using a proxy.

Cheers,

Ralf

Signature · 6 lines
Ralf Spenneberg
RHCE, RHCX

Book: Intrusion Detection für Linux Server   http://www.spenneberg.com
IPsec-Howto				     http://www.ipsec-howto.org
Honeynet Project Mirror:                     http://honeynet.spenneberg.org
#12 lore raw
In reply to Ralf Spenneberg
Quoted 2 lines · Ralf Spenneberg

Circuit Relay operates on Application layer. A typical circuit relay is socks. It just forwards connections.

OK. I think we were talking about apples and oranges here. What you call a "Circuit Relay" is just an "Application Gateway" and has nothing to do with circuits ;-) I must keep up with the new jargon, I guess...

But, having all these terminologies (which mostly is just a marketing attempt to make things more interesting) confuses me, when I read emails saying a "Circuit Relay" is a "bridge" or a "dumb proxy".

Let's just call things uniquely what they are... We're not trying to sell something here, are we?

Ramin

#9 lore raw
In reply to Ralf Spenneberg
Quoted 10 lines · Ralf Spenneberg

Oh, that i might not remember your original post correctly. Lets see ... Well, yeah you are right, you never said you wanted to redirect but just reject. Ok, my fault.
Then you could just put a proxy in between. Run your Apache on 8080 and run a reverse proxy like apache or squid on 80. But I doubt, that you would be happy with it, because it will eat up resources. Make a long thread short:
There is no good way to do it on one machine. Since you are using Apache and not IIS, you will be fine. If the log messages annoy you, bad luck. This is just life if you don't filter the request first using a proxy.

OK. If SBalze is running apache, why not using the powerful rewrite rules of "the great" apache to keep the bad guys away? No need for a "circuit relay" ;) or a "dumb bridge" ;)

Ramin

Quoted 3 lines

Cheers,

Ralf

author
#10 lore raw
Quoted 13 lines · --- Ramin Dousti
Quoted 10 lines · Ralf Spenneberg

Oh, that i might not remember your original post correctly. Lets see ... Well, yeah you are right, you never said you wanted to redirect but just reject. Ok, my fault.
Then you could just put a proxy in between. Run your Apache on 8080 and run a reverse proxy like apache or squid on 80. But I doubt, that you would be happy with it, because it will eat up resources. Make a long thread short:
There is no good way to do it on one machine. Since you are using Apache and not IIS, you will be fine. If the log messages annoy you, bad luck. This is just life if you don't filter the request first using a proxy.

Quoted 10 lines

OK. If SBalze is running apache, why not using the powerful rewrite rules of "the great" apache to keep the bad guys away? No need for a "circuit relay" ;) or a "dumb bridge" ;)

Ramin

Quoted 3 lines

Cheers,

Ralf

What are these rewrite rules you are talking about? I have never heard of such. What do they do? How do they work?

SBlaze

=====
"Winky is not knowing how sir, winky is not knowing how?" -=Winky / Harry Potter and the Goblet of Fire=-"

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#11 lore raw
Quoted 11 lines · SBlaze
Quoted 10 lines

OK. If SBalze is running apache, why not using the powerful rewrite rules of "the great" apache to keep the bad guys away? No need for a "circuit relay" ;) or a "dumb bridge" ;)

Ramin

Quoted 3 lines

Cheers,

Ralf

What are these rewrite rules you are talking about? I have never heard of such.

Like already noted by Ralf, if you're running apache on linux you must not fear about the worms/viruses/... But just to be guarded against the "bad guys" you can use the rewrite rules in

http://httpd.apache.org/docs/mod/mod_rewrite.html

to do neat stuff like redirecting client's request to a blackhole (if the client is really a browser). Take a look at the doc. It really is a must read for people using apache...

Ramin

Quoted 3 lines

What do they do? How do they work?

SBlaze