简体   繁体   English

是SQLAlchemy / psycopg2连接到PostgreSQL数据库加密

[英]Is SQLAlchemy/psycopg2 connection to PostgreSQL database encrypted

When I use SQLAlchemy with an external postgreSQL server, is the connection secured/encrypted? 当我将SQLAlchemy与外部postgreSQL服务器一起使用时,连接是否受到保护/加密?

from sqlalchemy.engine import create_engine engine = create_engine('postgresql://scott:tiger@ip:5432/mydatabase')

What about psycopg2? psycopg2怎么样?

Your connection string does not indicate secure connection. 您的连接字符串不表示安全连接。 However, sometimes connection might be secure nevertheless, but it is unlikely. 但是,有时连接可能是安全的,但不太可能。

To have a secure connection to PostgreSQL database you can use sslmode parameter. 要与PostgreSQL数据库建立安全连接,可以使用sslmode参数。

 engine = create_engine('postgresql://scott:tiger@ip:5432/mydatabase?sslmode=verify-full')

verify-full is the highest level SSL connection validation where the client performs full SSL certificate check for the connection. verify-full是最高级别的SSL连接验证,其中客户端对连接执行完整的SSL证书检查。

More info: 更多信息:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM