Search code examples
python-2.7amazon-ec2ambari

Ambari-agent "CERTIFICATE_VERIFY_FAILED", Is it safe to disable the certificate verification in Python?


Ambari version: 2.2.2.18 HDP stack: 2.4.3 OS: centos 7.3

Issue description:

Ambari-server can't communicate with Ambari agent. I can see below error in the ambari-agent logs:

ERROR 2017-09-18 06:35:34,684 NetUtil.py:84 - [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)
ERROR 2017-09-18 06:35:34,684 NetUtil.py:85 - SSLError: Failed to connect. Please check openssl library versions.

I am facing this issue recently and it appears this can be replicated consistently after the instances are restarted. (I am using EC2 instances).

I am able to register agent nodes successfully, install HDP cluster, run yarn jobs etc.. no problem at all. Once i restart my instances, I see this problem.

There are some solutions already posted for this problem like:

  • Downgrade the Python from 2.7 to lower. This is a known problem of Ambari with Python 2.7

  • Control the certificate verification by disabling it. Set "verify = disable"; under /etc/python/cert-verification.cfg

I don't want to play with Python as it can disrupt lot many things like Cassandra, yum package manager etc...

Second work around is very much easy and it works well!

Now comes my question :- Is it safe to disable the certificate verification in Python ? i.e. by setting property verify = disable


Solution

  • How did we investigate this issue and What solution we adopted:

    Investigation Details:

    Downgrading to Python 2.6 is not feasible as there are OS dependencies and as per Suggestion from 'Dmitriusan' in the previous comment, it's not a good idea to disable certificate verification in Python.

    We use AWS EC2

    With Python 2.7, JDK 1.8 and Cent OS 7.2 there is no issue. Everything is smooth.

    With Python 2.7, JDK 1.8 and Cent OS 7.3 and Centos 7.4 we are seeing this issue.

    Issue which I have reported here, is with respect to Centos 7.3 and with Centos 7.4 Issue is slightly different. Certificate verification fails while adding nodes to the cluster itself.

    Downgrading from centos 7.3 to 7.2 is not straight forward. And AWS EC2 market place provides Centos 7.0 Image and when we create instance from this image, it applies security and patch updates resulting in Centos 7.3.

    We can create our own Image of Centos 7.2 from existing servers but, It's always good to be with the latest update for the OS for security reasons.

    To describe it shortly, we had workarounds but not a solution.

    Solution which we adopted:

    After series of tests, we decided to upgrade to Centos 7.4, HDP-2.6.3.0, and Ambari 2.6.0.0

    With Centos 7.4 and Ambari Version 2.6.0.0, we don't see this issue even though I have 'Python 2.7.5' installed.

    So this looks to be an Issue with Ambari