-
Notifications
You must be signed in to change notification settings - Fork 694
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
openssl 1.1 / uwsgi / psycopg2 - no ciphers error #1569
Comments
Are you sure everything is linked to the proper ssl library? |
Not sure how to check this but i get the error both on a debian distribution and my local machine (archlinux) that have only one openssl package installed |
Are psycopg2 / libpq compiled against openssl 1.1? Also check the python you have built the uwsgi plugin for. |
The problem arises from a fresh debian 9 install. I installed uwsgi in the following manner
Not sure there is any build going on. |
Having the same problem - debian 9 (upgrade), python 3.5, uwsgi, psycopg, Django. Postgres uses SSL for the connection (defined in the django config). |
Is there anything going on with this issue? Is it a case of rebuilding all the stack from source? |
I'm getting the exact same issue. It does not occur when I access the database using psycopg2 outside of uwsgi. It only occurs when running a python WSGI application using uwsgi. |
Version 2.0.14 appears to be working OK. The problem is with 2.0.15. |
I am getting a similar error with v2.0.15. My service (python 2.7, Flask, psycopg2) runs on AWS ECS and needs to connect to a Redshift RDS. Redshift is moving to ACM certs and during the course of this update I started getting UPDATE: Downgrading to v2.0.14 did not resolve this issue. |
Confirming the issue, Debian Stretch / Openssl / uwsgi 2.0.15 / Python 3.5//3.6 / postgresql client 10.1 // redshift. Talk about a heisenbug, I was tearing my hair out. |
We're having the same problem migration our Django apps to Stretch. Our version of Stretch has uwsgi 2.0.14 and our Django apps use postgres through psycopg. |
Does this reproduce the issue for you? If not could you please modify it to do so? Do you need a valid connection?
You can run it with:
|
@xrmx it appears a valid connection is needed (with an open port; a socket needs to be created), but it doesn't get far enough to need to know about postgres: import psycopg2
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
try:
conn = psycopg2.connect(host="localhost", port=22, sslmode="verify-full")
except Exception as e:
print(e)
return [b"Hello World"]
this is where it fails to create the ssl context:
and here it attempts to plaintext auth:
|
We dealt with this very issue all morning. We are not using SSL in uwsgi as it is behind an Nginx and a load balancer, what solved the issue for us was installing For reference, here is what the docker container build looks like
|
I was facing a similar issue, what did the trick for me was downgrading Python3.6 to Python3.5 |
A workaround would be to install psycopg2 as source and not as wheel (pip install --no-binary). Or rebuild uwsgi without ssl support if you don't use it. |
Ah, installing from source did the job, thanks. |
When pip installing psycopg2, we need to build it from source rather than use a pre-compiled binary/wheel so that it gets linked against the correct libssl. unbit/uwsgi#1569
When pip installing psycopg2, we need to build it from source rather than use a pre-compiled binary/wheel so that it gets linked against the correct libssl. unbit/uwsgi#1569
The file parsing available in uWSGI has a hardcoded line limit which was causing problems with managing the certificate strings via the env file. Added a block to read in the env file and set environment variables automatically as part of settings.py to work around that issue. Removed the `-e` flags from the git dependencies so that they get installed to the `dist-packages` directory instead of the home directory of the user that runs the pip command. This was causing issues with being able to import those packages at runtime. Added the `no-binary` flag for psycopg2 due to issues with how the wheel is linked to OpenSSL for Debian 9 (unbit/uwsgi#1569) Added the option to set the celery broker separately from the results backend in order to allow for using RabbitMQ in place of Redis.
The file parsing available in uWSGI has a hardcoded line limit which was causing problems with managing the certificate strings via the env file. Added a block to read in the env file and set environment variables automatically as part of settings.py to work around that issue. Removed the `-e` flags from the git dependencies so that they get installed to the `dist-packages` directory instead of the home directory of the user that runs the pip command. This was causing issues with being able to import those packages at runtime. Added the `no-binary` flag for psycopg2 due to issues with how the wheel is linked to OpenSSL for Debian 9 (unbit/uwsgi#1569) Added the option to set the celery broker separately from the results backend in order to allow for using RabbitMQ in place of Redis.
As @xrmx noted, one workaround is to ensure the relevant line in
|
Is there any solution or other workaround available? |
@HalisCz You can read the last 3 comments above yours |
@xrmx I had actually, but so far there are only downgrades and workarounds, and all of them are few months old. Therefore, I was just checking that there is still no available "clean" solution. |
Does anyone know how to specify the source-only installation in a I modified The resulting line is |
Important: the solution posted above, changing the relevant Futhermore, from psycopg2 2.8, this will no longer be needed as the package will default to source installation, a move caused precisely by this issue: http://initd.org/psycopg/articles/2018/02/08/psycopg-274-released/ |
I was having this issue with |
Hello,
I have recently upgraded my openssl library to 1.1.0 and since then i get the following error when trying to connect to a database through psycopg2 behind a uwsgi / gevent worker:
(psycopg2.OperationalError) could not create SSL context: library has no ciphers
When i am not using uwsgi (i develop using flask framework), it works fine even with gevent activated. This lead me to think there is some kind of compatibility issue between uwsgi & openssl 1.1.0. Are you aware of any such issue ?
The text was updated successfully, but these errors were encountered: