Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-22 Thread Elli Albek
: Cannot set remote address in valve (Tomcat 5.5) Hello Elli, From what I understand of your architecture, I would configure RemoteIpValve with : Valve className = org.apache.catalina.connector.RemoteIpValve internalProxies = @load-balancer-ip trustedProxies = @the-trusted

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-21 Thread Cyrille Le Clerc
, October 08, 2009 1:04 AM To: Tomcat Users List Subject: Re: Cannot set remote address in valve (Tomcat 5.5)   Hello Elli,   I am afraid there may be a flaw in the algorythm looking for the first IP  of the coma delimited x-forwarded-for header without ensuring that this first IP has been set

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-20 Thread Elli Albek
of the list. This may not be the general case for proxies, it is only for this case. E -Original Message- From: Cyrille Le Clerc [mailto:clecl...@xebia.fr] Sent: Thursday, October 08, 2009 1:04 AM To: Tomcat Users List Subject: Re: Cannot set remote address in valve (Tomcat 5.5) Hello Elli

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-11 Thread Cyrille Le Clerc
Hello, I updated issue 47330 proposal : port of mod_remoteip in Tomcat as RemoteIpValve to link to a Servlet Filter implementation of mod_remoteip called XForwardedFilter. As detailed in the comment, XForwardedFilter.java copyright may not fit the Apache Software Foundation requirements as

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-09 Thread Cyrille Le Clerc
Hello Christopher,    I am afraid there may be a flaw in the algorythm looking for the first IP  of the coma delimited x-forwarded-for header without ensuring that this first IP has been set by a trusted proxy and not by the requester ( getFirstIP(xforwardedForHeaderValue) ). Such

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Cyrille, On 10/9/2009 9:16 AM, Cyrille Le Clerc wrote: An idea to mitigate this risk is to ask the network team to remove some http headers at the entry of the platform (x-forwarded-for, x-forwarded-proto, x-forwarded-... ) This makes a lot of

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-09 Thread Cyrille Le Clerc
Hello Christopher, An idea to mitigate this risk is to ask the network team to remove some http headers at the entry of the platform (x-forwarded-for, x-forwarded-proto, x-forwarded-... ) This makes a lot of sense, except that there might be some legitimate proxies in the path that

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-08 Thread Cyrille Le Clerc
Hello Elli, I am afraid there may be a flaw in the algorythm looking for the first IP of the coma delimited x-forwarded-for header without ensuring that this first IP has been set by a trusted proxy and not by the requester ( getFirstIP(xforwardedForHeaderValue) ). Such spoofing can easily

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Cyrille, On 10/8/2009 4:03 AM, Cyrille Le Clerc wrote: I am afraid there may be a flaw in the algorythm looking for the first IP of the coma delimited x-forwarded-for header without ensuring that this first IP has been set by a trusted proxy

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-06 Thread Rainer Jung
I know I'm late in this discussion. Besides the very good mentioning of mod_remoteip, RemoteIpValve and XForwardedFilter I guess there's a way of doing it in case you are using mod_jk. mod_jk (and mod_proxy_ajp) use the AJP protocol between the web server and the backend, e.g. Tomcat. This

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-05 Thread Elli Albek
- Original Message - From: Christopher Schultz ch...@christopherschultz.net To: Tomcat Users List users@tomcat.apache.org Sent: Fri, 2 Oct 2009 07:32:06 -0700 (PDT) Subject: Re: Cannot set remote address in valve (Tomcat 5.5) 2. There are other valves like request filters that cannot

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-05 Thread Elli Albek
by the spec as an interface. E - Original Message - From: Tim Funk funk...@apache.org To: Tomcat Users List users@tomcat.apache.org Sent: Fri, 2 Oct 2009 07:46:14 -0700 (PDT) Subject: Re: Cannot set remote address in valve (Tomcat 5.5) Context filters are executed before webapp filters. I

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-05 Thread Cyrille Le Clerc
: Christopher Schultz ch...@christopherschultz.net To: Tomcat Users List users@tomcat.apache.org Sent: Fri, 2 Oct 2009 07:32:06 -0700 (PDT) Subject: Re: Cannot set remote address in valve (Tomcat 5.5) 2. There are other valves like request filters that cannot work without the correct IP, as well

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-05 Thread Elli Albek
Hi, We can add the header to the custom valves, but then in addition we have to change a few log file configurations, create a servlet filter and maybe something else I cant think of now. Basically doing the same thing a few times and keeping track of all the places that depend on the header.

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Elli Albek
remote address in valve (Tomcat 5.5) -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Elli, On 9/27/2009 12:19 AM, Elli Albek wrote: public void setRemoteAddr(String remoteAddr) { // Not used } The variable is protected so I cannot access it directly from my code. What

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Elli Albek
A few reasons why not to do this as a servlet filter: 1. There are many web apps on the server and I don't want to include the filter in each. 2. There are other valves like request filters that cannot work without the correct IP, as well as custom login valve. 3. We have a few environments and I

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Mark Thomas
Elli Albek wrote: A few reasons why not to do this as a servlet filter: 1. There are many web apps on the server and I don't want to include the filter in each. You don't have to. Configure it in the global web.xml. 2. There are other valves like request filters that cannot work without the

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Elli, On 10/2/2009 4:41 AM, Elli Albek wrote: Yes, the remoteAddress member is protected. So you can only access it if you put your class in the same package. I thought of doing it like a filter (wrapping) but it does not look like a workable

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, On 10/2/2009 5:55 AM, Mark Thomas wrote: Elli Albek wrote: A few reasons why not to do this as a servlet filter: 1. There are many web apps on the server and I don't want to include the filter in each. You don't have to. Configure it in

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Mark Thomas
Christopher Schultz wrote: Mark, On 10/2/2009 5:55 AM, Mark Thomas wrote: Elli Albek wrote: A few reasons why not to do this as a servlet filter: 1. There are many web apps on the server and I don't want to include the filter in each. You don't have to. Configure it in the global

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Tim Funk
Context filters are executed before webapp filters. I believe (but not confirmed) that valves execute before the filters. -Tim Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, On 10/2/2009 5:55 AM, Mark Thomas wrote: Elli Albek wrote: A few reasons why not to

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Caldarale, Charles R
From: Tim Funk [mailto:funk...@apache.org] Subject: Re: Cannot set remote address in valve (Tomcat 5.5) Context filters are executed before webapp filters. I'll bite: what's the difference between a context filter and a webapp filter? Aren't all filters are configured in some web.xml

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Tim Funk
My bad - by context filter I meant to say the web.xml as found in $CATALINA_HOME/conf/web.xml There is nothing contexty about it -Tim Caldarale, Charles R wrote: From: Tim Funk [mailto:funk...@apache.org] Subject: Re: Cannot set remote address in valve (Tomcat 5.5) Context filters

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, On 10/2/2009 10:45 AM, Mark Thomas wrote: Christopher Schultz wrote: 2. There are other valves like request filters that cannot work without the correct IP, as well as custom login valve. Filters should be OK providing they are defined in

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Mark Thomas
Christopher Schultz wrote: Mark, On 10/2/2009 10:45 AM, Mark Thomas wrote: Christopher Schultz wrote: 2. There are other valves like request filters that cannot work without the correct IP, as well as custom login valve. Filters should be OK providing they are defined in the right

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Elli, On 9/27/2009 12:19 AM, Elli Albek wrote: public void setRemoteAddr(String remoteAddr) { // Not used } The variable is protected so I cannot access it directly from my code. What variable? The remoteAddress member? Is

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-09-27 Thread Mark Thomas
Elli Albek wrote: Hi, We have Tomcat behind a load balancer. The servlet API and tomcat libraries see the load balancer IP as the client IP. I tried to write a simple valve which will extract the IP from HTTP header X-Forwarded-For and continue the valve chain using this IP as the client

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-09-27 Thread Elli Albek
ma...@apache.org To: Tomcat Users List users@tomcat.apache.org Sent: Sun, 27 Sep 2009 02:13:49 -0700 (PDT) Subject: Re: Cannot set remote address in valve (Tomcat 5.5) https://issues.apache.org/bugzilla/show_bug.cgi?id=47330 is on the todo list but my current plan is to implement it as a Filter

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-09-27 Thread David Smith
Elli Albek wrote: Hi, We have Tomcat behind a load balancer. The servlet API and tomcat libraries see the load balancer IP as the client IP. I tried to write a simple valve which will extract the IP from HTTP header X-Forwarded-For and continue the valve chain using this IP as the client

Cannot set remote address in valve (Tomcat 5.5)

2009-09-26 Thread Elli Albek
Hi, We have Tomcat behind a load balancer. The servlet API and tomcat libraries see the load balancer IP as the client IP. I tried to write a simple valve which will extract the IP from HTTP header X-Forwarded-For and continue the valve chain using this IP as the client IP. This will be the