You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Antonio Sanso <as...@adobe.com> on 2014/09/29 10:54:45 UTC

[FELIX-3693] HTTP SSLFilter

hi *,

looking at [FELIX-3693] HTTP SSLFilter [0] specially at the SslFilterRequest it looks to me that the final Request object might end up having this weird behavior:

- request.getScheme() ==> https
- request.getServerPort() ==> 80

and possibly

- request.getRequestURL() ==> https://domain.80/active.html

IMHO having a scheme https with a port 80 might lead to some inconsistencies . WDYT?

regards

antonio

[0] https://issues.apache.org/jira/browse/FELIX-4420

Re: [FELIX-3693] HTTP SSLFilter

Posted by Carsten Ziegeler <cz...@apache.org>.
Right now the filter seems to assume port 80 for https - which is not the
best default we can come up with. So changing this to 443 is the better
option.
However, is there no way to get the real port using a header? Adding a
configuration seems to be the last option for me.

Carsten

2014-09-29 11:34 GMT+02:00 Jan Willem Janssen <ja...@luminis.eu>
:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 29/09/14 11:25, Felix Meschberger wrote:
> > While you are technically correct, the request.getServerPort()
> > should really reflect the port that the actual SSL terminating
> > server is running on.
> >
> > If this is the default port (getServerPort may return -1) this
> > would still be 443 and not 80. So it should probably be checked
> > that we get the SSL terminator’s port right. And this is really the
> > bug: The current SslFilterRequest implementation does not implement
> > the getServerPort method to ensure this.
>
> Still, this is all based on heuristics: the code assumes the SSL
> terminating server runs on the default https port.
>
> Wouldn't it make a lot more sense to make the SslFilter configurable
> wrt what ports it should rewrite? While it requires explicit
> configuration, it makes the code a lot simpler and less bug-prone?
>
> - --
> Met vriendelijke groeten | Kind regards
>
> Jan Willem Janssen | Software Architect
> +31 631 765 814
>
> /My world is revolving around INAETICS and Amdatu/
>
> Luminis Technologies B.V.
> Churchillplein 1
> 7314 BZ   Apeldoorn
> +31 88 586 46 00
>
> http://www.luminis-technologies.com
> http://www.luminis.eu
>
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBAgAGBQJUKSeWAAoJEKF/mP2eHDc4+NIP/1DMT+7FZLLx8VDQAqxpRdFi
> 2t6fAaDR+a+0UeH0vCFgMtgMmIhdJJGUhYeIo979RNuIr7k10zhnmHVPHTx7fgGq
> 9kOkooD1Yw0aGBdrfxtekiUxrAXgS2zm6m1UxS+Tp3tNdwd1kNTJgUnhjFrhtnBv
> /hlaO1Qg7Eu0p9GvKZhbaa3AN1ZGmEmEgpDttNCsJzoYM9LG2gZ8FgAKh58Ojo6D
> 7va7kCa0RivLjGkoagdMM6LuSe7vTwl+yhzRgf6FjXxcHgRyTWyWPf5iqO7rVOFo
> zauQ1Rh3UJTB7dq8j2CCWA5b4KJnfgXK8mo0O0zDnHVRNETdGlDZu3KMPexwNjrC
> d03TtbiLZGx7XZA4x8jEWDeGMxMCg+pWa8VX59BNKq/JmxDgHfj+Pv8YSjuD3htT
> kUw5RNzCBM2SjLupCLqQKU5E5VQpaxjMAcpvGz/JaaamsEh5C7tdWIDuKFW1f2iS
> DWJ/alhE/xrF0wcQyZt+fdBeNA6vsIZ3CI26C+LPoUe4bc20fQMdUFbMtJDYNkqN
> kL0/TrKC5OkoLrgRCLqzg4r0RNQZbfA5wP7P784JfjXZclTUPIWeuyzaP0bodtt/
> 9AjawZvYcuGQBkHZMUUWr4QUJKffNosRVcwJzrBKFA/O2fAQZ7LIv0xaEAaMrxy2
> Xk/TaAfkzzrIgT8idD48
> =lRNe
> -----END PGP SIGNATURE-----
>



