[IMP] core: allow to connect to database server with a secure SSL TCP/IP connection

This commit is contained in:
Christophe Simonis
2017-09-28 14:47:59 +02:00
parent c3048b1465
commit a8ecfd03c6
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -668,7 +668,7 @@ def connection_info_for(db_or_uri):
return db_name, {'dsn': db_or_uri}
connection_info = {'database': db_or_uri}
for p in ('host', 'port', 'user', 'password'):
for p in ('host', 'port', 'user', 'password', 'sslmode'):
cfg = tools.config['db_' + p]
if cfg:
connection_info[p] = cfg
+4 -1
View File
@@ -204,6 +204,9 @@ class configmanager(object):
help="specify the database host")
group.add_option("--db_port", dest="db_port", my_default=False,
help="specify the database port", type="int")
group.add_option("--db_sslmode", dest="db_sslmode", type="choice", my_default='prefer',
choices=['disable', 'allow', 'prefer', 'require', 'verify-ca', 'verify-full'],
help="specify the database ssl connection mode (see PostgreSQL documentation)")
group.add_option("--db_maxconn", dest="db_maxconn", type='int', my_default=64,
help="specify the the maximum number of physical connections to posgresql")
group.add_option("--db-template", dest="db_template", my_default="template1",
@@ -381,7 +384,7 @@ class configmanager(object):
# if defined dont take the configfile value even if the defined value is None
keys = ['xmlrpc_interface', 'xmlrpc_port', 'longpolling_port',
'db_name', 'db_user', 'db_password', 'db_host',
'db_name', 'db_user', 'db_password', 'db_host', 'db_sslmode',
'db_port', 'db_template', 'logfile', 'pidfile', 'smtp_port',
'email_from', 'smtp_server', 'smtp_user', 'smtp_password',
'db_maxconn', 'import_partial', 'addons_path',