Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log an explicit error when a wildcard server certificate is rejected #814

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/ocpp/common/websocket/websocket_libwebsockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,17 @@ static bool verify_csms_cn(const std::string& hostname, bool preverified, const
<< " with wildcards: " << allow_wildcards;
}

if (not allow_wildcards) {
int wildcard_result = X509_check_host(server_cert, hostname.c_str(), hostname.length(),
X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS, nullptr);
if (result != wildcard_result) {
EVLOG_error << "Failed to verify server certificate hostname: \"" << hostname
<< "\". Server certificate common name \"" << common_name
<< "\" likely contains wildcards. Please check your OCPP configuration and set "
"VerifyCsmsAllowWildcards to true if you want to allow wildcard certificates.";
}
}

return false;
}
}
Expand Down
Loading