Вопрос

Greets,

I have a CentOS installed as a gateway, and some clients connect to internet via this gateway(NAT).

Now I want to insert some string to each webpage that clients requested. How to achieve this? netfilter, winpcap or something else ?

Any comments will be appreciated:-)

Это было полезно?

Решение

Ideally, don't. Doing this blindly will break a lot of web pages, especially ones which make heavy use of AJAX. (Because your inserted strings will end up in places where they will cause errors, like JSON responses.)

If you must, the term for what you're trying to do is "transparent proxying". Squid supports this: http://wiki.squid-cache.org/SquidFaq/InterceptionProxy

Другие советы

Modifying the response content requires something that knows how to parse and correctly change that content. That means you can't do it at the packet layer (layer 3, where NAT is also implemented) but you need something at the application layer (layer 7). Application level gateways are usually called proxies :-)

And since this question is actually in the wrong forum I will stop answering for now :-) Please move it to i.e. Server Fault.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top