You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by ict <ic...@gmail.com> on 2016/07/27 15:03:17 UTC
secure the tomee/ejb path
Hi to all! when deploy an application who have remote interfaces accesible
from remote ('http://localhost:8080/tomee/ejb'), the
access to a potential attacker is freely guaranteed.
How can I protect access even with a simple BASIC authentication?
It is possible, how can I access the remote environment protected by BASIC
Authentication?
tank!
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/secure-the-tomee-ejb-path-tp4679509.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: secure the tomee/ejb path
Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-10-05 23:03 GMT+02:00 Zachary Bedell <zb...@nycourts.gov>:
> I just added a comment to the Github commit on this, but wanted to
> reference it here in case anyone finds this email thread.
>
> https://github.com/apache/tomee/commit/7edb1be6a17efb05a5ca37ff2919ab
> d2a0aabe25
>
>
> This approach causes problems with clustered connections.
>
> If using a clustered URL like "failover:sticky+random:https:
> //1.2.3.4:8443/ejb/invoke?authorization=Basic%20ABCD,
> https://1.2.3.5:8443/ejb/invoke?authorization=Basic%20ABCD", the call to
> URI::getSchemeSpecificPart() in org.apache.openejb.client.
> FailoverConnectionFactory::getConnection() results in the "%20" encoding
> being stripped & replaced with a raw space character. The subsequent call
> to URI.create(remainder) fails with an IllegalArgumentException on the
> index of the space character.
>
> It may be appropriate to change FailoverConnectionFactory to use
> URI::getRawSchemeSpecificPart() or else assume the "Basic " part of the
> header in HttpConnectionFactory. I'm not sure how that class could do
> anything other than basic auth in this situation since there's no facility
> for it to retrieve the nonce or other digest related attributes from the
> HTTP/401 challenge.
>
>
used getRawSchemeSpecificPart
you can use OAuth2 with current implementation for instance so not really
motivated to hardcode Basic.
> I've locally modified this class to append the Basic part itself (IE
> httpURLConnection.setRequestProperty("Authorization", "Basic " +
> params.get("authorization"));) leaving only the base64 encoded credentials
> in the URL. It works fine that way with single or clustered URLs.
>
>
Only works cause base64 encoding will not add spaces or other URL forbidden
character but another token policy can so think the fix was really in
failover factory.
> Best regards,
> Zac Bedell
>
> On Jul 28, 2016, at 05:56, Romain Manni-Bucau <rmannibucau@gmail.com
> <ma...@gmail.com>> wrote:
>
> Well this is not "trivial" since normally you don't do it so no worries
>
> org.apache.openejb.client.ConnectionManager.registerFactory("http", new
> MyConnectionFactory());
> org.apache.openejb.client.ConnectionManager.registerFactory("https", new
> MyConnectionFactory());
>
> Once at startup (= before any remote call).
>
> Side note: you can copy master HttpConnectionFactory to get basic support
> adding ?authorization=Basic%20xxxxxxxx==:
> https://github.com/apache/tomee/blob/master/server/
> openejb-client/src/main/java/org/apache/openejb/client/
> HttpConnectionFactory.java
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-07-28 11:09 GMT+02:00 ict <ic...@gmail.com>:
>
> forgive my inexperience , how do you extend and record the client-side
> class?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/secure-the-tomee-ejb-path-
> tp4679509p4679528.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
>
>
Re: secure the tomee/ejb path
Posted by Zachary Bedell <zb...@nycourts.gov>.
I just added a comment to the Github commit on this, but wanted to reference it here in case anyone finds this email thread.
https://github.com/apache/tomee/commit/7edb1be6a17efb05a5ca37ff2919abd2a0aabe25
This approach causes problems with clustered connections.
If using a clustered URL like "failover:sticky+random:https://1.2.3.4:8443/ejb/invoke?authorization=Basic%20ABCD,https://1.2.3.5:8443/ejb/invoke?authorization=Basic%20ABCD", the call to URI::getSchemeSpecificPart() in org.apache.openejb.client.FailoverConnectionFactory::getConnection() results in the "%20" encoding being stripped & replaced with a raw space character. The subsequent call to URI.create(remainder) fails with an IllegalArgumentException on the index of the space character.
It may be appropriate to change FailoverConnectionFactory to use URI::getRawSchemeSpecificPart() or else assume the "Basic " part of the header in HttpConnectionFactory. I'm not sure how that class could do anything other than basic auth in this situation since there's no facility for it to retrieve the nonce or other digest related attributes from the HTTP/401 challenge.
I've locally modified this class to append the Basic part itself (IE httpURLConnection.setRequestProperty("Authorization", "Basic " + params.get("authorization"));) leaving only the base64 encoded credentials in the URL. It works fine that way with single or clustered URLs.
Best regards,
Zac Bedell
On Jul 28, 2016, at 05:56, Romain Manni-Bucau <rm...@gmail.com>> wrote:
Well this is not "trivial" since normally you don't do it so no worries
org.apache.openejb.client.ConnectionManager.registerFactory("http", new
MyConnectionFactory());
org.apache.openejb.client.ConnectionManager.registerFactory("https", new
MyConnectionFactory());
Once at startup (= before any remote call).
Side note: you can copy master HttpConnectionFactory to get basic support
adding ?authorization=Basic%20xxxxxxxx==:
https://github.com/apache/tomee/blob/master/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-07-28 11:09 GMT+02:00 ict <ic...@gmail.com>:
forgive my inexperience , how do you extend and record the client-side
class?
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/secure-the-tomee-ejb-path-tp4679509p4679528.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: secure the tomee/ejb path
Posted by ict <ic...@gmail.com>.
Work fine! tank!
right to information, the tests I made with them tomee 1.7.4 , and not
with 7.0.x.
And if you can be of help to others , if you use this method to authenticate
, it is not necessary to enhance the properties :
//NOT NECESSARY
p.put("java.naming.security.principal", "user");
p.put("java.naming.security.credentials", "pass");
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/secure-the-tomee-ejb-path-tp4679509p4679539.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: secure the tomee/ejb path
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Well this is not "trivial" since normally you don't do it so no worries
org.apache.openejb.client.ConnectionManager.registerFactory("http", new
MyConnectionFactory());
org.apache.openejb.client.ConnectionManager.registerFactory("https", new
MyConnectionFactory());
Once at startup (= before any remote call).
Side note: you can copy master HttpConnectionFactory to get basic support
adding ?authorization=Basic%20xxxxxxxx==:
https://github.com/apache/tomee/blob/master/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-07-28 11:09 GMT+02:00 ict <ic...@gmail.com>:
> forgive my inexperience , how do you extend and record the client-side
> class?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/secure-the-tomee-ejb-path-tp4679509p4679528.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: secure the tomee/ejb path
Posted by ict <ic...@gmail.com>.
forgive my inexperience , how do you extend and record the client-side class?
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/secure-the-tomee-ejb-path-tp4679509p4679528.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: secure the tomee/ejb path
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,
easiest is IMHO to create physically a tomee webapp (= folder) with the
ServerServlet defined (http://tomee.apache.org/ejbd-transport.html) and
define the webapp security you want in web.xml. It also needs to extend
HttpConnectionFactory (
https://github.com/apache/tomee/blob/master/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java)
and register it on client side to add basic header support - opened
https://issues.apache.org/jira/browse/TOMEE-1889 for that.
To just get security you can use JAAS support of ejbd:
http://tomee.apache.org/ejb-over-ssl.html
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-07-27 17:03 GMT+02:00 ict <ic...@gmail.com>:
> Hi to all! when deploy an application who have remote interfaces accesible
> from remote ('http://localhost:8080/tomee/ejb'), the
> access to a potential attacker is freely guaranteed.
>
>
> How can I protect access even with a simple BASIC authentication?
>
> It is possible, how can I access the remote environment protected by BASIC
> Authentication?
>
> tank!
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/secure-the-tomee-ejb-path-tp4679509.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>