Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
59c78d58
Commit
59c78d58
authored
Jun 13, 2017
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Verify OCSP response using trusted CA certificates
parent
5833ef1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
src/shrpx.cc
src/shrpx.cc
+8
-5
src/shrpx_tls.cc
src/shrpx_tls.cc
+18
-3
No files found.
src/shrpx.cc
View file @
59c78d58
...
...
@@ -2071,11 +2071,14 @@ SSL/TLS:
Don't verify backend server's certificate if TLS is
enabled for backend connections.
--cacert=<PATH>
Set path to trusted CA certificate file used in backend
TLS connections. The file must be in PEM format. It
can contain multiple certificates. If the linked
OpenSSL is configured to load system wide certificates,
they are loaded at startup regardless of this option.
Set path to trusted CA certificate file. It is used in
backend TLS connections to verify peer's certificate.
It is also used to verify OCSP response from the script
set by --fetch-ocsp-response-file. The file must be in
PEM format. It can contain multiple certificates. If
the linked OpenSSL is configured to load system wide
certificates, they are loaded at startup regardless of
this option.
--private-key-passwd-file=<PATH>
Path to file that contains password for the server's
private key. If none is given and the private key is
...
...
src/shrpx_tls.cc
View file @
59c78d58
...
...
@@ -829,6 +829,22 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
}
SSL_CTX_set_mode
(
ssl_ctx
,
SSL_MODE_RELEASE_BUFFERS
);
if
(
SSL_CTX_set_default_verify_paths
(
ssl_ctx
)
!=
1
)
{
LOG
(
WARN
)
<<
"Could not load system trusted ca certificates: "
<<
ERR_error_string
(
ERR_get_error
(),
nullptr
);
}
if
(
!
tlsconf
.
cacert
.
empty
())
{
if
(
SSL_CTX_load_verify_locations
(
ssl_ctx
,
tlsconf
.
cacert
.
c_str
(),
nullptr
)
!=
1
)
{
LOG
(
FATAL
)
<<
"Could not load trusted ca certificates from "
<<
tlsconf
.
cacert
<<
": "
<<
ERR_error_string
(
ERR_get_error
(),
nullptr
);
DIE
();
}
}
if
(
!
tlsconf
.
private_key_passwd
.
empty
())
{
SSL_CTX_set_default_passwd_cb
(
ssl_ctx
,
ssl_pem_passwd_cb
);
SSL_CTX_set_default_passwd_cb_userdata
(
ssl_ctx
,
config
);
...
...
@@ -1844,12 +1860,11 @@ int verify_ocsp_response(SSL_CTX *ssl_ctx, const uint8_t *ocsp_resp,
}
auto
bs_deleter
=
defer
(
OCSP_BASICRESP_free
,
bs
);
auto
store
=
X509_STORE_new
();
auto
store_deleter
=
defer
(
X509_STORE_free
,
store
);
auto
store
=
SSL_CTX_get_cert_store
(
ssl_ctx
);
ERR_clear_error
();
rv
=
OCSP_basic_verify
(
bs
,
chain_certs
,
store
,
OCSP_TRUSTOTHER
);
rv
=
OCSP_basic_verify
(
bs
,
chain_certs
,
store
,
0
);
if
(
rv
!=
1
)
{
LOG
(
ERROR
)
<<
"OCSP_basic_verify failed: "
...
...
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