-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: [FELIX-3693] HTTP SSLFilter

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

Am 29.09.2014 um 11:34 schrieb Jan Willem Janssen <ja...@luminis.eu>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 29/09/14 11:25, Felix Meschberger wrote:
>> While you are technically correct, the request.getServerPort()
>> should really reflect the port that the actual SSL terminating
>> server is running on.
>> 
>> If this is the default port (getServerPort may return -1) this
>> would still be 443 and not 80. So it should probably be checked
>> that we get the SSL terminator’s port right. And this is really the
>> bug: The current SslFilterRequest implementation does not implement
>> the getServerPort method to ensure this.
> 
> Still, this is all based on heuristics: the code assumes the SSL
> terminating server runs on the default https port.
> 
> Wouldn't it make a lot more sense to make the SslFilter configurable
> wrt what ports it should rewrite? While it requires explicit
> configuration, it makes the code a lot simpler and less bug-prone?

Actually we do port calculation in the response for the sendRedirect support. We should probably apply the same algorithm for the getServerPort method.

Regards
Felix


> 
> - -- 
> Met vriendelijke groeten | Kind regards
> 
> Jan Willem Janssen | Software Architect
> +31 631 765 814
> 
> /My world is revolving around INAETICS and Amdatu/
> 
> Luminis Technologies B.V.
> Churchillplein 1
> 7314 BZ   Apeldoorn
> +31 88 586 46 00
> 
> http://www.luminis-technologies.com
> http://www.luminis.eu
> 
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> 
> iQIcBAEBAgAGBQJUKSeWAAoJEKF/mP2eHDc4+NIP/1DMT+7FZLLx8VDQAqxpRdFi
> 2t6fAaDR+a+0UeH0vCFgMtgMmIhdJJGUhYeIo979RNuIr7k10zhnmHVPHTx7fgGq
> 9kOkooD1Yw0aGBdrfxtekiUxrAXgS2zm6m1UxS+Tp3tNdwd1kNTJgUnhjFrhtnBv
> /hlaO1Qg7Eu0p9GvKZhbaa3AN1ZGmEmEgpDttNCsJzoYM9LG2gZ8FgAKh58Ojo6D
> 7va7kCa0RivLjGkoagdMM6LuSe7vTwl+yhzRgf6FjXxcHgRyTWyWPf5iqO7rVOFo
> zauQ1Rh3UJTB7dq8j2CCWA5b4KJnfgXK8mo0O0zDnHVRNETdGlDZu3KMPexwNjrC
> d03TtbiLZGx7XZA4x8jEWDeGMxMCg+pWa8VX59BNKq/JmxDgHfj+Pv8YSjuD3htT
> kUw5RNzCBM2SjLupCLqQKU5E5VQpaxjMAcpvGz/JaaamsEh5C7tdWIDuKFW1f2iS
> DWJ/alhE/xrF0wcQyZt+fdBeNA6vsIZ3CI26C+LPoUe4bc20fQMdUFbMtJDYNkqN
> kL0/TrKC5OkoLrgRCLqzg4r0RNQZbfA5wP7P784JfjXZclTUPIWeuyzaP0bodtt/
> 9AjawZvYcuGQBkHZMUUWr4QUJKffNosRVcwJzrBKFA/O2fAQZ7LIv0xaEAaMrxy2
> Xk/TaAfkzzrIgT8idD48
> =lRNe
> -----END PGP SIGNATURE-----


Re: [FELIX-3693] HTTP SSLFilter

Posted by Jan Willem Janssen <ja...@luminis.eu>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29/09/14 11:25, Felix Meschberger wrote:
> While you are technically correct, the request.getServerPort()
> should really reflect the port that the actual SSL terminating
> server is running on.
> 
> If this is the default port (getServerPort may return -1) this
> would still be 443 and not 80. So it should probably be checked
> that we get the SSL terminator’s port right. And this is really the
> bug: The current SslFilterRequest implementation does not implement
> the getServerPort method to ensure this.

