使用Let's Encrypt免费证书实现https

使用Let's Encrypt免费证书实现https

使用Let's Encrypt免费证书实现https

使用Let's Encrypt免费证书实现https

Let's Encrypt是一家免费、开放、自动化的证书颁发机构(CA),为公众的利益而运行(由非盈利组织互联网安全研究小组(ISRG)运营)。

前提:你需要有自己的域名

生成证书的方式有很多种,详情点击这里。
我这里以Certbot来生成证书。

(1)、选择证书服务对象和操作系统

使用Let's Encrypt免费证书实现https

选择完后下拉就会出现具体的操作步骤,如下:

使用Let's Encrypt免费证书实现https

(2)、安装epel源

yum install epel-release -y

其他操作系统及其安装方法可以点这里。

(3)、安装certbot

yum install certbot python2-certbot-nginx

(4)、生成证书

可以选择两种方式。
第一种,直接生成证书并配置NGINX。

certbot --nginx

第二种,只生成证书,NGINX需要自己配置

certbot certonly --nginx

我选择的第二种,输出详情如下:

[root@VM_0_2_centos ssl]# certbot certonly --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): coolops@163.com
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Starting new HTTPS connection (1): supporters.eff.org

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: jenkins.coolops.cn
2: www.coolops.cn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for jenkins.coolops.cn
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/jenkins.coolops.cn/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/jenkins.coolops.cn/privkey.pem
   Your cert will expire on 2020-08-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

安装步骤执行即可,当看到如上输出信息,则表明证书签发成功。
我们可以到相应的目录下查看证书

[root@VM_0_2_centos jenkins.coolops.cn]# cd /etc/letsencrypt/live/jenkins.coolops.cn
[root@VM_0_2_centos jenkins.coolops.cn]# ll 
total 4
lrwxrwxrwx 1 root root  42 May 25 14:50 cert.pem -> ../../archive/jenkins.coolops.cn/cert1.pem
lrwxrwxrwx 1 root root  43 May 25 14:50 chain.pem -> ../../archive/jenkins.coolops.cn/chain1.pem
lrwxrwxrwx 1 root root  47 May 25 14:50 fullchain.pem -> ../../archive/jenkins.coolops.cn/fullchain1.pem
lrwxrwxrwx 1 root root  45 May 25 14:50 privkey.pem -> ../../archive/jenkins.coolops.cn/privkey1.pem
-rw-r--r-- 1 root root 692 May 25 14:50 README
注意:证书是有过期时间的,默认是3个月,我们可以使用脚本自动续约(见后文)。

(5)、配置NGINX

 server{
         listen 80 ;
         listen 443 ssl;
         server_name jenkins.coolops.cn;
         ssl_certificate /etc/letsencrypt/live/jenkins.coolops.cn/fullchain.pem;
         ssl_certificate_key /etc/letsencrypt/live/jenkins.coolops.cn/privkey.pem;
         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
         ssl_prefer_server_ciphers  on;
         ssl_session_cache    shared:SSL:1m;
         ssl_session_timeout  5m;

         location / {
                 proxy_connect_timeout 180;
                 proxy_send_timeout 180;
                 proxy_read_timeout 180;
                 proxy_set_header Host $host;
                 proxy_set_header X-Forwarder-For $remote_addr;
                 proxy_pass http://127.0.0.1:8080;
         }
 }

然后浏览器访问,并查看证书信息如下:

使用Let's Encrypt免费证书实现https

(6)、配置证书自动续签

官方已经提供了,直接加入cron即可。

echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew -q" | sudo tee -a /etc/crontab > /dev/null


原文地址:https://blog.51cto.com/15080014/2653727

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


基础环境、流程图1)流程图jenkinspipeline发布应用2)、jenkins上安装kubectl#主节点上查看kubectl位置[root@k8s01~]#whichkubectl/usr/bin/kubectl#将k8s节点的kubectl文件cp至jenkinsscp10.0.0.101:/usr/bin/kubectl.cp./kubectl/usr/local/bin/kubectl
本节是建立在流水线入门内容的基础上,而且,应当被当作一个参考。对于在实际示例中如何使用流水线语法的更多信息,请参阅本章在流水线插件的2.5版本中的使用Jenkinsfile部分,流水线支持两种离散的语法,具体如下对于每种的优缺点,参见语法比较。正如本章开始讨论的,流水线最
Linuxcentos7安装Jenkins(jenkins-2.227-1.1.noarch.rpm)时遇到问题:1.出现问题1:安装jenkins一直失败,提示Nosuchfileordirectory[helen@linuxprobeJenkins]$sudorpm-ivhjenkins-2.227-1.1.noarch.rpmPreparing...####################
作为一个拥有很多账号的当代美少女,忘记用户名密码什么的是再正常不过的事了。“忘记密码”这一功能给我真的带来了很大的福音啊。但是最近重新使用Jenkins时,看到需要输入用户名密码,顿时脑子一片空白。经过一系列的查找,终于解决了问题,害,只有把方法记下来才是王道,以后妈妈再
Jenkins、GitLab和Maven(Nexus)完成自动构建迈向持续集成持续集成,毋庸置疑的是这是两部分要求,一个是持续一个是集成,那么持续和集成到底表示了什么要求和含义呢?其中的集成比较容易理解就是指开发人员将自己开发的代码不断地交付给全部系统的代码,在Git仓的概念之下也就是不断地
 下载文档https://www.jenkins.io/zh/download/  Debian下载1.下载安装keyhttps://pkg.jenkins.io/debian-stable/jenkins.io.key  
