1.4. 为应用程序配置单向和双向 SSL/TLS


1.4.1. 应用程序的自签名证书创建

使用传统安全域时,JBoss EAP 提供自动生成自签名证书以用于开发目的。

示例:服务器日志显示自签名证书创建

15:26:09,031 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-7) WFLYDM0111: Keystore /path/to/jboss/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
...
15:26:10,076 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0113: Generated self signed certificate at /path/to/jboss/configuration/application.keystore. Please note that self signed certificates are not secure, and should only be used for testing purposes. Do not use this self signed certificate in production.
SHA-1 fingerprint of the generated key is 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33
SHA-256 fingerprint of the generated key is 00:11:22:33:44:55:66:77:88:99:00:aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee
...

此证书是出于测试目的而创建的,并分配给应用使用的 HTTPS 接口。如果第一次访问 HTTPS 接口时文件不存在,则将生成包含证书的密钥存储。

示例:使用自签名证书的默认 ApplicationRealm

<security-realm name="ApplicationRealm">
  <server-identities>
    <ssl>
      <keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/>
    </ssl>
  </server-identities>
  ...
</security-realm>

示例:默认 HTTPS 接口配置

<subsystem xmlns="urn:jboss:domain:undertow:10.0">
    ...
    <server name="default-server">
        ...
        <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
        <host name="default-host" alias="localhost">
        ...

注意

如果要禁用自签名证书创建,您需要从服务器密钥存储配置中删除 generate-self-signed-certificate-host="localhost"。generate-self-signed-certificate-host 属性包含应为其生成自签名证书的主机名。

警告

此自签名证书仅用于测试目的,不适用于在生产环境中使用。有关使用 Elytron 为应用程序配置 SSL/TLS 的更多信息,请参阅使用 Elytron 子系统为应用启用单向 SSL/TLS,并使用 Elytron Subsystem 部分为应用启用双向 SSL/TLS。有关为具有传统安全性的应用程序配置 SSL/TLS 的更多信息,请参阅使用传统安全 Realms 为应用程序启用单向 SSL/TLS,并为使用 Legacy Security Realms 的应用程序启用双向 SSL/TLS

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部