From a8ecfd03c6fed465c7378c947741bd339d7dcd9f Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 28 Sep 2017 14:47:59 +0200 Subject: [PATCH] [IMP] core: allow to connect to database server with a secure SSL TCP/IP connection --- odoo/sql_db.py | 2 +- odoo/tools/config.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/odoo/sql_db.py b/odoo/sql_db.py index 3a97bc47632..17d73c4d353 100644 --- a/odoo/sql_db.py +++ b/odoo/sql_db.py @@ -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 diff --git a/odoo/tools/config.py b/odoo/tools/config.py index 5a8f7efabfe..b158c2e17f0 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -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',