Ticket #39 (new Feature Request)

Opened 9 years ago

Last modified 7 years ago

Select Interface(s) for DeepaMehta Server

Reported by: JuergeN Owned by:
Priority: Critical Milestone:
Component: DeepaMehta Standard Distribution Version:
Keywords: Cc: dgf
Complexity: 3 Area: Runtime
Module:

Description (last modified by JuergeN) (diff)

As the DeepaMehta Server is likely to run in a network environment with several ethernet interface (including the local), it is very important that one can select on which interfaces the service should run.

In general a networked computer has at least two interces, e.g.

lo       127.0.0.1
eth0     192.168.0.1

Not only for security reasons it would be very important to have a choice on which interface(s) the jetty server is answering. Usually this is done in a config file.

Change History

comment:2 Changed 9 years ago by JuergeN

  • Priority changed from Major to Critical
  • Description modified (diff)
  • Area changed from Usability to Runtime

comment:3 Changed 9 years ago by jri

For the moment DM embeds Jetty via the Apache Felix HTTP Jetty OSGi bundle. To my knowledge this bundle provides *no* way to bind the Jetty port to a specific host (= network interface). Whereas the OSGi HTTP Service specifies e.g. a org.osgi.service.http.port configuration property there is no such "host" property. Apache Felix HTTP Jetty solely implements the HTTP Service and no proprietary extensions.

Jetty on its own of course provides such a "host" configuration property and it can be set in different ways:

  • In the jetty.xml configuration file:
    <Set name="host">127.0.0.1</Set>
    
    However, when using the Apache Felix HTTP Jetty bundle there is no such configuration file.
  • From Java:
    new SelectChannelConnector().setHost("127.0.0.1")
    
    However, this is supposed to be done by the *developer of the Felix HTTP Jetty bundle*, not by the application developer who makes use of that bundle.

In short: Jetty itself provides all the configuration possibilities but not when embedded in an OSGi environment via Apache Felix HTTP Jetty bundle.

Please tell us if you know better.

HOWEVER, there *is* a solution: we could replace Apache Felix HTTP Jetty by Pax Web. This is another implementation of the OSGi HTTP Service that goes beyond the OSGi specification. In particular it provides a org.ops4j.pax.web.listening.addresses configuration property.

http://team.ops4j.org/wiki/display/paxweb/Pax+Web
http://team.ops4j.org/wiki/display/paxweb/Basic+Configuration

comment:4 Changed 9 years ago by jri

  • Cc dgf added

comment:5 Changed 9 years ago by adrians

It seems that as of Apache Felix HTTP Service Jetty bundle 2.4 there a property for setting the host interface. Not sure if DM is compatible with the newer Jetty, though.

org.apache.felix.host - Host name or IP Address of the interface to listen on. The default is null causing Jetty to listen on all interfaces.

See http://felix.apache.org/site/apache-felix-http-service.html#ApacheFelixHTTPService-ConfigurationProperties,

comment:6 Changed 9 years ago by jri

Wow, that's good news!
We're currently using Apache Felix HTTP Service Jetty bundle 2.2
However, it seems to me 2.4 is not yet released. It neither appears on the download page nor in the maven repo (only version 2.2 does):
http://felix.apache.org/site/downloads.cgi
http://search.maven.org/#browse%7C35187096
We definitely will switch to 2.4 once it is released.
Thank you for the good news!
Now there is hope for solving the host interface issue soon :-)

BTW: Welcome Adrian!
Please check back with me via email (or use the deepamehta-devel list) if you've DM development questions.

comment:7 Changed 9 years ago by adrians

Hi Jörg - thanks for the welcome. I'll be asking some question soon, I think.

You're right, there's no 2.4 bundle in sight and 2.2.2 seems to be the next in line. I wonder if they were actually referring to that version in the page listing the configuration properties. I will ask on the user mailing list for a confirmation.

comment:8 Changed 9 years ago by jri

That's nice if you check this.
Thanks!

comment:9 Changed 7 years ago by jri

Meanwhile DM is revised in a way switching from Felix HTTP to Pax Web should be easy (Felix' ExtHttpService? is dropped, see #448). We will probably do the switch in DM 4.1.2 (to be released in 2-3 months). We finally get the possibility to select a network interface then.

comment:10 Changed 7 years ago by Jörg Richter

Pax Web success! (#448).

The REST services (the Jersey servlet) is working.
Finally DM runs with Pax Web!

The solution was to register the Jersey servlet at "/*" instead of "/" (which I think is not OSGi compliant and does not work with Felix HTTP Jetty as well). So a single asterisk character did the trick.

You can test it in the "pax-web" branch.

What is missing now is the adaption of the SSL configuration parameters.

BTW: with Pax Web we finally have the opportunity to set the Jetty webserver to listen on a specific network interface (see #39).

You might not consider this possible: yesterday I bought a bottle of spaish red wine called Asterisk. The label is all blank but with a single * on it.

See #448.

Note: See TracTickets for help on using tickets.