Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livy ssl issue #15806

Closed
cocampbe opened this issue May 12, 2021 · 11 comments
Closed

livy ssl issue #15806

cocampbe opened this issue May 12, 2021 · 11 comments
Labels
invalid kind:bug This is a clearly a bug

Comments

@cocampbe
Copy link

Apache Airflow version: 2.0.1

Kubernetes version (if you are using kubernetes) (use kubectl version): 1.17.6

  • OS (e.g. from /etc/os-release): oracle linux 7.9
  • Kernel (e.g. uname -a): Linux airflow-worker-1 4.14.35-2047.502.4.el7uek.x86_64 Bring in more resolution to hivestats #2 SMP Mon Apr 5 13:21:44 PDT 2021 x86_64 GNU/Linux

What happened:

Got the following trying to user the livy operator. I have added the certs to the image and ran update-ca-certs. I can use the curl command from the worker pod and the response is as expected. But pyopenssl is not able to verify the cert. I've changed the actual server name.

[2021-05-12 20:40:04,826] {taskinstance.py:1455} ERROR - HTTPSConnectionPool(host='host.example.com', port=8998): Max retries exceeded with url: /batches (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py", line 488, in wrap_socket
    cnx.do_handshake()
  File "/home/airflow/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1934, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/home/airflow/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1671, in _raise_ssl_error
    _raise_current_error()
  File "/home/airflow/.local/lib/python3.8/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]

here is trhe output from curl running in the pod.

airflow@airflow-worker-1:/opt/airflow$ curl -I https://host.example.com:8998/
HTTP/1.1 401 Unauthorized
WWW-Authenticate: MAPR-Negotiate
WWW-Authenticate: Basic realm="WebLogin"
Set-Cookie: hadoop.auth=; Path=/; Domain=.example.com; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Secure; HttpOnly
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=iso-8859-1
Content-Length: 519
Server: Jetty(9.4.22.v20191022)

What you expected to happen:

No ssl error

@cocampbe cocampbe added the kind:bug This is a clearly a bug label May 12, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented May 12, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@potiuk
Copy link
Member

potiuk commented May 13, 2021

You can pass extra_options' "verify" parameter and point it to "update-ca,certs" file.

@potiuk
Copy link
Member

potiuk commented May 13, 2021

please let me know if it worked for you

@potiuk
Copy link
Member

potiuk commented May 13, 2021

Closing it for now unless more information/verification is provided.

@potiuk potiuk closed this as completed May 13, 2021
@potiuk potiuk added the invalid label May 13, 2021
@cocampbe
Copy link
Author

cocampbe commented May 13, 2021 via email

@potiuk
Copy link
Member

potiuk commented May 13, 2021

The operator. Look at the Livy Operator. It is based on the HttpOperator and it has 'extra_options' field. You can pass there the same kind of dictionary as for the HttpOperator/Hook. One of the values might be 'verify'. verify might be False/True or it also can be a pth to the root certificate used to verify the server side

@cocampbe
Copy link
Author

@potiuk I am about to give this a try. Thanks for the help. I'll let you know the outcome.

@potiuk
Copy link
Member

potiuk commented May 13, 2021

@cocampbe
Copy link
Author

It worked. Just to test I set verify to False in the dictionary. I need to change it to use the ca cert, but want to see if it would work. Thanks again for your help. DM me your paypal info and I would be happy to send you some beer money. ;)

@potiuk
Copy link
Member

potiuk commented May 13, 2021

Cool! No worries about beer money. Happy that it helped.

@cocampbe
Copy link
Author

Passing it the certs directory worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid kind:bug This is a clearly a bug
Projects
None yet
Development

No branches or pull requests

2 participants