Its own password for each index
Every search and every update sent straight to an index needs its username and password. A new index starts with your master API key as its password, and generating a new key later does not change it. Give each index you use a password of its own.
How
- Open the index in the Control Panel and click Security.
- Under Authentication, type the new Username and Password. Letters and digits only.
- Click Save and keep the password somewhere safe: the form does not show it again.
All the steps: HTTP Basic Auth.
What happens at once
- The new password works in about 10 seconds. The old one stops at the same time.
- Opensolr's own features on this index keep working: the hosted search page, the Chat Bot, AI answers, Data Ingestion, the web crawler and the Control Panel tools read the new password themselves.
- Your master API key and your scoped keys do not change.
What you have to update
Everything that sends the old password to the index gets 401 Unauthorized until it has the new one:
- Drupal Opensolr Search: in its settings, under Use an existing index, pick the same index, leave both boxes unticked and click Save Settings. The module reads the new password; your index and its data are not touched.
- Drupal Search API Opensolr: open the Search API server of this index and save it again. The module reads the new password when the server is saved.
- WordPress Opensolr Search: under Settings › Opensolr Search, in Use an existing index, pick the same index and click Use this index.
- Drupal Search API Solr (without the Opensolr modules): edit the Search API server of this index, set Solr Connector to Basic Auth, and under HTTP Basic Authentication type the Username and Password, then save the server.
- Your own apps and scripts that query the index directly, and anyone who downloads its backup files: see below.
Until a module is updated, the search on that site fails.
Your own apps and scripts
Every Solr client accepts a username and password for HTTP Basic Authentication. Give it the same two values you saved in the Security tab. The quickest check, from a terminal:
curl -u USERNAME:PASSWORD "https://YOUR-SERVER/solr/YOUR-INDEX/select?q=*:*&rows=0"
- A JSON answer means the credentials are right.
401 Unauthorizedmeans the client sent none, or not the ones you saved. - The server and the index path are shown as Host and Path when you open the index in the Control Panel.
- A client that takes only a URL accepts them in it:
https://USERNAME:PASSWORD@YOUR-SERVER/solr/YOUR-INDEX/.
Resilient clusters
Set the username and password on the master index of the cluster only. Opensolr puts the same credentials on every replica and on the replication between them, so there is nothing to do on the replicas. Your apps keep the same values for the master and the replicas.
From your own code, with the API
The same change without the Control Panel: update_http_auth. On a cluster master it updates the replicas too. Every API call: API reference.
Security pages
- Security overview
- Secure your account
- HTTP Basic Auth
- IP restriction
- Two-factor authentication
- A code you don't have
- No recovery codes left
- Forgot your password
- Where is the QR code
- Move 2FA to a new phone
- Codes and your email
- A new master API key
- A new index password
- Switch to scoped keys
- IP rules by handler
- Search from the browser (CORS)