流水线建设从Jenkins部署开始Jenkins是一个独立的开源自动化服务器,可以用来自动化,例如构建、测试和部署软件等各种任务,是一个实现CI(持续集成)的很好的工具。Jenkins可以通过本地系统包、Docker安装,甚至可以在安装Java运行时环境的机器上独立运行。JenkCI/CD的概念谈到持
原因:这种情况是SSHServer中的RemoteDirectory路径不存在。解决方法:重新输入目标服务器中存在的路径。      
什么是持续集成持续集成(Continuousintegration,简称CI)指的是,频繁地(一天多次)将代码集成到主干。持续集成的目的,就是让产品可以快速迭代,同时还能保持高质量。它的核心措施是,代码集成到主干之前,必须通过自动化测试。只要有一个测试用例失败,就不能集成。通过持续集成,团
Tomcat安装:1.下载Tomcat包:http:/omcat.apache.org/并解压2.启动:双击bin\startup.bat文件浏览器访问:http://localhost:8080/3.Tomcat配置登录:打开confomcat-users.xml文件添加如下代码:<rolerolename="manager-gui"/><userusername="admin"password=&q
文章目录jenkinscron笔记简介H符号(hash的简写)别名例子jenkinscron笔记简介jenkinscron遵循普通cron的语法,略有不同,每行包含五个字段可以使用Tab和空行分割分钟小时日月周0-590-231-311-120-7(0和7都表示周日)可以使用以下操作符为一个字段指定多个值(按照
1.nginx的配置location/jenkinsno{indexindex.htmlindex.htm;proxy_passhttp://127.0.0.1:8081;proxy_connect_timeout3000s;proxy_send_timeout3000s;proxy_read_timeout3000s;prox
1、下载安装插件下载地址:http://files.jetbrains.org.cn/aliyun-oss.hpi在Jenkins中安装插件,请到ManageJenkins->Advanced->Upload,上传插件(.hpi文件)安装完毕后请重新启动Jenkins2、搜索安装jenkins插件安装3、安装完成以后配置阿里云oss账号oss这边设置:(账号的权限也要
首先将构建历史清除Jenkins构建历史删除与重置然后进入Jenkins服务器工作目录oot/.jenkinstar-czvfjobs.tarjobs 将jobs打包将job.tar文件复制到新Jenkins服务器相同目录下解压tar包 tar-zxvfjob.tar登录新JenkinsJenkins-系统管理-读取配置,只有点击了读取配置,原
一、动态生成Slave1.1、简介之前我们都是在物理机或者虚拟机上部署jenkins,但是这种部署方式会有一些难点,如下:主Master发生单点故障时,整个流程都不可用了每个Slave的配置环境不一样,来完成不同语言的编译打包等操作,但是这些差异化的配置导致管理起来非常不方便,维护起来也是
from jenkins import Jenkins# 判断job是否运行结束def build():    job = 'branch-deploy-wap'    params = {        'server_ip': '10.160.30.XXX',        'server_username': 'root',        'server_userpass&#
背景client端执行webUI自动化测试时依赖操作系统上安装了对应的浏览器,并且浏览器与驱动要进行版本的对应——而selenium是可以部署集群,通过远程的方式执行对应的自动化用例,方便高效。原理1、通过代码可知,自动化运行的主类接收了任务id,获取到任务信息后根据任务类型判断进行接口
背景工具选择架构设计及技术实现参数设计断言持续集成测试集编写总结  一、背景1.目前公司发展比较迅速,还处于不停堆业务阶段,所以迭代比较频繁,导致人工回归的成本越来越大2.在有限的测试资源情况下,开发自测的需求占比不低,后端频繁发布容易心里没底
本地pycharm打开项目,运行自动化项目下载项目代码,并用pycharm打开项目gitclonehttps://gitee.com/iread9527/iInterface_python.git进入iInterface_python目录下,cdiInterface_python使用pip3install-rrequirements.txt命令,安装python项目依赖的第三方库使
Jenkins邮件设置一、简介最近有朋友问Jenkins邮件设置的问题,想起来当时也是碰到不少坑,网上看了很多博客说的解决办法根本没有用。最后我解决了这个问题,在此记录一下,希望能够帮助到在网上搜了半天仍然徒劳无功的朋友们,我懂那种失败了一次又一次的感觉,希望能帮到大家。二、配置步