Skip to content

Commit

Permalink
Improve logging message when certificate is not forwarded (#3927)
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Salac <[email protected]>
  • Loading branch information
richard-salac authored Dec 12, 2024
1 parent 364ec0f commit 25ae2ed
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.zowe.apiml.message.log.ApimlLogger;
import org.zowe.apiml.product.logging.annotations.InjectApimlLogger;

import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
Expand All @@ -36,9 +34,6 @@ public class CertificateValidator {

final TrustedCertificatesProvider trustedCertificatesProvider;

@InjectApimlLogger
private final ApimlLogger apimlLog = ApimlLogger.empty();

@Getter
@Value("${apiml.security.x509.acceptForwardedCert:false}")
private boolean forwardingEnabled;
Expand Down Expand Up @@ -72,8 +67,7 @@ public boolean isTrusted(X509Certificate[] certs) {
.toList();
for (X509Certificate cert : certs) {
if (!trustedCerts.contains(cert)) {
apimlLog.log("org.zowe.apiml.security.common.verify.untrustedCert");
log.debug("Untrusted certificate is {}", cert);
log.debug("Certificate is not trusted by endpoint {}. Untrusted certificate is {}", proxyCertificatesEndpoints, cert);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ messages:
reason: "The string sent by the central Gateway was not recognized as valid DER-encoded certificates in the Base64 printable form."
action: "Check that the URL configured in apiml.security.x509.certificatesUrls responds with valid DER-encoded certificates in the Base64 printable form."

- key: org.zowe.apiml.security.common.verify.untrustedCert
number: ZWEAT505
type: ERROR
text: "Incoming request certificate is not one of the trusted certificates provided by the central Gateway."
reason: "The Gateway performs additional check of request certificates when the central Gateway forwards incoming client certificate to the domain Gateway. This check may fail when the certificatesUrl parameter does not point to proper central Gateway certificates endpoint."
action: "Check that the URL configured in apiml.security.x509.certificatesUrls points to the central Gateway and it responds with valid DER-encoded certificates in the Base64 printable form."

# Various messages
# 600-699

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ messages:
reason: "The string sent by the central Gateway was not recognized as valid DER-encoded certificates in the Base64 printable form."
action: "Check that the URL configured in apiml.security.x509.certificatesUrls responds with valid DER-encoded certificates in the Base64 printable form."

- key: org.zowe.apiml.security.common.verify.untrustedCert
number: ZWEAT505
type: ERROR
text: "Incoming request certificate is not one of the trusted certificates provided by the central Gateway."
reason: "The Gateway performs additional check of request certificates when the central Gateway forwards incoming client certificate to the domain Gateway. This check may fail when the certificatesUrl parameter does not point to proper central Gateway certificates endpoint."
action: "Check that the URL configured in apiml.security.x509.certificatesUrls points to the central Gateway and it responds with valid DER-encoded certificates in the Base64 printable form."

# Personal access token messages
- key: org.zowe.apiml.security.query.invalidAccessTokenBody
number: ZWEAT605
Expand Down

0 comments on commit 25ae2ed

Please sign in to comment.