Hi Petter,

I'm on Solr 5.2.1 which comes with Jetty 9.2.  I'm setting this up on
Windows 2012 but will need to do the same on Linux too.

I followed the step per this link:
https://wiki.apache.org/solr/SolrSecurity#Jetty_realm_example very much to
the book.  Here are the changes I made:

File: C:\Solr\solr-5.2.1\server\etc\webdefault.xml

      <security-constraint>
        <web-resource-collection>
          <web-resource-name>Solr authenticated
application</web-resource-name>
          <url-pattern>/db/*</url-pattern>
        </web-resource-collection>
       <auth-constraint>
          <role-name>db-role</role-name>
        </auth-constraint>
      </security-constraint>

    <login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>Test Realm</realm-name>
    </login-config>

File: E:\Solr\solr-5.2.1\server\etc\jetty.xml

        <New class="org.eclipse.jetty.security.HashLoginService">
          <Set name="name">Test Realm</Set>
          <Set name="config"><SystemProperty name="jetty.home"
default="."/>/etc/realm.properties</Set>
          <Set name="refreshInterval">0</Set>
   <Call name="start"></Call>
        </New>

File: E:\Solr\solr-5.2.1\server\etc\realm.properties

    admin: admin, db-role

I then restarted Solr.  After this, accessing http://localhost:8983/solr/
gives me:

        HTTP ERROR: 404

        Problem accessing /solr/. Reason:

            Not Found
        Powered by Jetty://

In a previous post, I asked if anyone has setup Solr 5.2.1 or any 5.x with
Basic Auth and got it working, I have not heard back.  Either this feature
is not tested or not in use.  If it is not in use, how do folks secure
their Solr instance?

Thanks

Steve

On Thu, Jul 23, 2015 at 2:52 PM, Peter Sturge <peter.stu...@gmail.com>
wrote:

> Hi Steve,
>
> What version of Jetty are you using?
>
> Have you got a webdefault.xml in your etc folder?
> If so, does it have an entry like this:
>
>   <login-config>
>     <auth-method>BASIC</auth-method>
>     <realm-name>Realm Name as specified in jetty.xml</realm-name>
>   </login-config>
>
> It's been a few years since I set this up, but I believe you also need an
> auth-constraint in webdefault.xml - this tells jetty which apps are using
> which realms:
>
>   <security-constraint>
>     <web-resource-collection>
>       <web-resource-name>A web application name</web-resource-name>
>       <url-pattern>/*</url-pattern>
>     </web-resource-collection>
>     <auth-constraint>
>       <role-name>default-role</role-name>
>     </auth-constraint>
>   </security-constraint>
>
> Your realm.properties should then have user account entries for the role
> similar to:
>
> admin: some-cred, default-role
>
>
> Hope this helps,
> Peter
>
>
> On Thu, Jul 23, 2015 at 7:41 PM, Steven White <swhite4...@gmail.com>
> wrote:
>
> > (re-posting as new email thread to see if this will make it to the list)
> >
> >
> > That didn't help.  I still get the same result and virtually no log to
> help
> > me figure out where / what things are going wrong.
> >
> > Here is all that I see in C:\Solr\solr-5.2.1\server\logs\solr.log:
> >
> >   INFO  - 2015-07-23 05:29:12.065; [   ] org.eclipse.jetty.util.log.Log;
> > Logging initialized @286ms
> >   INFO  - 2015-07-23 05:29:12.231; [   ] org.eclipse.jetty.server.Server;
> > jetty-9.2.10.v20150310
> >   WARN  - 2015-07-23 05:29:12.240; [   ]
> > org.eclipse.jetty.server.handler.RequestLogHandler; !RequestLog
> >   INFO  - 2015-07-23 05:29:12.255; [   ]
> > org.eclipse.jetty.server.AbstractConnector; Started
> > ServerConnector@5a5fae16
> > {HTTP/1.1}{0.0.0.0:8983}
> >   INFO  - 2015-07-23 05:29:12.256; [   ] org.eclipse.jetty.server.Server;
> > Started @478ms
> >
> > Does anyone know where / what logs I should turn on to debug this?
> Should
> > I be posting this issue on the Jetty mailing list?
> >
> > Steve
> >
> >
> > On Wed, Jul 22, 2015 at 10:34 AM, Peter Sturge <peter.stu...@gmail.com>
> >  wrote:
> >
> > > Try adding the "start" call in your jetty.xml:
> > >             <Set name="name">Realm Name</Set>
> > >             <Set name="config"><SystemProperty name="jetty.home"
> > > default="."/>/etc/realm.properties</Set>
> > >             <Set name="refreshInterval">5</Set>
> > >             <Call name="start"></Call>
> >
>

Reply via email to