您的位置:首页 > 其它

使用 Let's Encrypt 签发免费SSL 证书

2016-05-11 20:08 573 查看
Let’s Encrypt 是新出现的证书颁发机构,他是开源并且自动化的。
官方首页:https://letsencrypt.org/

项目代码:https://github.com/certbot/certbot

有关此项目的详细信息,请到官方了解。这里说说Let's Encrypt client 的事情。

安装:
可使用git 克隆项目,亦可wget 下载项目
下载
git clone https://github.com/letsencrypt/letsencrypt[/code]安装,并显示帮助信息 
cd letsencrypt
./letsencrypt-auto --help
或者显示详细帮助信息

./letsencrypt-auto --help all
安装完成后会显示"安装成功"提示,以及可执行二进制文件具体路径,如图




安装过程中如遇到
./letsencrypt-auto: line 521: virtualenv: command not found
错误,请执行
pip install virtualenv
如没有安装pip,可执行如下命令安装pip
yum install python-setuptools
east_install pip


生成证书:
支持的认证方式
--apache Use the Apache plugin for authentication & installation
--standalone Run a standalone webserver for authentication
(nginx support is experimental, buggy, and not installed by default)
--webroot Place files in a server's webroot folder for authentication

web服务是apache的就使用--apache参数申请
nginx的或其他的 使用--standalone
用web服务根目录方式认证的 就使用--webroot

首次运行时,会询问邮件和许可协议,可使用--email --agree-tos 参数指定
--standalone 为例
/root/.local/share/letsencrypt/bin/letsencrypt certonly --email you.email  --agree-tos \
--standalone -d example.com -d www.example.com -d other.example.net
--apache 为例
/root/.local/share/letsencrypt/bin/letsencrypt certonly --email you.email  --agree-tos \
--apache example.com --apache-le-vhost-ext /etc/httpd/conf.d/ssl.conf
--webroot 为例
/root/.local/share/letsencrypt/bin/letsencrypt certonly --email you.email  --agree-tos \
--webroot -w /var/www/example -d example.com -d www.example.com \
-w /var/www/thing -d thing.net -d m.thing.net
我使用的是--standalone方式,另外两种方式可通过帮助获取方法
申请成功后,会在/etc/letsencrypt/live/ 目录内生成对应的域名目录,目录内含有证书文件
cert.pem - Apache服务器端证书
chain.pem - Apache根证书和中继证书
fullchain.pem - Nginx所需要ssl_certificate文件
privkey.pem - 安全证书KEY文件

证书生成后,在web服务内配置ssl即可,相关配置不在此阐述。

需要注意,以上几种认证方式,有的需要通过80端口发出申请,此时需要确认80端口未被占用。有的需要在webroot下创建目录,在申请时请根据提示创建即可。

Let’s Encrypt 证书有效期为90天,到期后可通过renew更新,更新前提,证书必须是临近到期时间才会更新成功
/root/.local/share/letsencrypt/bin/letsencrypt renew
可将此命令加入到crontab中实现自动续期
crontab -e
添加如下内容
0 3 */89 * * /root/.local/share/letsencrypt/bin/letsencrypt renew
重启crond服务

service crond restart


有关web配置ssl,可参考http://www.vpser.net/build/letsencrypt-free-ssl.html

还有一种申请方式为使用自己私钥申请,请参考/content/3497730.html

本文出自 “morrowind” 博客,请务必保留此出处http://morrowind.blog.51cto.com/1181631/1772365
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: