Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
lscsoft
gracedb
Commits
863b4360
Verified
Commit
863b4360
authored
Feb 15, 2019
by
Tanner Prestegard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generalizing CA path for certificate verification to settings
parent
a2e2470d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
config/settings/base.py
config/settings/base.py
+3
-0
gracedb/api/backends.py
gracedb/api/backends.py
+2
-4
No files found.
config/settings/base.py
View file @
863b4360
...
...
@@ -274,6 +274,9 @@ X509_ISSUER_DN_HEADER = 'HTTP_SSL_CLIENT_I_DN'
X509_CERT_HEADER
=
'HTTP_X_FORWARDED_TLS_CLIENT_CERT'
X509_INFOS_HEADER
=
'HTTP_X_FORWARDED_TLS_CLIENT_CERT_INFOS'
# Path to CA store for X509 certificate verification
CAPATH
=
'/etc/grid-security/certificates'
# List of authentication backends to use when attempting to authenticate
# a user. Will be used in this order. Authentication for the API is
# handled by the REST_FRAMEWORK dictionary.
...
...
gracedb/api/backends.py
View file @
863b4360
...
...
@@ -249,16 +249,14 @@ class GraceDbX509FullCertAuthentication(GraceDbX509Authentication):
return
cert_der
def
verify_certificate_chain
(
self
,
cert_data
,
trusted_certs
=
'/etc/grid-security/certificates'
):
def
verify_certificate_chain
(
self
,
cert_data
,
capath
=
settings
.
CAPATH
):
# Load certificate data
certificate
=
OpenSSL
.
crypto
.
load_certificate
(
OpenSSL
.
crypto
.
FILETYPE_ASN1
,
cert_data
)
# Set up context and get certificate store
ctx
=
OpenSSL
.
SSL
.
Context
(
OpenSSL
.
SSL
.
TLSv1_METHOD
)
ctx
.
load_verify_locations
(
None
,
capath
=
trusted_certs
)
ctx
.
load_verify_locations
(
None
,
capath
=
capath
)
store
=
ctx
.
get_cert_store
()
# Verify certificate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment