diff --git a/src/common/check_paths.py b/src/common/check_paths.py index 456bc0e3e..4ce00dcf9 100644 --- a/src/common/check_paths.py +++ b/src/common/check_paths.py @@ -29,6 +29,7 @@ import stat from common import gajim import logger +from common import jingle_xtls # DO NOT MOVE ABOVE OF import gajim import sqlite3 as sqlite @@ -267,6 +268,7 @@ def check_and_possibly_create_paths(): MY_DATA = configpaths.gajimpaths['MY_DATA'] MY_CONFIG = configpaths.gajimpaths['MY_CONFIG'] MY_CACHE = configpaths.gajimpaths['MY_CACHE'] + XTLS_CERTS = os.path.expanduser('~/certs/') if not os.path.exists(MY_DATA): create_path(MY_DATA) @@ -332,6 +334,13 @@ def check_and_possibly_create_paths(): print _('%s is a directory but should be a file') % CACHE_DB_PATH print _('Gajim will now exit') sys.exit() + + if not os.path.exists(XTLS_CERTS): + create_path(XTLS_CERTS) + if not (os.path.exists(os.path.join(XTLS_CERTS, jingle_xtls.SELF_SIGNED_CERTIFICATE + '.cert')) and + os.path.exist(os.path.join(XTLS_CERTS, jingle_xtls.SELF_SIGNED_CERTIFICATE + '.pkey'))): + jingle_xtls.make_certs(XTLS_CERTS + jingle_xtls.SELF_SIGNED_CERTIFICATE, 'gajim') + def create_path(directory): print _('creating %s directory') % directory diff --git a/src/common/jingle_xtls.py b/src/common/jingle_xtls.py index 5e7f6547d..1b1b00400 100644 --- a/src/common/jingle_xtls.py +++ b/src/common/jingle_xtls.py @@ -86,7 +86,6 @@ def get_context(fingerprint, verify_cb=None): ctx.use_privatekey_file (os.path.expanduser('~/certs/' + SELF_SIGNED_CERTIFICATE + '.pkey')) ctx.use_certificate_file(os.path.expanduser('~/certs/' + SELF_SIGNED_CERTIFICATE + '.cert')) - # ctx.load_verify_locations(os.path.expanduser('~/certs/CA.cert')) store = ctx.get_cert_store() for f in os.listdir(os.path.expanduser('~/certs/')): load_cert_file(os.path.join(os.path.expanduser('~/certs'), f), store)