{"id":543,"date":"2020-02-13T17:17:43","date_gmt":"2020-02-13T17:17:43","guid":{"rendered":"https:\/\/www.aeologic.com\/blog\/?p=543"},"modified":"2020-03-18T08:11:39","modified_gmt":"2020-03-18T08:11:39","slug":"ultimate-solr-guide-9-securing-solr-instance","status":"publish","type":"post","link":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/","title":{"rendered":"Securing Solr &#8211; Ultimate Solr Guide"},"content":{"rendered":"<p>Hello Everyone! We are back with another interesting post on Solr. One of the crucial requirements while setting up a solr application is to provide selective access to various resources allocated on the solr instance. Put simply, we need a mechanism to handle who logs in to the server and no unintended party gets access to various resources. When planning how to secure Solr, one should consider which of the available features or approaches are right for them.<\/p>\n<p>There are following ways to authenticate the users:<\/p>\n<ul>\n<li><strong>Kerberos Authentication Plugin:<\/strong>\n<ul>\n<li>If you are using Kerberos to secure your network environment, the Kerberos authentication plugin can be used to secure a Solr cluster. This allows Solr to use a Kerberos service principal and keytab file to authenticate with ZooKeeper and between nodes of the Solr cluster (if applicable). Users of the Admin UI and all clients would also need to have a valid ticket before being able to use the UI or send requests to Solr.<\/li>\n<li>When setting up Solr to use Kerberos, configurations are put in place for Solr to use a\u00a0<em>service principal<\/em>, or a Kerberos username, which is registered with the Key Distribution Center (KDC) to authenticate requests. The configurations define the service principal name and the location of the keytab file that contains the credentials.<\/li>\n<li>The Solr authentication model uses a file called\u00a0<code>security.json<\/code>. If this file is created after an initial startup of Solr, a restart of each node of the system is required.<\/li>\n<li>\n<h3 id=\"service-principals-and-keytab-files\" class=\"clickable-header\">Service Principals and Keytab Files<\/h3>\n<div class=\"paragraph\">\n<p>Each Solr node must have a service principal registered with the Key Distribution Center (KDC). The Kerberos plugin uses SPNego to negotiate authentication.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Using\u00a0<code>HTTP\/host1@YOUR-DOMAIN.ORG<\/code>, as an example of a service principal:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li><code>HTTP<\/code>\u00a0indicates the type of requests which this service principal will be used to authenticate. The\u00a0<code>HTTP\/<\/code>\u00a0in the service principal is a must for SPNego to work with requests to Solr over HTTP.<\/li>\n<li><code>host1<\/code> is the hostname of the machine hosting the Solr node.<\/li>\n<li><code>YOUR-DOMAIN.ORG<\/code> is the organization-wide Kerberos realm.<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>Multiple Solr nodes on the same host may have the same service principal since the hostname is common to them all.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Along with the service principal, each Solr node needs a keytab file that should contain the credentials of the service principal used. A keytab file contains encrypted credentials to support passwordless logins while obtaining Kerberos tickets from the KDC. For each Solr node, the keytab file should be kept in a secure location and not shared with users of the cluster.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Since a Solr cluster requires internode communication, each node must also be able to make Kerberos enabled requests to other nodes. By default, Solr uses the same service principal and keytab as a &#8216;client principal&#8217; for internode communication.<\/p>\n<h3 id=\"kerberized-zookeeper\" class=\"clickable-header\">Kerberized ZooKeeper<\/h3>\n<div class=\"paragraph\">\n<p>When setting up a kerberized SolrCloud cluster, it is recommended to enable Kerberos security for ZooKeeper as well.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>In such a setup, the client principal used to authenticate requests with ZooKeeper can be shared for internode communication as well. This has the benefit of not needing to renew the ticket granting tickets (TGTs) separately, since the ZooKeeper client used by Solr takes care of this. To achieve this, a single JAAS configuration (with the app name as Client) can be used for the Kerberos plugin as well as for the ZooKeeper client.<\/p>\n<h3 id=\"zookeeper-configuration\" class=\"clickable-header\">ZooKeeper Configuration<\/h3>\n<div class=\"paragraph\">\n<p>If you are using a ZooKeeper that has already been configured to use Kerberos, you can skip the ZooKeeper-related steps shown here.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Since ZooKeeper manages the communication between nodes in a SolrCloud cluster, it must also be able to authenticate with each node of the cluster. Configuration requires setting up a service principal for ZooKeeper, defining a JAAS configuration file and instructing ZooKeeper to use both of those items.<\/p>\n<h3 id=\"create-security-json\" class=\"clickable-header\">Create security.json<\/h3>\n<div class=\"paragraph\">\n<p>Create the\u00a0<code>security.json<\/code>\u00a0file.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>In SolrCloud mode, you can set up Solr to use the Kerberos plugin by uploading the\u00a0<code>security.json<\/code>\u00a0to ZooKeeper while you create it, as follows:<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-544\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14.png\" alt=\"\" width=\"885\" height=\"193\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14.png 2048w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-300x65.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-768x167.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-1024x223.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-720x157.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-1180x257.png 1180w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-260x57.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-367x80.png 367w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-14-250x54.png 250w\" sizes=\"(max-width: 885px) 100vw, 885px\" \/><\/p>\n<p>If you are using Solr in standalone mode, you need to create the\u00a0<code>security.json<\/code>\u00a0file and put it in your\u00a0<code>$SOLR_HOME<\/code>\u00a0directory.<\/p>\n<h3 id=\"define-a-jaas-configuration-file\" class=\"clickable-header\">Define a JAAS Configuration File<\/h3>\n<div class=\"paragraph\">\n<p>The JAAS configuration file defines the properties to use for authentication, such as the service principal and the location of the keytab file. Other properties can also be set to ensure ticket caching and other features.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The following example can be copied and modified slightly for your environment. The location of the file can be anywhere on the server, but it will be referenced when starting Solr so it must be readable on the filesystem. The JAAS file may contain multiple sections for different users, but each section must have a unique name so it can be uniquely referenced in each application.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>In the below example, we have created a JAAS configuration file with the name and path of\u00a0<code>\/home\/foo\/jaas-client.conf<\/code>. We will use this name and path when we define the Solr start parameters in the next section. Note that the client\u00a0<code>principal<\/code>\u00a0here is the same as the service principal. This will be used to authenticate internode requests and requests to ZooKeeper. Make sure to use the correct\u00a0<code>principal<\/code>\u00a0hostname and the\u00a0<code>keyTab<\/code> file path.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-545\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15.png\" alt=\"\" width=\"738\" height=\"441\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15.png 1228w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-300x179.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-768x459.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-1024x612.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-720x430.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-1180x705.png 1180w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-260x155.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-134x80.png 134w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-15-250x149.png 250w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/p>\n<div class=\"paragraph\">\n<p>The first line of this file defines the section name, which will be used with the\u00a0<code>solr.kerberos.jaas.appname<\/code>\u00a0parameter, defined below.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The main properties we are concerned with are the\u00a0<code>keyTab<\/code>\u00a0and\u00a0<code>principal<\/code> properties, but there are others which may be required for your environment.<\/p>\n<div class=\"sect2\">\n<div class=\"paragraph\">\n<p>For reference the ones in use in the above example are explained here:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li><code>useKeyTab<\/code>: this boolean property defines if we should use a keytab file (true, in this case).<\/li>\n<li><code>keyTab<\/code>: the location and name of the keytab file for the principal this section of the JAAS configuration file is for. The path should be enclosed in double-quotes.<\/li>\n<li><code>storeKey<\/code>: this boolean property allows the key to be stored in the private credentials of the user.<\/li>\n<li><code>useTicketCache<\/code>: this boolean property allows the ticket to be obtained from the ticket cache.<\/li>\n<li><code>debug<\/code>: this boolean property will output debug messages for help in troubleshooting.<\/li>\n<li><code>principal<\/code>: the name of the service principal to be used.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"solr-startup-parameters\" class=\"clickable-header\">Solr Startup Parameters<\/h3>\n<div class=\"paragraph\">\n<p>While starting up Solr, the following host-specific parameters need to be passed. These parameters can be passed at the command line with the\u00a0<code>bin\/solr<\/code> start command or defined in\u00a0<code>bin\/solr.in.sh<\/code>\u00a0or\u00a0<code>bin\/solr.in.cmd<\/code>\u00a0as appropriate for your operating system.<\/p>\n<div class=\"dlist\">\n<dl>\n<dt class=\"hdlist1\"><code>solr.kerberos.name.rules<\/code><\/dt>\n<dd>Used to map Kerberos principals to short names. Default value is\u00a0<code>DEFAULT<\/code>. Example of a name rule:\u00a0<code>RULE:[1:$1@$0](.*EXAMPLE.COM)s\/@.*\/\/<\/code>.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.cookie.domain<\/code><\/dt>\n<dd>Used to issue cookies and should have the hostname of the Solr node. This parameter is required.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.cookie.portaware<\/code><\/dt>\n<dd>When set to\u00a0<code>true<\/code>, cookies are differentiated based on host and port, as opposed to standard cookies which are not port aware. This should be set if more than one Solr node is hosted on the same host. The default is\u00a0<code>false<\/code>.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.principal<\/code><\/dt>\n<dd>The service principal. This parameter is required.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.keytab<\/code><\/dt>\n<dd>Keytab file path containing service principal credentials. This parameter is required.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.jaas.appname<\/code><\/dt>\n<dd>The app name (section name) within the JAAS configuration file which is required for internode communication. Default is\u00a0<code>Client<\/code>, which is used for ZooKeeper authentication as well. If different users are used for ZooKeeper and Solr, they will need to have separate sections in the JAAS configuration file.<\/dd>\n<dt class=\"hdlist1\"><code>java.security.auth.login.config<\/code><\/dt>\n<dd>Path to the JAAS configuration file for configuring a Solr client for internode communication. This parameter is required.<\/dd>\n<\/dl>\n<\/div>\n<div class=\"paragraph\">\n<p>Here is an example that could be added to\u00a0<code>bin\/solr.in.sh<\/code>. Make sure to change this example to use the right hostname and the keytab file path.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-547\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16.png\" alt=\"\" width=\"979\" height=\"265\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16.png 2048w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-300x81.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-768x208.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-1024x277.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-720x195.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-1180x319.png 1180w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-260x70.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-296x80.png 296w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-16-250x68.png 250w\" sizes=\"(max-width: 979px) 100vw, 979px\" \/><\/p>\n<h3 id=\"using-delegation-tokens\" class=\"clickable-header\">Using Delegation Tokens<\/h3>\n<div class=\"paragraph\">\n<p>The Kerberos plugin can be configured to use delegation tokens, which allow an application to reuse the authentication of an end-user or another application.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>There are a few use cases for Solr where this might be helpful:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>Using distributed clients (such as MapReduce) where each client may not have access to the user\u2019s credentials.<\/li>\n<li>When load on the Kerberos server is high. Delegation tokens can reduce the load because they do not access the server after the first request.<\/li>\n<li>If requests or permissions need to be delegated to another user.<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>To enable delegation tokens, several parameters must be defined. These parameters can be passed at the command line with the\u00a0<code>bin\/solr<\/code> start command.<\/p>\n<div class=\"sect2\">\n<div class=\"dlist\">\n<dl>\n<dt class=\"hdlist1\"><code>solr.kerberos.delegation.token.enabled<\/code><\/dt>\n<dd>This is\u00a0<code>false<\/code>\u00a0by default, set to\u00a0<code>true<\/code>\u00a0to enable delegation tokens. This parameter is required if you want to enable tokens.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.delegation.token.kind<\/code><\/dt>\n<dd>The type of delegation tokens. By default this is\u00a0<code>solr-dt<\/code>. Likely this does not need to change. No other option is available at this time.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.delegation.token.validity<\/code><\/dt>\n<dd>Time, in seconds, for which delegation tokens are valid. The default is 36000 seconds.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.delegation.token.signer.secret.provider<\/code><\/dt>\n<dd>Where delegation token information is stored internally. The default is\u00a0<code>zookeeper<\/code>\u00a0which must be the location for delegation tokens to work across Solr servers (when running in SolrCloud mode). No other option is available at this time.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.delegation.token.signer.secret.provider.zookeper.path<\/code><\/dt>\n<dd>The ZooKeeper path where the secret provider information is stored. This is in the form of the path + \/security\/token. The path can include the chroot or the chroot can be omitted if you are not using it. This example includes the chroot:\u00a0<code>server1:9983,server2:9983,server3:9983\/solr\/security\/token<\/code>.<\/dd>\n<dt class=\"hdlist1\"><code>solr.kerberos.delegation.token.secret.manager.znode.working.path<\/code><\/dt>\n<dd>The ZooKeeper path where token information is stored. This is in the form of the path + \/security\/zkdtsm. The path can include the chroot or the chroot can be omitted if you are not using it. This example includes the chroot:\u00a0<code>server1:9983,server2:9983,server3:9983\/solr\/security\/zkdtsm<\/code>.<\/p>\n<h3 id=\"start-solr\" class=\"clickable-header\">Start Solr<\/h3>\n<div class=\"paragraph\">\n<p>Once the configuration is complete, you can start Solr with the\u00a0<code>bin\/solr<\/code>\u00a0script, as in the example below, which is for users in SolrCloud mode only. This example assumes you modified\u00a0<code>bin\/solr.in.sh<\/code>\u00a0or\u00a0<code>bin\/solr.in.cmd<\/code>, with the proper values, but if you did not, you would pass the system parameters along with the start command. Note you also need to customize the\u00a0<code>-z<\/code>\u00a0property as appropriate for the location of your ZooKeeper nodes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-548\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-17.png\" alt=\"\" width=\"639\" height=\"223\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-17.png 639w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-17-300x105.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-17-260x91.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-17-229x80.png 229w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-17-250x87.png 250w\" sizes=\"(max-width: 639px) 100vw, 639px\" \/><\/p>\n<\/div>\n<\/dd>\n<\/dl>\n<\/div>\n<\/div>\n<div class=\"sect2\">\n<h2 id=\"using-solrj-with-a-kerberized-solr\" class=\"clickable-header top-level-header\">Using SolrJ with a Kerberized Solr<\/h2>\n<p>&nbsp;<\/p>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>To use Kerberos authentication in a SolrJ application, you need the following two lines before you create a SolrClient:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-549\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18.png\" alt=\"\" width=\"858\" height=\"241\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18.png 858w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18-300x84.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18-768x216.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18-720x202.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18-260x73.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18-285x80.png 285w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-18-250x70.png 250w\" sizes=\"(max-width: 858px) 100vw, 858px\" \/><\/p>\n<p>You need to specify a Kerberos service principal for the client and a corresponding keytab in the JAAS client configuration file above. This principle should be different from the service principal we created for Solr.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-550\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-19.png\" alt=\"\" width=\"614\" height=\"349\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-19.png 614w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-19-300x171.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-19-260x148.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-19-141x80.png 141w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-19-250x142.png 250w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/p>\n<h3 id=\"delegation-tokens-with-solrj\" class=\"clickable-header\">Delegation Tokens with SolrJ<\/h3>\n<div class=\"paragraph\">\n<p>Delegation tokens are also supported with SolrJ, in the following ways:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li><code>DelegationTokenRequest<\/code>\u00a0and\u00a0<code>DelegationTokenResponse<\/code>\u00a0can be used to get, cancel, and renew delegation tokens.<\/li>\n<li><code>HttpSolrClient.Builder<\/code>\u00a0includes a\u00a0<code>withDelegationToken<\/code>\u00a0function for creating an HttpSolrClient that uses a delegation token to authenticate.<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>Sample code to get a delegation token:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-551\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20.png\" alt=\"\" width=\"800\" height=\"329\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20-300x123.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20-768x316.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20-720x296.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20-260x107.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20-195x80.png 195w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-20-250x103.png 250w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>To create a\u00a0<code>HttpSolrClient<\/code>\u00a0that uses delegation tokens:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-552\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21.png\" alt=\"\" width=\"794\" height=\"173\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21.png 1024w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21-300x65.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21-768x167.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21-720x157.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21-260x57.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21-367x80.png 367w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-21-250x54.png 250w\" sizes=\"(max-width: 794px) 100vw, 794px\" \/><\/p>\n<p>To create a\u00a0<code>CloudSolrClient<\/code>\u00a0that uses delegation tokens:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-553\" src=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22.png\" alt=\"\" width=\"628\" height=\"266\" srcset=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22.png 782w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22-300x127.png 300w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22-768x325.png 768w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22-720x305.png 720w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22-260x110.png 260w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22-189x80.png 189w, https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/carbon-22-250x106.png 250w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/p>\n<p>So, this is it about securing solr. We will be back with another post on solr very soon.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Hello Everyone! We are back with another interesting post on Solr. One of the crucial requirements while setting up a solr application is to provide selective access to various resources allocated on the solr instance. Put simply, we need a mechanism to handle who logs in to the server and no unintended party gets access to various resources. When planning how to secure Solr, one should consider which of the available features or approaches are right for them. There are following ways to authenticate the users: Kerberos Authentication Plugin: If you are using Kerberos to secure your network environment, the Kerberos authentication plugin can be used to secure a Solr cluster. This allows Solr to use a Kerberos service principal and keytab file to authenticate with ZooKeeper and between nodes of the Solr cluster (if applicable). Users of the Admin UI and all clients would also need to have a valid ticket before being able to use the UI or send requests to Solr. When setting up Solr to use Kerberos, configurations are put in place for Solr to use a\u00a0service principal, or a Kerberos username, which is registered with the Key Distribution Center (KDC) to authenticate requests. The configurations define the service principal name and the location of the keytab file that contains the credentials. The Solr authentication model uses a file called\u00a0security.json. If this file is created after an initial startup of Solr, a restart of each node of the system is required. Service Principals and Keytab Files Each Solr node must have a service principal registered with the Key Distribution Center (KDC). The Kerberos plugin uses SPNego to negotiate authentication. Using\u00a0HTTP\/host1@YOUR-DOMAIN.ORG, as an example of a service principal: HTTP\u00a0indicates the type of requests which this service principal will be used to authenticate. The\u00a0HTTP\/\u00a0in the service principal is a must for SPNego to work with requests to Solr over HTTP. host1 is the hostname of the machine hosting the Solr node. YOUR-DOMAIN.ORG is the organization-wide Kerberos realm. Multiple Solr nodes on the same host may have the same service principal since the hostname is common to them all. Along with the service principal, each Solr node needs a keytab file that should contain the credentials of the service principal used. A keytab file contains encrypted credentials to support passwordless logins while obtaining Kerberos tickets from the KDC. For each Solr node, the keytab file should be kept in a secure location and not shared with users of the cluster. Since a Solr cluster requires internode communication, each node must also be able to make Kerberos enabled requests to other nodes. By default, Solr uses the same service principal and keytab as a &#8216;client principal&#8217; for internode communication. Kerberized ZooKeeper When setting up a kerberized SolrCloud cluster, it is recommended to enable Kerberos security for ZooKeeper as well. In such a setup, the client principal used to authenticate requests with ZooKeeper can be shared for internode communication as well. This has the benefit of not needing to renew the ticket granting tickets (TGTs) separately, since the ZooKeeper client used by Solr takes care of this. To achieve this, a single JAAS configuration (with the app name as Client) can be used for the Kerberos plugin as well as for the ZooKeeper client. ZooKeeper Configuration If you are using a ZooKeeper that has already been configured to use Kerberos, you can skip the ZooKeeper-related steps shown here. Since ZooKeeper manages the communication between nodes in a SolrCloud cluster, it must also be able to authenticate with each node of the cluster. Configuration requires setting up a service principal for ZooKeeper, defining a JAAS configuration file and instructing ZooKeeper to use both of those items. Create security.json Create the\u00a0security.json\u00a0file. In SolrCloud mode, you can set up Solr to use the Kerberos plugin by uploading the\u00a0security.json\u00a0to ZooKeeper while you create it, as follows: If you are using Solr in standalone mode, you need to create the\u00a0security.json\u00a0file and put it in your\u00a0$SOLR_HOME\u00a0directory. Define a JAAS Configuration File The JAAS configuration file defines the properties to use for authentication, such as the service principal and the location of the keytab file. Other properties can also be set to ensure ticket caching and other features. The following example can be copied and modified slightly for your environment. The location of the file can be anywhere on the server, but it will be referenced when starting Solr so it must be readable on the filesystem. The JAAS file may contain multiple sections for different users, but each section must have a unique name so it can be uniquely referenced in each application. In the below example, we have created a JAAS configuration file with the name and path of\u00a0\/home\/foo\/jaas-client.conf. We will use this name and path when we define the Solr start parameters in the next section. Note that the client\u00a0principal\u00a0here is the same as the service principal. This will be used to authenticate internode requests and requests to ZooKeeper. Make sure to use the correct\u00a0principal\u00a0hostname and the\u00a0keyTab file path. The first line of this file defines the section name, which will be used with the\u00a0solr.kerberos.jaas.appname\u00a0parameter, defined below. The main properties we are concerned with are the\u00a0keyTab\u00a0and\u00a0principal properties, but there are others which may be required for your environment. For reference the ones in use in the above example are explained here: useKeyTab: this boolean property defines if we should use a keytab file (true, in this case). keyTab: the location and name of the keytab file for the principal this section of the JAAS configuration file is for. The path should be enclosed in double-quotes. storeKey: this boolean property allows the key to be stored in the private credentials of the user. useTicketCache: this boolean property allows the ticket to be obtained from the ticket cache. debug: this boolean property will output debug messages for help in troubleshooting. principal: the name of the service principal to be used. Solr Startup Parameters While starting up Solr, the following host-specific parameters need to be passed. These [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":559,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[78,80,79],"class_list":["post-543","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solr","tag-kerberos","tag-kerberos-authentication","tag-solr-authentication"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Securing Solr - Ultimate Solr Guide - Aeologic Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Securing Solr - Ultimate Solr Guide - Aeologic Blog\" \/>\n<meta property=\"og:description\" content=\"Hello Everyone! We are back with another interesting post on Solr. One of the crucial requirements while setting up a solr application is to provide selective access to various resources allocated on the solr instance. Put simply, we need a mechanism to handle who logs in to the server and no unintended party gets access to various resources. When planning how to secure Solr, one should consider which of the available features or approaches are right for them. There are following ways to authenticate the users: Kerberos Authentication Plugin: If you are using Kerberos to secure your network environment, the Kerberos authentication plugin can be used to secure a Solr cluster. This allows Solr to use a Kerberos service principal and keytab file to authenticate with ZooKeeper and between nodes of the Solr cluster (if applicable). Users of the Admin UI and all clients would also need to have a valid ticket before being able to use the UI or send requests to Solr. When setting up Solr to use Kerberos, configurations are put in place for Solr to use a\u00a0service principal, or a Kerberos username, which is registered with the Key Distribution Center (KDC) to authenticate requests. The configurations define the service principal name and the location of the keytab file that contains the credentials. The Solr authentication model uses a file called\u00a0security.json. If this file is created after an initial startup of Solr, a restart of each node of the system is required. Service Principals and Keytab Files Each Solr node must have a service principal registered with the Key Distribution Center (KDC). The Kerberos plugin uses SPNego to negotiate authentication. Using\u00a0HTTP\/host1@YOUR-DOMAIN.ORG, as an example of a service principal: HTTP\u00a0indicates the type of requests which this service principal will be used to authenticate. The\u00a0HTTP\/\u00a0in the service principal is a must for SPNego to work with requests to Solr over HTTP. host1 is the hostname of the machine hosting the Solr node. YOUR-DOMAIN.ORG is the organization-wide Kerberos realm. Multiple Solr nodes on the same host may have the same service principal since the hostname is common to them all. Along with the service principal, each Solr node needs a keytab file that should contain the credentials of the service principal used. A keytab file contains encrypted credentials to support passwordless logins while obtaining Kerberos tickets from the KDC. For each Solr node, the keytab file should be kept in a secure location and not shared with users of the cluster. Since a Solr cluster requires internode communication, each node must also be able to make Kerberos enabled requests to other nodes. By default, Solr uses the same service principal and keytab as a &#8216;client principal&#8217; for internode communication. Kerberized ZooKeeper When setting up a kerberized SolrCloud cluster, it is recommended to enable Kerberos security for ZooKeeper as well. In such a setup, the client principal used to authenticate requests with ZooKeeper can be shared for internode communication as well. This has the benefit of not needing to renew the ticket granting tickets (TGTs) separately, since the ZooKeeper client used by Solr takes care of this. To achieve this, a single JAAS configuration (with the app name as Client) can be used for the Kerberos plugin as well as for the ZooKeeper client. ZooKeeper Configuration If you are using a ZooKeeper that has already been configured to use Kerberos, you can skip the ZooKeeper-related steps shown here. Since ZooKeeper manages the communication between nodes in a SolrCloud cluster, it must also be able to authenticate with each node of the cluster. Configuration requires setting up a service principal for ZooKeeper, defining a JAAS configuration file and instructing ZooKeeper to use both of those items. Create security.json Create the\u00a0security.json\u00a0file. In SolrCloud mode, you can set up Solr to use the Kerberos plugin by uploading the\u00a0security.json\u00a0to ZooKeeper while you create it, as follows: If you are using Solr in standalone mode, you need to create the\u00a0security.json\u00a0file and put it in your\u00a0$SOLR_HOME\u00a0directory. Define a JAAS Configuration File The JAAS configuration file defines the properties to use for authentication, such as the service principal and the location of the keytab file. Other properties can also be set to ensure ticket caching and other features. The following example can be copied and modified slightly for your environment. The location of the file can be anywhere on the server, but it will be referenced when starting Solr so it must be readable on the filesystem. The JAAS file may contain multiple sections for different users, but each section must have a unique name so it can be uniquely referenced in each application. In the below example, we have created a JAAS configuration file with the name and path of\u00a0\/home\/foo\/jaas-client.conf. We will use this name and path when we define the Solr start parameters in the next section. Note that the client\u00a0principal\u00a0here is the same as the service principal. This will be used to authenticate internode requests and requests to ZooKeeper. Make sure to use the correct\u00a0principal\u00a0hostname and the\u00a0keyTab file path. The first line of this file defines the section name, which will be used with the\u00a0solr.kerberos.jaas.appname\u00a0parameter, defined below. The main properties we are concerned with are the\u00a0keyTab\u00a0and\u00a0principal properties, but there are others which may be required for your environment. For reference the ones in use in the above example are explained here: useKeyTab: this boolean property defines if we should use a keytab file (true, in this case). keyTab: the location and name of the keytab file for the principal this section of the JAAS configuration file is for. The path should be enclosed in double-quotes. storeKey: this boolean property allows the key to be stored in the private credentials of the user. useTicketCache: this boolean property allows the ticket to be obtained from the ticket cache. debug: this boolean property will output debug messages for help in troubleshooting. principal: the name of the service principal to be used. Solr Startup Parameters While starting up Solr, the following host-specific parameters need to be passed. These [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/\" \/>\n<meta property=\"og:site_name\" content=\"Aeologic Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AeoLogicTech\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-13T17:17:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-18T08:11:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"622\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Manoj Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@aeologictech\" \/>\n<meta name=\"twitter:site\" content=\"@aeologictech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Manoj Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/\"},\"author\":{\"name\":\"Manoj Kumar\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4\"},\"headline\":\"Securing Solr &#8211; Ultimate Solr Guide\",\"datePublished\":\"2020-02-13T17:17:43+00:00\",\"dateModified\":\"2020-03-18T08:11:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/\"},\"wordCount\":1714,\"publisher\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png\",\"keywords\":[\"kerberos\",\"kerberos authentication\",\"solr authentication\"],\"articleSection\":[\"Solr\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/\",\"url\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/\",\"name\":\"Securing Solr - Ultimate Solr Guide - Aeologic Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png\",\"datePublished\":\"2020-02-13T17:17:43+00:00\",\"dateModified\":\"2020-03-18T08:11:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage\",\"url\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png\",\"contentUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png\",\"width\":1080,\"height\":622},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.aeologic.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Securing Solr &#8211; Ultimate Solr Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#website\",\"url\":\"https:\/\/www.aeologic.com\/blog\/\",\"name\":\"Aeologic Blog\",\"description\":\"Aeologic\",\"publisher\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.aeologic.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#organization\",\"name\":\"AeoLogic Technologies\",\"url\":\"https:\/\/www.aeologic.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg\",\"contentUrl\":\"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg\",\"width\":385,\"height\":162,\"caption\":\"AeoLogic Technologies\"},\"image\":{\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/AeoLogicTech\/\",\"https:\/\/x.com\/aeologictech\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4\",\"name\":\"Manoj Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g\",\"caption\":\"Manoj Kumar\"},\"description\":\"Manoj Kumar is a seasoned Digital Marketing Manager and passionate Tech Blogger with deep expertise in SEO, AI trends, and emerging digital technologies. He writes about innovative solutions that drive growth and transformation across industry. Featured on - YOURSTORY | TECHSLING | ELEARNINGINDUSTRY | DATASCIENCECENTRAL | TIMESOFINDIA | MEDIUM | DATAFLOQ\",\"sameAs\":[\"https:\/\/www.aeologic.com\/\",\"https:\/\/www.linkedin.com\/in\/manoj-kumar-rajput\/\"],\"url\":\"https:\/\/www.aeologic.com\/blog\/author\/manoj\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Securing Solr - Ultimate Solr Guide - Aeologic Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/","og_locale":"en_US","og_type":"article","og_title":"Securing Solr - Ultimate Solr Guide - Aeologic Blog","og_description":"Hello Everyone! We are back with another interesting post on Solr. One of the crucial requirements while setting up a solr application is to provide selective access to various resources allocated on the solr instance. Put simply, we need a mechanism to handle who logs in to the server and no unintended party gets access to various resources. When planning how to secure Solr, one should consider which of the available features or approaches are right for them. There are following ways to authenticate the users: Kerberos Authentication Plugin: If you are using Kerberos to secure your network environment, the Kerberos authentication plugin can be used to secure a Solr cluster. This allows Solr to use a Kerberos service principal and keytab file to authenticate with ZooKeeper and between nodes of the Solr cluster (if applicable). Users of the Admin UI and all clients would also need to have a valid ticket before being able to use the UI or send requests to Solr. When setting up Solr to use Kerberos, configurations are put in place for Solr to use a\u00a0service principal, or a Kerberos username, which is registered with the Key Distribution Center (KDC) to authenticate requests. The configurations define the service principal name and the location of the keytab file that contains the credentials. The Solr authentication model uses a file called\u00a0security.json. If this file is created after an initial startup of Solr, a restart of each node of the system is required. Service Principals and Keytab Files Each Solr node must have a service principal registered with the Key Distribution Center (KDC). The Kerberos plugin uses SPNego to negotiate authentication. Using\u00a0HTTP\/host1@YOUR-DOMAIN.ORG, as an example of a service principal: HTTP\u00a0indicates the type of requests which this service principal will be used to authenticate. The\u00a0HTTP\/\u00a0in the service principal is a must for SPNego to work with requests to Solr over HTTP. host1 is the hostname of the machine hosting the Solr node. YOUR-DOMAIN.ORG is the organization-wide Kerberos realm. Multiple Solr nodes on the same host may have the same service principal since the hostname is common to them all. Along with the service principal, each Solr node needs a keytab file that should contain the credentials of the service principal used. A keytab file contains encrypted credentials to support passwordless logins while obtaining Kerberos tickets from the KDC. For each Solr node, the keytab file should be kept in a secure location and not shared with users of the cluster. Since a Solr cluster requires internode communication, each node must also be able to make Kerberos enabled requests to other nodes. By default, Solr uses the same service principal and keytab as a &#8216;client principal&#8217; for internode communication. Kerberized ZooKeeper When setting up a kerberized SolrCloud cluster, it is recommended to enable Kerberos security for ZooKeeper as well. In such a setup, the client principal used to authenticate requests with ZooKeeper can be shared for internode communication as well. This has the benefit of not needing to renew the ticket granting tickets (TGTs) separately, since the ZooKeeper client used by Solr takes care of this. To achieve this, a single JAAS configuration (with the app name as Client) can be used for the Kerberos plugin as well as for the ZooKeeper client. ZooKeeper Configuration If you are using a ZooKeeper that has already been configured to use Kerberos, you can skip the ZooKeeper-related steps shown here. Since ZooKeeper manages the communication between nodes in a SolrCloud cluster, it must also be able to authenticate with each node of the cluster. Configuration requires setting up a service principal for ZooKeeper, defining a JAAS configuration file and instructing ZooKeeper to use both of those items. Create security.json Create the\u00a0security.json\u00a0file. In SolrCloud mode, you can set up Solr to use the Kerberos plugin by uploading the\u00a0security.json\u00a0to ZooKeeper while you create it, as follows: If you are using Solr in standalone mode, you need to create the\u00a0security.json\u00a0file and put it in your\u00a0$SOLR_HOME\u00a0directory. Define a JAAS Configuration File The JAAS configuration file defines the properties to use for authentication, such as the service principal and the location of the keytab file. Other properties can also be set to ensure ticket caching and other features. The following example can be copied and modified slightly for your environment. The location of the file can be anywhere on the server, but it will be referenced when starting Solr so it must be readable on the filesystem. The JAAS file may contain multiple sections for different users, but each section must have a unique name so it can be uniquely referenced in each application. In the below example, we have created a JAAS configuration file with the name and path of\u00a0\/home\/foo\/jaas-client.conf. We will use this name and path when we define the Solr start parameters in the next section. Note that the client\u00a0principal\u00a0here is the same as the service principal. This will be used to authenticate internode requests and requests to ZooKeeper. Make sure to use the correct\u00a0principal\u00a0hostname and the\u00a0keyTab file path. The first line of this file defines the section name, which will be used with the\u00a0solr.kerberos.jaas.appname\u00a0parameter, defined below. The main properties we are concerned with are the\u00a0keyTab\u00a0and\u00a0principal properties, but there are others which may be required for your environment. For reference the ones in use in the above example are explained here: useKeyTab: this boolean property defines if we should use a keytab file (true, in this case). keyTab: the location and name of the keytab file for the principal this section of the JAAS configuration file is for. The path should be enclosed in double-quotes. storeKey: this boolean property allows the key to be stored in the private credentials of the user. useTicketCache: this boolean property allows the ticket to be obtained from the ticket cache. debug: this boolean property will output debug messages for help in troubleshooting. principal: the name of the service principal to be used. Solr Startup Parameters While starting up Solr, the following host-specific parameters need to be passed. These [&hellip;]","og_url":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/","og_site_name":"Aeologic Blog","article_publisher":"https:\/\/www.facebook.com\/AeoLogicTech\/","article_published_time":"2020-02-13T17:17:43+00:00","article_modified_time":"2020-03-18T08:11:39+00:00","og_image":[{"width":1080,"height":622,"url":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png","type":"image\/png"}],"author":"Manoj Kumar","twitter_card":"summary_large_image","twitter_creator":"@aeologictech","twitter_site":"@aeologictech","twitter_misc":{"Written by":"Manoj Kumar","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#article","isPartOf":{"@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/"},"author":{"name":"Manoj Kumar","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4"},"headline":"Securing Solr &#8211; Ultimate Solr Guide","datePublished":"2020-02-13T17:17:43+00:00","dateModified":"2020-03-18T08:11:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/"},"wordCount":1714,"publisher":{"@id":"https:\/\/www.aeologic.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png","keywords":["kerberos","kerberos authentication","solr authentication"],"articleSection":["Solr"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/","url":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/","name":"Securing Solr - Ultimate Solr Guide - Aeologic Blog","isPartOf":{"@id":"https:\/\/www.aeologic.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage"},"image":{"@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage"},"thumbnailUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png","datePublished":"2020-02-13T17:17:43+00:00","dateModified":"2020-03-18T08:11:39+00:00","breadcrumb":{"@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#primaryimage","url":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png","contentUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/02\/Securing-Solr.png","width":1080,"height":622},{"@type":"BreadcrumbList","@id":"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide-9-securing-solr-instance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.aeologic.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Securing Solr &#8211; Ultimate Solr Guide"}]},{"@type":"WebSite","@id":"https:\/\/www.aeologic.com\/blog\/#website","url":"https:\/\/www.aeologic.com\/blog\/","name":"Aeologic Blog","description":"Aeologic","publisher":{"@id":"https:\/\/www.aeologic.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.aeologic.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.aeologic.com\/blog\/#organization","name":"AeoLogic Technologies","url":"https:\/\/www.aeologic.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg","contentUrl":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2022\/05\/new-logo-aeo.jpg","width":385,"height":162,"caption":"AeoLogic Technologies"},"image":{"@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/AeoLogicTech\/","https:\/\/x.com\/aeologictech"]},{"@type":"Person","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/13549984ba8e5f441cc733ed20d7daa4","name":"Manoj Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.aeologic.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/24ce77602da5eb5715d74a95733f6c7548e2af73f5a493f9bc0bf55f611d025e?s=96&d=mm&r=g","caption":"Manoj Kumar"},"description":"Manoj Kumar is a seasoned Digital Marketing Manager and passionate Tech Blogger with deep expertise in SEO, AI trends, and emerging digital technologies. He writes about innovative solutions that drive growth and transformation across industry. Featured on - YOURSTORY | TECHSLING | ELEARNINGINDUSTRY | DATASCIENCECENTRAL | TIMESOFINDIA | MEDIUM | DATAFLOQ","sameAs":["https:\/\/www.aeologic.com\/","https:\/\/www.linkedin.com\/in\/manoj-kumar-rajput\/"],"url":"https:\/\/www.aeologic.com\/blog\/author\/manoj\/"}]}},"_links":{"self":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/posts\/543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/comments?post=543"}],"version-history":[{"count":0,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/posts\/543\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/media\/559"}],"wp:attachment":[{"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/media?parent=543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/categories?post=543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aeologic.com\/blog\/wp-json\/wp\/v2\/tags?post=543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}