Still, this is all based on heuristics: the code assumes the SSL
terminating server runs on the default https port.

Wouldn't it make a lot more sense to make the SslFilter configurable
wrt what ports it should rewrite? While it requires explicit
configuration, it makes the code a lot simpler and less bug-prone?

- -- 
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

/My world is revolving around INAETICS and Amdatu/

Luminis Technologies B.V.
Churchillplein 1
7314 BZ   Apeldoorn
+31 88 586 46 00

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org

iQIcBAEBAgAGBQJUKSeWAAoJEKF/mP2eHDc4+NIP/1DMT+7FZLLx8VDQAqxpRdFi
2t6fAaDR+a+0UeH0vCFgMtgMmIhdJJGUhYeIo979RNuIr7k10zhnmHVPHTx7fgGq
9kOkooD1Yw0aGBdrfxtekiUxrAXgS2zm6m1UxS+Tp3tNdwd1kNTJgUnhjFrhtnBv
/hlaO1Qg7Eu0p9GvKZhbaa3AN1ZGmEmEgpDttNCsJzoYM9LG2gZ8FgAKh58Ojo6D
7va7kCa0RivLjGkoagdMM6LuSe7vTwl+yhzRgf6FjXxcHgRyTWyWPf5iqO7rVOFo
zauQ1Rh3UJTB7dq8j2CCWA5b4KJnfgXK8mo0O0zDnHVRNETdGlDZu3KMPexwNjrC
d03TtbiLZGx7XZA4x8jEWDeGMxMCg+pWa8VX59BNKq/JmxDgHfj+Pv8YSjuD3htT
kUw5RNzCBM2SjLupCLqQKU5E5VQpaxjMAcpvGz/JaaamsEh5C7tdWIDuKFW1f2iS
DWJ/alhE/xrF0wcQyZt+fdBeNA6vsIZ3CI26C+LPoUe4bc20fQMdUFbMtJDYNkqN
kL0/TrKC5OkoLrgRCLqzg4r0RNQZbfA5wP7P784JfjXZclTUPIWeuyzaP0bodtt/
9AjawZvYcuGQBkHZMUUWr4QUJKffNosRVcwJzrBKFA/O2fAQZ7LIv0xaEAaMrxy2
Xk/TaAfkzzrIgT8idD48
=lRNe
-----END PGP SIGNATURE-----

Re: [FELIX-3693] HTTP SSLFilter

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

While you are technically correct, the request.getServerPort() should really reflect the port that the actual SSL terminating server is running on.

If this is the default port (getServerPort may return -1) this would still be 443 and not 80. So it should probably be checked that we get the SSL terminator’s port right. And this is really the bug: The current SslFilterRequest implementation does not implement the getServerPort method to ensure this.

Regards
Felix

Am 29.09.2014 um 11:16 schrieb Jan Willem Janssen <ja...@luminis.eu>>:

Signierter PGP Teil
On 29/09/14 10:59, Felix Meschberger wrote:
> Hi Antonio,
>
> I agree this is a bug.
>
>>
>> looking at [FELIX-3693] HTTP SSLFilter [0] specially at the
>> SslFilterRequest it looks to me that the final Request object
>> might end up having this weird behavior:
>>
>> - request.getScheme() ==> https - request.getServerPort() ==> 80
>>
>> and possibly
>>
>> - request.getRequestURL() ==> https://domain.80/active.html
>>
>> IMHO having a scheme https with a port 80 might lead to some
>> inconsistencies . WDYT?

I'm less inclined to immediately state this as a bug. Though it is by
convention to use port 443 for secure HTTP, actually nothing prevents
me from using port 80 instead for secure HTTP.

--
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

/My world is revolving around INAETICS and Amdatu/

Luminis Technologies B.V.
Churchillplein 1
7314 BZ   Apeldoorn
+31 88 586 46 00

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01



Re: [FELIX-3693] HTTP SSLFilter

