红联Linux门户
Linux帮助

创建openssl证书和CA的最简单的方法

发布时间:2008-08-09 00:52:52来源:红联作者:sloepx
今天打开thunderbird连接到VPS上的dovecot imaps邮件服务器,thunderbird报告说ssl证书过期了。原来是dovecot安装时候自带的证书有效期太短,今天到期了,该更新证书了。

网络上搜索到的大部分方法都是用openssl命令来创建ca和证书,这种方法比较麻烦,容易出错。

我用certtool工具又重新创建了一个ca和一个自认证的openssl证书。过程记录如下:

certtool这个工具包含在gnutls这个包里面,首先要在VPS上安装这个包,在Debian/Ubuntu VPS上运行

apt-get install gnutls-bin gnutls-doc

在CentOS VPS上需要运行:

yum install -y gnutls-utils

创建ca.info文件,内容如下:

cn = rashostcacert_signing_keyexpiration_days = 3650

创建CA:

certtool --generate-privkey > ca.keycerttool --generate-self-signed --load-privkey ca.key --template ca.info --outfile ca.certcerttool -i --infile ca.cert

创建rashost.com.info文件,内容如下:

organization = rashost Inc.cn = rashost.comtls_www_serverencryption_keysigning_keyexpiration_days = 3650

然后创建证书:

certtool --generate-privkey > rashost.com.keycerttool --generate-certificate --load-privkey rashost.com.key --load-ca-certificate ca.cert --load-ca-privkey ca.key --template rashost.com.info --outfile rashost.com.certcerttool -i --infile rashost.com.cert

rashost.com.cert是证书文件,rashost.com.key是密钥文件,在dovecot的配置文件里使用这两个文件就可以了。

地址 http://vpsblog.rashost.com/
文章评论

共有 2 条评论

  1. blue_eagle 于 2010-10-18 23:10:16发表:

    学习了。顶一下。最近在研究SSL。希望能获取更多CA相关的知识。

  2. wangyoubang 于 2009-08-02 09:22:34发表:

    顶一个 学习了