8.5. 注册自定义验证插件


自定义身份验证插件模块可以通过 CA 控制台注册。身份验证插件模块也可以通过 CA 控制台删除。在删除模块之前,删除基于该模块的实例。

注意

要编写自定义插件,请参阅 身份验证插件教程

  1. 创建自定义身份验证类。在本例中,自定义身份验证插件名为 UidPwdDirAuthenticationTestms.java
  2. 编译新类。

    # javac -d . -classpath $CLASSPATH UidPwdDirAuthenticationTestms.java
    Copy to Clipboard Toggle word wrap
  3. 在 CA 的 WEB-INF Web 目录中创建目录来保存自定义类,以便 CA 可以访问它们以获取注册表单。

    # mkdir /usr/share/pki/ca/webapps/ca/WEB-INF/classes
    Copy to Clipboard Toggle word wrap
  4. 将新插件文件复制到新 目录中,并将所有者设置为证书系统用户(pkiuser)。

    # cp -pr com /usr/share/pki/ca/webapps/ca/WEB-INF/classes
    
    # chown -R pkiuser:pkiuser /usr/share/pki/ca/webapps/ca/WEB-INF/classes
    Copy to Clipboard Toggle word wrap
  5. 登录到控制台。

    # pkiconsole -d nssdb -n 'optional client cert nickname' https://server.example.com:8443/ca
    Copy to Clipboard Toggle word wrap
    注意

    pkiconsole 已被弃用,并将在以后的主发行版本中被新的基于浏览器的 UI 替代。虽然 pkiconsole 在发布替代 UI 之前继续可用,但我们鼓励在此鼓励使用命令行与 pkiconsole 等效,因为 pki CLI 将继续支持并在将来有新的基于浏览器的 UI 时受到改进。

  6. 注册插件。

    1. Configuration 选项卡中,单击导航树中的 Authentication
    2. 在右侧窗格中,点 Authentication Plug-in Registration 选项卡。

      选项卡中列出了已注册的模块。

    3. 要注册插件,请点击 Register

      此时会出现 Register Authentication Plug-in Implementation 窗口。

    4. 通过填写两个字段来指定要注册的模块:

      • 插件名称。模块的名称。
      • 类名称。此模块的类的全名。这是到实现 #Java™ 类的路径。如果此类是软件包的一部分,请包含软件包名称。例如,要在名为 com.customplugins 的软件包中注册一个名为 customAuth 的类,类名称为 com.customplugins.customAuth
  7. 注册模块后,将模块添加为活跃的身份验证实例。

    1. Configuration 选项卡中,单击导航树中的 Authentication
    2. 在右侧窗格中,单击 Authentication Instance 选项卡。
    3. Add
    4. 从列表中选择自定义模块 UidPwdDirAuthenticationTestms.java 来添加模块。填写模块的适当配置。
  8. 创建新的最终用户注册表,以使用新的身份验证模块。

    # cd /var/lib/pki/pki-tomcat/ca/profiles/ca
    Copy to Clipboard Toggle word wrap
    # cp -p caDirUserCert.cfg caDirUserCertTestms.cfg
    Copy to Clipboard Toggle word wrap
    # vi caDirUserCertTestms.cfg
    
    desc=Test ms - This certificate profile is for enrolling user certificates with directory-based authentication.
    visible=true
    enable=true
    enableBy=admin
    name=Test ms - Directory-Authenticated User Dual-Use Certificate Enrollment
    auth.instance_id=testms
    ...
    Copy to Clipboard Toggle word wrap
  9. 将新配置集添加到 CA 的 CS.cfg 文件中。

    TIP

    在编辑前备份 CS.cfg 文件。

    # vim /var/lib/pki/instance-name/ca/conf/CS.cfg
    
    profile.list=caUserCert,caDualCert,caSignedLogCert,caTPSCert,caRARouterCert,caRouterCert,caServerCert,caOtherCert,caCACert,caInstallCACert,caRACert,caOCSPCert,caTransportCert,caDirUserCert,caAgentServerCert,caAgentFileSigning,caCMCUserCert,caFullCMCUserCert,caSimpleCMCUserCert,caTokenDeviceKeyEnrollment,caTokenUserEncryptionKeyEnrollment,caTokenUserSigningKeyEnrollment,caTempTokenDeviceKeyEnrollment,caTempTokenUserEncryptionKeyEnrollment,caTempTokenUserSigningKeyEnrollment,caAdminCert,caInternalAuthServerCert,caInternalAuthTransportCert,caInternalAuthKRAstorageCert,caInternalAuthSubsystemCert,caInternalAuthOCSPCert,DomainController,caDirUserCertTestms
    ...
    profile.caDirUserCertTestms.class_id=caEnrollImpl
    profile.caDirUserCertTestms.config=/var/lib/pki/pki-tomcat/ca/profiles/ca/caDirUserCertTestms.cfg
    Copy to Clipboard Toggle word wrap
  10. 重启 CA。

    # pki-server restart instance_name
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat