Skip to content

Commit db43184

Browse files
committed
try truststore
1 parent ec30655 commit db43184

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

backend/connection.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1+
from ssl import PROTOCOL_TLS_CLIENT
2+
13
from httpx import Client, Response
4+
from truststore import SSLContext
25

36
from backend.config import config, \
47
TIMEOUT
58
from backend.helpers import log
69

710
# disable TLS verification if configured
811
if config.api.get('verify', True) == False:
9-
gitlab_session = Client(follow_redirects=True, verify=False)
12+
verify = False
1013
else:
11-
gitlab_session = Client(follow_redirects=True)
14+
# use system trust store for TLS verification
15+
verify = SSLContext(PROTOCOL_TLS_CLIENT)
16+
gitlab_session = Client(follow_redirects=True, verify=verify)
1217

18+
# add GitLab API token to session headers
19+
# this is needed for all requests to the GitLab API
1320
gitlab_session.headers.update({'PRIVATE-TOKEN': config.api.token})
1421

1522

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ markdown
77
munch
88
pyaml
99
python-dateutil
10+
truststore

0 commit comments

Comments
 (0)