Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSearch docker instance only allowing HTTPS connections

I'm trying to get OpenSearch configured on my local machine, and am deploying it through docker-compose using the following configuration:

opensearch:
    image: opensearchproject/opensearch:1.0.0
    restart: unless-stopped
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      discovery.type: single-node

The instance starts successfully, however when trying to access it through the web interface, it only accepts HTTPS connections with the default basic auth credentials (admin:admin). i.e.

https://localhost:9200 asks me to enter administrator credentials, and upon doing so, returns an expected response:

{
  "name" : "a39dcf825899",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "d2ZBZDQRTyG6SvYlCmX3Iw",
  "version" : {
    "distribution" : "opensearch",
    "number" : "1.0.0",
    "build_type" : "tar",
    "build_hash" : "34550c5b17124ddc59458ef774f6b43a086522e3",
    "build_date" : "2021-07-02T23:22:21.383695Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.2",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

However when attempting to connect to the instance over HTTP, I get an empty response:

On chrome:

ERR_EMPTY_RESPONSE

Using the OpenSearch Python client on a Django instance running in a separate Docker container (part of the same docker-compose.yml):

opensearchpy.exceptions.ConnectionError: ConnectionError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))) caused by: ProtocolError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')))

For reference, the code I am using to connect the OpenSearch Python client to the OpenSearch instance is:

cls._os_client = OpenSearch(
                [{"host": 'opensearch', "port": '9200'}],
                use_ssl=False,
                verify_certs=False,
                ssl_assert_hostname=False,
                ssl_show_warn=False
            )

How can I configure OpenSearch to allow insecure HTTP connections?

like image 926
Ruthus99 Avatar asked Mar 18 '26 23:03

Ruthus99


1 Answers

You can disable security, just add DISABLE_SECURITY_PLUGIN=true to your env.

like image 173
ilvar Avatar answered Mar 20 '26 11:03

ilvar