You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Felipe Gasper <fe...@felipegasper.com> on 2019/06/15 15:15:31 UTC
unix socket or D-Bus?
Hello,
Has it ever been proposed to have Solr listen on a UNIX socket or D-Bus rather than TCP?
This would alleviate the need for local Solr integrations (e.g., Dovecot) to store “dummy” credentials, and it would tighten security by eliminating the possibility for those credentials to be stolen.
Thank you!
-Felipe Gasper
Mississauga, Ontario
Re: unix socket or D-Bus?
Posted by Felipe Gasper <fe...@felipegasper.com>.
> On Jun 17, 2019, at 1:17 PM, Shawn Heisey <ap...@elyograg.org> wrote:
>
>> Ideally I’d like Solr/Jetty to be able to white-list any connection from a root-owned socket.
>
> Solr typically runs as a non-privileged user. If the start script detects that it's running as root, it will refuse to start without an option to force it. We strongly recommend not running as root. About the only legitimate reason to run as root is to bind to a port number below 1025... and that is discouraged because Solr should never be accessible by the open Internet.
Solr wouldn’t need to run as root; the process just needs to determine whom it’s talking to, which the kernel can answer regardless of the server’s privilege level.
I’m new to Java, but the jnr.unixsocket library--which Jetty uses for its UNIX socket logic--does provide this information:
https://github.com/jnr/jnr-unixsocket/blob/master/src/main/java/jnr/unixsocket/UnixSocket.java
On the Solr side, then, would it be a matter of creating a new plugin as an alternative to BasicAuthPlugin that manipulates whatever control Jetty exposes (or would need to be altered to expose) that exposes the socket credentials from jnr.unixsocket?
-FG
Re: unix socket or D-Bus?
Posted by Shawn Heisey <ap...@elyograg.org>.
On 6/16/2019 10:43 PM, Felipe Gasper wrote:
> Does Solr do its own authentication, or does Jetty do that? One of the benefits of UNIX sockets is that the socket exposes the peer’s credentials, so Solr/Jetty could implement logic that says, “ah, you’re root? Cool, you’re in.”
As far as I know, when authentication is configured in Solr, Solr takes
that config and uses the Servlet API to configure authentication, and
then that is handled by the container. Which is Jetty, unless the user
takes the webapp and installs it in another container.
> Ideally I’d like Solr/Jetty to be able to white-list any connection from a root-owned socket.
Solr typically runs as a non-privileged user. If the start script
detects that it's running as root, it will refuse to start without an
option to force it. We strongly recommend not running as root. About
the only legitimate reason to run as root is to bind to a port number
below 1025... and that is discouraged because Solr should never be
accessible by the open Internet.
I'm sure that configuring a socket would be outside of Solr entirely --
all in Jetty. I don't know that any of the built-in Solr client stuff
can use a socket, though -- that would likely need to be a custom client.
> D-Bus is an IPC mechanism that most (if not all) Linux distros--and several other OSes--run as a standard daemon. Notable uses include systemd and X-based applications, but any service can expose an interface on D-Bus. It would be an alternative to REST, one advantage of which being that Solr could send messages itself rather than merely answering requests.
I don't think Jetty can do that. Maybe another container can ... but
you'd be in unsupported territory at that point. And you'd need to have
a custom client for this too.
https://wiki.apache.org/solr/WhyNoWar
Thanks,
Shawn
Re: unix socket or D-Bus?
Posted by Felipe Gasper <fe...@felipegasper.com>.
> On Jun 15, 2019, at 1:50 PM, Shawn Heisey <ap...@elyograg.org> wrote:
>
> On 6/15/2019 9:15 AM, Felipe Gasper wrote:
>> Has it ever been proposed to have Solr listen on a UNIX socket or D-Bus rather than TCP?
>> This would alleviate the need for local Solr integrations (e.g., Dovecot) to store “dummy” credentials, and it would tighten security by eliminating the possibility for those credentials to be stolen.
>
> Since Solr is currently a webapp and doesn't have any networking code, that would have to be implemented by the container, which is currently Jetty.
>
> It looks like Jetty does have an option that implements UNIX sockets. Using it would require adding at least one jar to Jetty (in server/lib), and might require adding other files to enable the module. By adding the necessary bits and configuring it correctly, you could enable listening on a socket in your setup. You might need to ask the jetty mailing list for help with exactly what needs to be added.
Cool!
Does Solr do its own authentication, or does Jetty do that? One of the benefits of UNIX sockets is that the socket exposes the peer’s credentials, so Solr/Jetty could implement logic that says, “ah, you’re root? Cool, you’re in.”
Ideally I’d like Solr/Jetty to be able to white-list any connection from a root-owned socket.
> I do not see the word "bus" on the documentation page for Jetty connectors ... if d-bus is different than UNIX sockets, that might not be possible.
D-Bus is an IPC mechanism that most (if not all) Linux distros--and several other OSes--run as a standard daemon. Notable uses include systemd and X-based applications, but any service can expose an interface on D-Bus. It would be an alternative to REST, one advantage of which being that Solr could send messages itself rather than merely answering requests.
-F
Re: unix socket or D-Bus?
Posted by Shawn Heisey <ap...@elyograg.org>.
On 6/15/2019 9:15 AM, Felipe Gasper wrote:
> Has it ever been proposed to have Solr listen on a UNIX socket or D-Bus rather than TCP?
>
> This would alleviate the need for local Solr integrations (e.g., Dovecot) to store “dummy” credentials, and it would tighten security by eliminating the possibility for those credentials to be stolen.
Since Solr is currently a webapp and doesn't have any networking code,
that would have to be implemented by the container, which is currently
Jetty.
It looks like Jetty does have an option that implements UNIX sockets.
Using it would require adding at least one jar to Jetty (in server/lib),
and might require adding other files to enable the module. By adding
the necessary bits and configuring it correctly, you could enable
listening on a socket in your setup. You might need to ask the jetty
mailing list for help with exactly what needs to be added.
I do not see the word "bus" on the documentation page for Jetty
connectors ... if d-bus is different than UNIX sockets, that might not
be possible.
https://www.eclipse.org/jetty/documentation/9.4.x/configuring-connectors.html
It is already possible for any user to configure the included Jetty to
listen only on localhost, so you may meet resistance to getting sockets
added to the upstream codebase. To configure Jetty to listen only on
localhost, just define SOLR_JETTY_HOST and set that variable to
something like 127.0.0.1. The solr script will then use that variable
to define the jetty.host java system property, which the Jetty config
included with Solr will honor.
Information about setting the jetty host is not in the reference guide,
and an example is not in solr.in.sh, but it is in solr.in.cmd. Perhaps
that should be added.
Thanks,
Shawn