Securing Solr: Best Practices to Protect Your Data
If you reveal your secrets to the wind, you should not blame the wind for revealing them to the trees. — Kahlil Gibran
Solr’s strength lies primarily in its ability to rapidly index and query vast troves of data. With this powerful ability, however, comes certain caveats. One caveat in particular remains a vitally important consideration when planning your Solr environment: Security.
By its very nature, security is something of an enigma. Documentation is often limited, and is often provided on a strict “need-to-know” basis. In the programming world, security failure response messages are often vague or even non-existent. Further, because security is by design restrictive, it can be problematic. Despite these hurdles, it remains a critical necessity to any enterprise.
When you first install and startup Solr, you’ll notice that no authentication is required. Out-of-the-box, Solr is unsecured. Thus your first consideration is to make sure that Solr is behind an appropriately-configured firewall, and that user permissions on Solr instances are properly locked down. The user under which Solr runs should only have ‘write’ access to the Solr root directory. The firewall layer is really the front line of your defense strategy. From there, you’ll want to consider a variety of software security layers. The final configuration would, of course, depend on the nature of your application, so it’s a good idea to have a solid architecture and corresponding use cases in mind prior to creating a security plan.
As previously mentioned, once you have your hardware firewall established, you’ll want to consider the various possible layers of software security. This would include antivirus/trojan/malware prevention, detection and eradiction applications, real-time behavior monitoring capable of alerting critical users when odd behavior begins to occur, DDOS (Direct Denial of Service) attack detections software, data encryption software, and so on. The combinations are literally limitless, and again, will depend on the end goal of your project.
With your software security layer in place, you can begin securing Solr directly.
Solr is capable of integrating with a variety of third-party authentication frameworks, including LDAP and Kerberos. Since the 5.x release, it also comes with built-in support for Basic Authentication. Basic Authentication will allow you to secure Solr’s admin console, as well as provide collection level granularity.
Beyond console and collection-level security, it is considered best practice to put your own application service in front of Solr, and using, for example, the SolrJ library to communicate with Solr.
In summary, securing your Solr environment requires a good deal of planning and forethought. There are several layers of security that must be addressed in order to make sure your environment is secured from malicious attacks.
In a Nutshell:
- Solr is by default and by design, completely unsecured out-of-the-box. It is vitally important that your Solr instance is behind a firewall, and that box level security is appropriate and limited to only critical users.
- Choose the appropriate suite of software security tools to provide protection against malware, DDOS attacks, and so on.
- Use the Solr BasicAuthentication plugin, or other supported services, to secure the Solr console and collections.
- Create a custom service to provide communication between your client applications and Solr.