我正在使用 Vertx v3.4.1 和 vertx-rx-java 来运行我的服务器。我必须启用基于证书的身份验证(相互身份验证),因此尝试在服务器端处理证书吊销检查。
我正在尝试使用HttpServerOptions 的 addCrlPath 方法。但是,看起来,即使在已加载的 CRL 过期后,它也不会从给定的“路径”或证书的 CRL 分发点 (CDP) 重新加载 CRL。我找不到任何关于如何使用 Vertx 以编程方式实现它的 API/文档。
我查看了SSLHelper 类中 getTrustMgrFactory 方法的实现,我感觉它会选择仅在服务器启动时提供的 CRL。
所以,我的查询是:
- 一旦当前加载的 CRL 过期,我是否缺少一些确保从 CDP 自动下载最新 CRL 的配置?
- 如果不是从 CDP 自动下载,是否还有其他可以从
addCrlPath
方法中提供的相同路径重新加载 CRL 的配置? - 如果 Vertx 中没有对 #1 和 #2 的内置支持,是否还有其他内置的 API 提供这种支持?
否则我唯一的选择就是自己处理这些。
下面是我如何初始化我的服务器的代码
import io.vertx.core.http.ClientAuth;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.net.PfxOptions;
import io.vertx.rxjava.core.Vertx;
import io.vertx.rxjava.ext.web.Router;
import io.vertx.rxjava.ext.web.RoutingContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class VertxServer {
private static final Logger LOGGER = LoggerFactory.getLogger(VertxServer.class);
private Vertx vertx;
public VertxServer(final Vertx v) {
this.vertx = v;
}
public void init() {
vertx.createHttpServer(getHttpServerOptions())
// getRouter() method handles router configuration.
.requestHandler(req -> getRouter().accept(req))
.rxListen()
.doOnSuccess(server -> LOGGER.info("Started listening to server..."))
.doOnError(e -> LOGGER.error("Unable to listen. Server launch failed", e))
.subscribe(
server -> LOGGER.info("Server launched successfully. {}", server),
e -> LOGGER.error("Server launch failed", e))
;
}
private HttpServerOptions getHttpServerOptions() {
HttpServerOptions options = new HttpServerOptions()
.setHost("127.0.0.1")
.setPort(8085);
.setSsl(true)
.setPfxKeyCertOptions(
new PfxOptions()
.setPath("E:\\temp\\certs\\server.pfx")
.setPassword("servercertpass".toCharArray())
)
setTrustStoreOptions(options);
return options;
}
private void setTrustStoreOptions(final HttpServerOptions options) {
PfxOptions pfxOptions = new PfxOptions()
.setPath("E:\\temp\\certs\\client-cert-root.p12")
.setPassword("clientcertrootpass".toCharArray());
options.setPfxTrustOptions(pfxOptions)
.addCrlPath("E:\\temp\\certs\\crls\\client-certs.crl")
.setClientAuth(ClientAuth.REQUEST);
}
// Other methods here, which are not relevant for this question.
}