要在 RHEL 8.x 虚拟机 (VM) 上配置智能卡重定向功能,请安装该功能所依赖的库、支持智能卡可信身份验证的根 CA 证书以及所需的 PC/SC Lite 库。

前提条件

将 RHEL 8.x 虚拟机与 Active Directory 集成以进行智能卡重定向

过程

  1. 安装所需的库。
    yum install -y opensc pcsc-lite pcsc-lite-libs pcsc-lite-ccid nss-tools
  2. 启用 pcscd 服务。
    systemctl enable pcscd
    systemctl start pcscd
  3. 确保 /etc/sssd/sssd.conf 配置文件包含以下行,这些行将启用智能卡身份验证。
    [pam]
    pam_cert_auth = True
  4. 将所需的 CA 证书复制到 /etc/sssd/pki/sssd_auth_ca_db.pem
    openssl x509 -inform der -in certificate.cer -out certificate.pem
    cp certificate.pem /etc/sssd/pki/sssd_auth_ca_db.pem
  5. 要验证智能卡的状态,请运行以下 pkcs11-tool 命令,并确认它们返回正确的输出。
    pkcs11-tool -L
    
    pkcs11-tool --login -O
    
    pkcs11-tool --test --login
  6. 设置 PKCS11 模块。
    cp libcmP11.so /usr/lib64/
  7. 创建 /usr/share/p11-kit/modules/libcmP11.module 文件。在该文件中添加以下内容。
    # This file describes how to load the opensc module
    # See: http://p11-glue.freedesktop.org/doc/p11-kit/config.html
     
    # This is a relative path, which means it will be loaded from
    # the p11-kit default path which is usually $(libdir)/pkcs11.
    # Doing it this way allows for packagers to package opensc for
    # 32-bit and 64-bit and make them parallel installable
    module: /usr/lib64/libcmP11.so
    priority: 99
  8. 将 PC/SC Lite 更新到版本 1.8.8。
    yum install -y git flex autoconf automake libtool libudev-devel flex
    git clone https://salsa.debian.org/rousseau/PCSC.git
    cd PCSC
    git checkout -b pcsc-1.8.8 1.8.8
    ./bootstrap
    ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu 
         --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr 
         --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share 
         --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec 
         --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man 
         --infodir=/usr/share/info --disable-static --enable-usbdropdir=/usr/lib64/pcsc/drivers
    make
    make install
  9. 安装 Horizon Agent 软件包并启用智能卡重定向。
    sudo ./install_viewagent.sh -m yes
  10. 重新启动虚拟机,然后重新登录。