Claus Ibsen created CAMEL-27709:
-----------------------------------
Summary: camel-milo - the certificateValidator option of
milo-server fails the server start
Key: CAMEL-27709
URL: https://issues.apache.org/jira/browse/CAMEL-27709
Project: Camel
Issue Type: Bug
Components: camel-milo
Reporter: Claus Ibsen
Fix For: 4.24.0
The {{certificateValidator}} option of the milo-server component cannot be used
since Camel 4.16.0 (the Eclipse Milo 1.0 migration, CAMEL-22086).
In {{MiloServerComponent.buildServerConfig()}} the line
{{serverConfig.setCertificateValidator(certificateValidator)}} is commented out
({{// FIXME - moved to certificateManager}}). Instead, when the option is set,
the component builds {{new
DefaultCertificateManager(this.certificateQuarantine, this.certificateGroup)}}.
Both fields are only set by {{defaultCertificateValidator}}, so with a custom
{{certificateValidator}} alone Milo throws a {{NullPointerException}} in
{{DefaultCertificateManager.<init>}} and the server does not start
({{FailedToStartComponentException}}).
When {{defaultCertificateValidator}} is set as well, the custom validator is
ignored (in either order of the setters): {{setDefaultCertificateValidator()}}
overwrites the field, or the certificate group was already built with the file
based validator, and the file trust list decides.
In Milo 1.x the server validates a client certificate with
{{CertificateGroup.getCertificateValidator()}} of the certificate group of the
server certificate, which it gets from the {{CertificateManager}}.
h4. Proposed change
* When {{certificateValidator}} is set, use the {{certificateManager}} of the
server (it holds the server certificate) and let its certificate groups
validate the client certificates with the custom validator. Fail at startup
with a clear message when no certificate manager is set.
* Fail at startup with a clear message when both {{certificateValidator}} and
{{defaultCertificateValidator}} are set.
* Give {{certificateValidator}} a proper description, and fix the description
of {{certificateManager}}.
* Document the system property
{{org.apache.camel.milo.server.default.enableAnonymous}}, which lets anonymous
clients in when no identity options are set.
* Re-enable {{MonitorItemMultiConnectionsCertTest}} if it passes.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)