Securing Your Public Solr Server

I use Solr for searching on, so I needed to make the server available on my Linode Public Server. I created a subdomain for it, which is cool, but there’s an ittie-bittie problem. Anyone in the world could load-up my Solr Administration Control Panel. First thing to do was lock down my public facing Solr Server so only me and my apps could access it.

We’ll first deal with access to from applications on the server. That’s easy. Since we’re accessing Solr via a localhost there isn’t anything we need in our applications other than change the Solr server address to the public url. External access to is the issue at hand.

Since we’re accessing Solr through Tomcat we’ll use a combination of Tomcat security and Solr security. We add an authorization role-name constraint in our Solr’s Tomcat root/WEB-INF/web.xml. About half-way down we’ve added <role-name>manager</role-name>.

    <web-resource-name>Restrict access to Solr admin</web-resource-name>

Now we add our Solr “manager” role in Tomcat’s conf/tomcat-users.xml file.

<role rolename="manager"/>
<user username="mysolruser" password="mysolrpassword" roles="manager" />

Restart Tomcat and next time you go to your Solr public facing server you’ll see this.