Re: Denying IPs using the Valve command in context.xml

2011-10-05 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, On 10/5/2011 9:57 AM, Mark H. Wood wrote: > Part of the problem with this valve is that regex matching is such > a (IMHO) bizarre choice for IP address matching. IP addresses have > a structure which is very unlike text, and the customary and >

Re: Denying IPs using the Valve command in context.xml

2011-10-05 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, On 10/5/2011 10:28 AM, Mark H. Wood wrote: > Having said that, I think that an anchored partial match > (lookingAt()) really is the least-bad fit to the address problem, > since we're usually more concerned about the first, second, and > perh

Re: Denying IPs using the Valve command in context.xml

2011-10-05 Thread Mark H. Wood
On Tue, Oct 04, 2011 at 09:11:28PM +0200, Francis GALIEGUE wrote: > On Tue, Oct 4, 2011 at 21:08, Christopher Schultz > wrote: > [...] > > > > - From the docs: > > > > "If this attribute [allow] is specified, the remote address MUST match > > for this request to be accepted". > > > > "If this attr

Re: Denying IPs using the Valve command in context.xml

2011-10-05 Thread Francis GALIEGUE
On Wed, Oct 5, 2011 at 15:57, Mark H. Wood wrote: > Part of the problem with this valve is that regex matching is such a > (IMHO) bizarre choice for IP address matching.  IP addresses have a > structure which is very unlike text, and the customary and expected > matches take a bit of finagling to

Re: Denying IPs using the Valve command in context.xml

2011-10-05 Thread Mark H. Wood
Part of the problem with this valve is that regex matching is such a (IMHO) bizarre choice for IP address matching. IP addresses have a structure which is very unlike text, and the customary and expected matches take a bit of finagling to do in regexes. I should try writing netmask and CIDR addre

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 10/4/2011 5:48 PM, André Warnier wrote: > Yes, because if one defines e.g. a Pattern "^abcdef" and uses it > via yesno = Pattern.matches("^abcdef",input); it will actually > match the pattern at the beginning of the string only, which is > w

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Francis GALIEGUE
On Tue, Oct 4, 2011 at 23:48, André Warnier wrote: >> >>> And, it seems that the Pattern class, and its own .matches() >>> method, does work in the way that a non-exclusively-java programmer >>> would expect, anchors and all. >> >> Does it? >> > > Yes, because if one defines e.g. a Pattern "^abcde

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread André Warnier
Christopher Schultz wrote: ... And, it seems that the Pattern class, and its own .matches() method, does work in the way that a non-exclusively-java programmer would expect, anchors and all. Does it? Yes, because if one defines e.g. a Pattern "^abcdef" and uses it via yesno = Pattern.matc

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 10/4/2011 4:50 PM, André Warnier wrote: > I agree with Francis that the way the documentation is written, is > confusing for anyone not dedicating his life to Java programming > (like the sysadmins and other perl programmers who have to use

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Francis GALIEGUE
On Tue, Oct 4, 2011 at 22:50, André Warnier wrote: [...] > > So my question is : which of Matcher or Pattern is really used in the > Valve's code ? > You use a Matcher to match. A Pattern is only the compiled form of a regex: final String re = "^"; final Pattern p = Pattern.compile(re); final Ma

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread André Warnier
Francis GALIEGUE wrote: On Tue, Oct 4, 2011 at 21:40, André Warnier wrote: [...] I am not sure that I follow the depths of the Java implementation of all of this, but please note that "\.googlebot\.com$" is a regexp /anchored/ at the end of the string. In other words, I would be surprised (and

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sanford, On 10/4/2011 3:40 PM, Sanford Stein wrote: > I am not intentionally sending HTML e-mails--perhaps my > Thunderbird client is doing something of which I am unaware. You can configure tb to send plain-text to certain recipients. Consider addin

Re: [OT] Denying IPs using the Valve command in context.xml

2011-10-04 Thread André Warnier
Sanford Stein wrote: ... I am not intentionally sending HTML e-mails--perhaps my Thunderbird client is doing something of which I am unaware. You can set this either in your global preferences for sending emails (Options..Composition..General..Send Options), and/or specifically in your address

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Francis GALIEGUE
On Tue, Oct 4, 2011 at 21:40, André Warnier wrote: [...] >> > I am not sure that I follow the depths of the Java implementation of all of > this, but please note that "\.googlebot\.com$" is a regexp /anchored/ at the > end of the string. > In other words, I would be surprised (and disappointed) if

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread André Warnier
Francis GALIEGUE wrote: On Tue, Oct 4, 2011 at 21:08, Christopher Schultz wrote: [...] - From the docs: "If this attribute [allow] is specified, the remote address MUST match for this request to be accepted". "If this attribute [deny] is specified, the remote address MUST NOT match for this r

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Sanford Stein
Andre, Christopher, and Konstantin, Thank you for your prompt responses and your suggestions. I apologize for not indicating my Tomcat version -- it is 5.5.23. My OS is RHEL 5.6. I am not intentionally sending HTML e-mails--perhaps my Thunderbird client is doing something of which I am unawar

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Francis GALIEGUE
On Tue, Oct 4, 2011 at 21:08, Christopher Schultz wrote: [...] > > - From the docs: > > "If this attribute [allow] is specified, the remote address MUST match > for this request to be accepted". > > "If this attribute [deny] is specified, the remote address MUST NOT > match for this request to be

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Francis, On 10/4/2011 2:53 PM, Francis GALIEGUE wrote: > On Tue, Oct 4, 2011 at 20:46, Christopher Schultz > wrote: >> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >> >> Francis, >> >> On 10/4/2011 2:37 PM, Francis GALIEGUE wrote: >>> On Tue, Oct

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Francis GALIEGUE
On Tue, Oct 4, 2011 at 20:46, Christopher Schultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Francis, > > On 10/4/2011 2:37 PM, Francis GALIEGUE wrote: >> On Tue, Oct 4, 2011 at 19:49, André Warnier wrote: >> [...] >> >>> In this particular case, "\.googlebot\.com$" would be bet

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Francis, On 10/4/2011 2:37 PM, Francis GALIEGUE wrote: > On Tue, Oct 4, 2011 at 19:49, André Warnier wrote: > [...] > >> In this particular case, "\.googlebot\.com$" would be better >> (with the RemoteHostValve). >> > > No, that would not even wo

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Francis GALIEGUE
On Tue, Oct 4, 2011 at 19:49, André Warnier wrote: [...] > In this particular case, "\.googlebot\.com$" would be better (with the > RemoteHostValve). > No, that would not even work, for there is a fatal flaw in all existing Valves and Filters using regexes: they use the .matches() method of Matc

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread André Warnier
Here are the Valves which exist under Tomcat 7.0, the latest version. http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html Which one are you talking about, and which Tomcat version ? Note that org.apache.catalina.valves.RemoteAddrValve can filter on the base of the client /IP address/, not

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sanford, On 10/4/2011 1:21 PM, Sanford Stein wrote: > 1. I am using wildcards in my IP addresses, such as: className="org.apache.catalina.valves.RemoteAddrValve" > deny="*.googlebot.com"/> That doesn't look like a valid regular expression. > From

Re: Denying IPs using the Valve command in context.xml

2011-10-04 Thread Konstantin Kolinko
2011/10/4 Sanford Stein > > 1.  I am using wildcards in my IP addresses, such as: > deny="*.googlebot.com"/> > > From my reading of the documentation, this should be OK, but when this line > is present I cannot access any of my > servlets from any IP address.   Do wildcards work here and, if so,