Zimbra更换邮箱SSL证书

更换zimbra的ssl证书

有台用zimbra部署的邮箱服务器证书马上到期了,之前用的StartSSL突然抽风,不知为何不能申请证书了。于是临时换用了沃通的免费证书来应急一下。   中间遇到了些困难,主要是被网上搜索的一些文章给误导了,失败了无数次。   记录下更换过程。

申请证书

  1. 先到沃通官网申请证书点此跳转
  2. 按上面的要求一步步申请完证书
  3. 证书下载回来后,打开文件选择解压for Other Apache.zip, 其中有3个文件: > 根证书:1_root_bundle.crt > 公钥证书:2_domain.com.crt > 私钥:3_domain.com.key

替换证书

  1. 把上面解压出来的三个文件上传到服务器
  2. 下载 顶级根证书,然后把顶级根证书的内容加到公钥证书中

    cat startcom.crt >> 2_domain.com.crt
    
  3. 替换服务器上旧的私钥文件

    mv /opt/zimbra/ssl/zimbra/commercial/commercial.key /data/backup/commercial.key.${RANDOM}
    cp 3_domain.com.key /opt/zimbra/ssl/zimbra/commercial/commercial.key
    
  4. 校验证书

    /opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key 2_domain.com.crt 1_root_bundle.crt
        
    # 校验成功会有这样的提示
    ** Verifying 2_domain.com.crt against /opt/zimbra/ssl/zimbra/commercial/commercial.key
    Certificate (2_domain.com.crt) and private key (/opt/zimbra/ssl/zimbra/commercial/commercial.key) match.
    Valid Certificate: 2_domain.com.crt: OK
    
  5. 更新证书

    /opt/zimbra/bin/zmcertmgr deploycrt comm 2_domain.com.crt 1_root_bundle.crt
        
    # 更新成功会有这样的提示
    ** Verifying 2_domain.com.crt against /opt/zimbra/ssl/zimbra/commercial/commercial.key
    Certificate (2_domain.com.crt) and private key (/opt/zimbra/ssl/zimbra/commercial/commercial.key) match.
    Valid Certificate: 2_domain.com.crt: OK
    ** Copying 2_domain.com.crt to /opt/zimbra/ssl/zimbra/commercial/commercial.crt
    ** Appending ca chain 1_root_bundle.crt to /opt/zimbra/ssl/zimbra/commercial/commercial.crt
    ** Importing certificate /opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt to CACERTS as zcs-user-commercial_ca...done.
    ** NOTE: mailboxd must be restarted in order to use the imported certificate.
    ** Saving server config key zimbraSSLCertificate...done.
    ** Saving server config key zimbraSSLPrivateKey...done.
    ** Installing mta certificate and key...done.
    ** Installing slapd certificate and key...done.
    ** Installing proxy certificate and key...done.
    ** Creating pkcs12 file /opt/zimbra/ssl/zimbra/jetty.pkcs12...done.
    ** Creating keystore file /opt/zimbra/mailboxd/etc/keystore...done.
    ** Installing CA to /opt/zimbra/conf/ca...done.
    
  6. 重启zmcontrol

    su - zimbra
    zmcontrol restart
    
  7. 重启完了后重启登录页面,可以看到邮箱证书已经替换成功