Hi @Ryan Hill . Thank you for your answer. Yes, I'm folowing the "Deploy a Django web app with PostgreSQL in Azure App Service" tutorial. I'm not using SSL. I'm using SSH through the Web SSH service as shown at the "Run Django database migrations" topic. I have used the Django command "python manage.py migrate". The command "python manage.py createsuperuser" didn't work also and generate the same error message. The previous commands "activate (the virtual environment)" and "pip install -r requirements.txt" (for the dependencies) runs ok without problems.
I'm suspecting for a problem with my login: I was already loged at Azure when I opened the Web SSH and it didn't ask me for a login. Ok, I assumed that I was already loged in and the two first commands runs ok. I will try once more time and send you the errors messages.
...
File "/opt/python/3.7.7/lib/python3.7/site-packages/psycopg2/init.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
FATAL: SSL connection is required. Please specify SSL options and retry.
...
File "/opt/python/3.7.7/lib/python3.7/site-packages/psycopg2/init.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
FATAL: SSL connection is required. Please specify SSL options and retry.
Error migrating Django database to Postgres by de SSH web
By migrating the database of a Django app, I can enter the virtual environment and install the dependencies. But when I try to migrate the database, the following messages are displayed: 'FATAL: Password authentication failed for user "root"' and 'FATAL: SSL connection is required. Please specify SSL options and retry.'
Could someone help me? Does anyone know what may be happening?
7 answers
Sort by: Most helpful
-
Rimar 1 Reputation point
2020-07-30T22:41:36.24+00:00 -
Grmacjon-MSFT 18,816 Reputation points
2020-07-31T01:37:17.623+00:00 Hi @Rimar ,
We apologize for the frustration this issue might have caused. from the error message, you posted "FATAL: SSL connection is required. Please specify SSL options and retry." it means you don't have SSL enabled.
Based on this doc " Azure Database for PostgreSQL prefers connecting your client applications to the PostgreSQL service using Transport Layer Security (TLS), previously known as Secure Sockets Layer (SSL). Enforcing TLS connections between your database server and your client applications helps protect against "man-in-the-middle" attacks by encrypting the data stream between the server and your application. By default, the PostgreSQL database service is configured to require TLS connection. You can choose to disable requiring TLS if your client application does not support TLS connectivity."
You can optionally disable enforcing TLS connectivity. Microsoft Azure recommends to always enable Enforce SSL connection setting for enhanced security. Please follow the steps shared here Configure TLS connectivity in Azure Database for PostgreSQL - Single Server to learn how to achieve this. You can disable requiring SSL connections from either the portal or using CLI. You can also see this related Stack Overflow thread for more details.
Hope that helps. Let us know if you have further questions.
-Grace
-
Rimar 1 Reputation point
2020-07-31T17:16:29.917+00:00 Thank you @Grmacjon-MSFT ,
We are used to some frustration in our work. It's ok. I'm just doing the tutorial "Deploy a Django web app with PostgreSQL in Azure App Service" where I think that should have some advice about this issue. Whatever, I still have some doubts:
- Was this issue caused by the use of the Web/HTTP SSH interface?
- Must I disable requiring SSL connections every time I migrate the DB?
- Is there some Windows 10 or VS Code plugin alternative to Web SSH?
Thank you for your help.
-
Rimar 1 Reputation point
2020-08-01T15:45:41.257+00:00 Hi @Grmacjon-MSFT ,
I have tryed disable the requiring SSL connections from the portal, confirmed the new SSL status, opened the WebSSH, activated the virtual env and execute the command "python manage.py migrate" and the same error was risen. What would have happened?
-
Rimar 1 Reputation point
2020-08-03T17:03:33.703+00:00 The error "FATAL: SSL connection is required. Please specify SSL options and retry." is still shown when I try to run the command "python manage.py migrate", even after I disable the "requiring SSL connections" option. Please, Is there something else to do, to solve this issue?