Posted by Jan Willem Janssen <ja...@luminis.eu>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29/09/14 10:59, Felix Meschberger wrote:
> Hi Antonio,
> 
> I agree this is a bug.
> 
>> 
>> looking at [FELIX-3693] HTTP SSLFilter [0] specially at the 
>> SslFilterRequest it looks to me that the final Request object
>> might end up having this weird behavior:
>> 
>> - request.getScheme() ==> https - request.getServerPort() ==> 80
>> 
>> and possibly
>> 
>> - request.getRequestURL() ==> https://domain.80/active.html
>> 
>> IMHO having a scheme https with a port 80 might lead to some 
>> inconsistencies . WDYT?

I'm less inclined to immediately state this as a bug. Though it is by
convention to use port 443 for secure HTTP, actually nothing prevents
me from using port 80 instead for secure HTTP.

- -- 
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

/My world is revolving around INAETICS and Amdatu/

Luminis Technologies B.V.
Churchillplein 1
7314 BZ   Apeldoorn
+31 88 586 46 00

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org

iQIcBAEBAgAGBQJUKSNkAAoJEKF/mP2eHDc4A8kP/iaeXSiFyRHDK+/6i4f/Hid3
2xyX3mV2yfpMgemxEPH4ku+fR/FdCjWfwmCKGuq/JDrHxunURSECaJbx3k3LEwVo
vH3otih01dyUz4hYM2AQiFjkByiFZTXS5nfkisbS8nZ/FfSGiag3h2AjlIZZd0kO
9jGI/8sgfsQKU9eqvnVr9SlNI4jQQiD5NN4I6ylemvYMoG5i3W87ykcf9RXSaStl
Z3Ay2Q0moeKImlzjrm2rxaBe3/ceuQLfeRcS3y/ejLkRRb4M01WE/rQ+2zuDUCPG
xhZg5OdB4UOEFNDFKMqPsnztNyIw521tLf/8e4NtZSVY3GPuoa+lQqsiIx7c/aJP
VgsXZjdD9OdZvEDr+v1J35TSrUP7YV9zOC/1Iw/bKUWc4PzB3FBQlkHg/f8AHsHn
60q+mY+epN6yxWx6SO8oQk/DKMy8FRIwbamg/Ce216S47PDBQ0baduhSGQRXqfcY
8Hk/H6DjeVGNeiz77nutvh9cuYYIjANef4rGmJfSbePRNQVru+0AMIFG8TliU24r
jTaBMYNwKdjdniEHSa85qyFyPMaWyS9hAEVaZkkeqmGLNEZD/ohsXHRncXS8tPFH
Y9+DETgnJorK9uKxbe47ZsVu3ICNxTGExR/UpE8zC3zufZV2E2mYzFH8iukHmN+l
I/6Rtaighbwm2l8et2HZ
=3Iwb
-----END PGP SIGNATURE-----

Re: [FELIX-3693] HTTP SSLFilter

Posted by Felix Meschberger <fm...@adobe.com>.
Hi Antonio,

I agree this is a bug.

Regards
Felix

Am 29.09.2014 um 10:54 schrieb Antonio Sanso <as...@adobe.com>:

> hi *,
> 
> looking at [FELIX-3693] HTTP SSLFilter [0] specially at the SslFilterRequest it looks to me that the final Request object might end up having this weird behavior:
> 
> - request.getScheme() ==> https
> - request.getServerPort() ==> 80
> 
> and possibly
> 
> - request.getRequestURL() ==> https://domain.80/active.html
> 
> IMHO having a scheme https with a port 80 might lead to some inconsistencies . WDYT?
> 
> regards
> 
> antonio
> 
> [0] https://issues.apache.org/jira/browse/FELIX-4420


Re: [FELIX-3693] HTTP SSLFilter

Posted by Felix Meschberger <fm...@adobe.com>.
Yes.

Regards
Felix

Am 29.09.2014 um 12:07 schrieb Antonio Sanso <as...@adobe.com>:

> thanks Felix . So IIUC the logic is based on the presence of the X-Forwarded-Port header right :))?
> 
> regards
> 
> antonio
> 
> On Sep 29, 2014, at 11:47 AM, Antonio Sanso <as...@adobe.com>> wrote:
> 
> (sorry I am not subscribed to the list)
> 
> the configuration options proposed by Jan is a good solution IMHO.
> 
> regards
> 
> antonio
> 
> On Sep 29, 2014, at 10:54 AM, Antonio Sanso <as...@adobe.com>> wrote:
> 
> hi *,
> 
> looking at [FELIX-3693] HTTP SSLFilter [0] specially at the SslFilterRequest it looks to me that the final Request object might end up having this weird behavior:
> 
> - request.getScheme() ==> https
> - request.getServerPort() ==> 80
> 
> and possibly
> 
> - request.getRequestURL() ==> https://domain.80/active.html
> 
> IMHO having a scheme https with a port 80 might lead to some inconsistencies . WDYT?
> 
> regards
> 
> antonio
> 
> [0] https://issues.apache.org/jira/browse/FELIX-4420
> 
> 


Re: [FELIX-3693] HTTP SSLFilter

Posted by Antonio Sanso <as...@adobe.com>.
thanks Felix . So IIUC the logic is based on the presence of the X-Forwarded-Port header right :))?

regards

antonio

On Sep 29, 2014, at 11:47 AM, Antonio Sanso <as...@adobe.com>> wrote:

(sorry I am not subscribed to the list)

the configuration options proposed by Jan is a good solution IMHO.

regards

antonio

On Sep 29, 2014, at 10:54 AM, Antonio Sanso <as...@adobe.com>> wrote:

hi *,

looking at [FELIX-3693] HTTP SSLFilter [0] specially at the SslFilterRequest it looks to me that the final Request object might end up having this weird behavior:

- request.getScheme() ==> https
- request.getServerPort() ==> 80

and possibly

- request.getRequestURL() ==> https://domain.80/active.html

IMHO having a scheme https with a port 80 might lead to some inconsistencies . WDYT?

regards

antonio

[0] https://issues.apache.org/jira/browse/FELIX-4420



Re: [FELIX-3693] HTTP SSLFilter

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

Am 29.09.2014 um 11:47 schrieb Antonio Sanso <as...@adobe.com>:

> (sorry I am not subscribed to the list)

You should be subscribing :-)

> 
> the configuration options proposed by Jan is a good solution IMHO.

Look at how we do it in the SslFilterResponse class. The SslFilterRequest.getServerPort should (must?) apply the same logic.

Regards
Felix

> 
> regards
> 
> antonio
> 
> On Sep 29, 2014, at 10:54 AM, Antonio Sanso <as...@adobe.com>> wrote:
> 
> hi *,
> 
> looking at [FELIX-3693] HTTP SSLFilter [0] specially at the SslFilterRequest it looks to me that the final Request object might end up having this weird behavior:
> 
> - request.getScheme() ==> https
> - request.getServerPort() ==> 80
> 
> and possibly
> 
> - request.getRequestURL() ==> https://domain.80/active.html
> 
> IMHO having a scheme https with a port 80 might lead to some inconsistencies . WDYT?
> 
> regards
> 
> antonio
> 
> [0] https://issues.apache.org/jira/browse/FELIX-4420
> 


Re: [FELIX-3693] HTTP SSLFilter

Posted by Antonio Sanso <as...@adobe.com>.
(sorry I am not subscribed to the list)

the configuration options proposed by Jan is a good solution IMHO.

regards

antonio

On Sep 29, 2014, at 10:54 AM, Antonio Sanso <as...@adobe.com>> wrote:

hi *,

looking at [FELIX-3693] HTTP SSLFilter [0] specially at the SslFilterRequest it looks to me that the final Request object might end up having this weird behavior:

- request.getScheme() ==> https
- request.getServerPort() ==> 80

and possibly

- request.getRequestURL() ==> https://domain.80/active.html

IMHO having a scheme https with a port 80 might lead to some inconsistencies . WDYT?

regards

antonio

[0] https://issues.apache.org/jira/browse/FELIX-4420