Let's Encrypt

证书!给树莓派安装时出现了安装python包卡死的情况,国内的网络伤不起!
所以专门新开一篇博文记录Let’s Encrypt证书的问题,两个官方网页:

certbot

acme-tiny

一、树莓派

实践、在树莓派配置let’s encrypt的免费CA证书:

注:Let’s Encrypt的配置工具有几种:具体内容待补充!注意证书有效期为三个月
Let’s Encrypt 免费好用的 HTTPS 证书 (Raspberry pi) | nginx启动,重启,关闭命令
su

apt-get update

lsof -i:443 #查询哪个进程占用了443端口。netstat -anp | grep 443,杀死占用端口的pidkill -9 pid。下装nmap查询nginx占据了80、443端口apt-get install nmap,查询端口占用情况nmap zhangqihui.me

wget https://dl.eff.org/certbot-auto

chmod a+x certbot-auto #注意打开ss,安装过程会被FGW阻挡!

./certbot-auto certonly –verbose –standalone -d zhangqihui.me -d www.zhangqihui.me #提示installing Python packages时挂起来了,用参数--verbose可以查看详细的安装过程,不至于懵逼的等待。可以不输入输入邮箱吧?有啥用?qdmcad@gmail.com,注意提示Congratulations! 内容
no response “Installing Python packages”
CertBot 快速let’s encrypt证书安装 #删除多余的virtualenvapt-get purge python-virtualenv python3-virtualenv virtualenv ;apt install virtualenv
编辑nginx配置文件“/etc/nginx/sites-enabled/default”,注意拼写与行尾的分号
ssl_certificate /etc/letsencrypt/live/greydesign.tk/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/greydesign.tk/privkey.pem;
重启nginx
nginx -s reload

以下皆为在树莓派配置letencrypt证书的失败操作!

参考 getting start 链接 Visit the Certbot site ,选择 nginx 和 debian 7

自动配置:

$ sudo ./certbot-auto –nginx #我真够莽撞的,因为我的nginx配置了自签名证书,也没有研究是否该通过防火墙暂停80与443端口
然后,等待了好长时间,安装了好多软件包,主要是很多python。然后,因为我是在公司,通过Termux远程访问树莓派的,突然断了,提示:
packet_write_wait:Connection to 124.129.237.72 port 22:Broken pipe
不甘心,回家在内网有运行了一次,这次提示错误:
Installation succeeded.

usage:

certbot-auto [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] …Certbot can obtain and install HTTPS/TLS/SSL certificates. By default,

it will attempt to use a webserver both for obtaining and installing the

certificate.

certbot: error: unrecognized arguments: –nginx
执行以上操作似乎没用啊,贸然使用自动配置不是一个好习惯,还是通过先生产证书文件,在手工配置比较靠谱,参考如下内容继续折腾:
Let’s Encrypt,免费好用的 HTTPS 证书

二、CentOS VPS

配置Let’s Encrypt证书:

nginx -s stop

firewall-cmd –list-ports

yum install epel-release

yum install certbot

certbot certonly –email qdmcad@gmail.com -a webroot –webroot-path=/var/www/html -d zhangqihui.cc -d www.zhangqihui.cc -d zhangqihui.mobi -d www.zhangqihui.mobi #未执行,继续研究!!!
CentOS7下nginx安装使用Let’s Encrypt证书的完整过程
Let’s Encrypt! Centos 获取https证书攻略

实践、在Vultr VPS上配置let’s encrypt的免费CA证书:

参考 Linux VPS主机Debian/CentOS安装LetsEncrypt免费SSL证书记录

ssh root@www.zhangqihui.tk #通过Termux远程访问我的美国服务器

uname -a #查看是否centos系统,似乎这个命令不对啊

sudo yum update #如果不是root用户登录,需要用到sudo

sudo yum install git-all #安装git,似乎安装了很多perl

mkdir ~/src #新建一个目录,用于安装letsencrypt

cd ~/src

git clone https://github.com/letsencrypt/letsencrypt

cd letsencrypt

sudo chmod g+x letsencrypt-auto

./letsencrypt-auto
会提示错误:

Complete!
Creating virtual environment…
Installing Python packages…
Installation successed.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Failed to find executable apachectl in PATH: /usr/local/sibn:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
Cerbot doesn’t know how to automatically cofnigure the web server to this system.However,it can still get a certificate for you.Please run “letsencrypt-auto certonly” to do so.You’ll need to manually configure your web server to usr the resulting certificate.

好吧,我的vultr VPS没有安装任何apache或者nginx服务,改用手动生成CA文件:待补充

三、在github上配置let’s encrypt的免费CA证书:目前不支持,放弃吧

 

参考汇总:
【原创】在树莓派3上给Nginx部署免费HTTPS证书
使用let’s encrypt工具配置Nginx HTTPS
手动配置 Let’s Encrypt+Nginx/Apache, certonly, 解决 DialogError