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

Fixed verification of sender certificate in CreateSessionRequest #6547

Open
wants to merge 1 commit into
base: 1.3
Choose a base branch
from
Open
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
27 changes: 16 additions & 11 deletions src/server/ua_services_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,22 @@ Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
return;
}

if(request->clientCertificate.length > 0) {
UA_CertificateVerification *cv = &server->config.certificateVerification;
response->responseHeader.serviceResult =
cv->verifyApplicationURI(cv->context, &request->clientCertificate,
&request->clientDescription.applicationUri);
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
UA_LOG_WARNING_CHANNEL(&server->config.logger, channel,
"The client's ApplicationURI did not match the certificate");
server->serverDiagnosticsSummary.securityRejectedSessionCount++;
server->serverDiagnosticsSummary.rejectedSessionCount++;
return;
/* "If the securityPolicyUri is None, the Server shall ignore the ApplicationInstanceCertificate".
* See: "OPC UA Specification Part 4 V1.04, Section 5.6.2.2". */
if(channel->securityMode == UA_MESSAGESECURITYMODE_SIGN ||
channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) {
if(request->clientCertificate.length > 0) {
UA_CertificateVerification *cv = &server->config.certificateVerification;
response->responseHeader.serviceResult =
cv->verifyApplicationURI(cv->context, &request->clientCertificate,
&request->clientDescription.applicationUri);
if(response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) {
UA_LOG_WARNING_CHANNEL(&server->config.logger, channel,
"The client's ApplicationURI did not match the certificate");
server->serverDiagnosticsSummary.securityRejectedSessionCount++;
server->serverDiagnosticsSummary.rejectedSessionCount++;
return;
}
}
}

Expand Down
Loading