# Python - Sniff Options Attempt to match IP verse Certificate

**URL:** <https://discuss.elastic.co/t/python-sniff-options-attempt-to-match-ip-verse-certificate/316570>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [October 13, 2022, 7:14pm UTC](https://discuss.elastic.co/t/python-sniff-options-attempt-to-match-ip-verse-certificate/316570 "2022-10-13T19:14:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott\_stash](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@scott\_stash](https://discuss.elastic.co/u/scott_stash)\
**Post date:** [October 13, 2022, 7:14pm UTC](https://discuss.elastic.co/t/python-sniff-options-attempt-to-match-ip-verse-certificate/316570/1 "2022-10-13T19:14:33Z")

</div>

My ES setup has 3 master nodes, 5 data nodes and a couple ingest nodes. I'm trying to create an ES object with sniffing turned on.

```auto
import os
from elasticsearch import Elasticsearch

ES = Elasticsearch(os.environ.get("ES_HOST"),
                        ca_certs=os.environ.get("ES_CA_CERT_PATH"),
                        http_auth = (os.environ.get("ES_USERNAME"), os.environ.get("ES_PASSWORD")),
                        port = os.environ.get("ES_PORT"),
                        retry_on_timeout=True,
                        scheme="https",
                        timeout=30,
                        sniff_on_start=True,
                        sniff_on_connection_fail=True,
                        sniffer_timeout=60,
                        sniff_timeout=10
        )

```

This works fine when I remove the 4 sniffer options. With them added I get this error:

```auto
  File "/home/es/.local/lib/python3.8/site-packages/urllib3/connection.py", line 467, in connect
    _match_hostname(cert, self.assert_hostname or server_hostname)
  File "/home/es/.local/lib/python3.8/site-packages/urllib3/connection.py", line 540, in _match_hostname
    match_hostname(cert, asserted_hostname)
  File "/home/es/.local/lib/python3.8/site-packages/urllib3/util/ssl_match_hostname.py", line 150, in match_hostname
    raise CertificateError(
urllib3.util.ssl_match_hostname.CertificateError: hostname '10.10.10.10' doesn't match either of '*.test.domain', '*.test.net', 

```

ES\_HOSTS is set to the FQDN of the machine, not the IP. I would expect it to do this check verse the FQDN not the IP. Am I missing a certain type of DNS record?

PIP:

```auto
elastic-transport 7.16.0
elasticsearch 7.17.3
elasticsearch-dsl 7.4.0
urllib3 1.26.12

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 10, 2022, 7:14pm UTC](https://discuss.elastic.co/t/python-sniff-options-attempt-to-match-ip-verse-certificate/316570/2 "2022-11-10T19:14:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
