使用Let’s Encrypt的免费证书在Centos7搭建SSL服务 一 (申请免费证书)
Let’s Encrypt作为一个公共且免费SSL的项目逐渐被广大用户传播和使用,是由Mozilla、Cisco、Akamai、IdenTrust、EFF等组织人员发起,主要的目的也是为了推进网站从HTTP向HTTPS过度的进程,目前已经有越来越多的商家加入和赞助支持。
Let’s Encrypt免费SSL证书的出现,也会对传统提供付费SSL证书服务的商家有不小的打击。到目前为止,Let’s Encrypt获得IdenTrust交叉签名,这就是说可以应用且支持包括FireFox、Chrome在内的主流浏览器的兼容和支持,虽然目前是公测阶段,但是也有不少的用户在自有网站项目中正式使用起来。
虽然目前Let’s Encrypt免费SSL证书默认是90天有效期,但是我们也可以到期自动续约,不影响我们的尝试和使用,为了考虑到文章的真实性和以后的实战性,老左准备利用一些时间分篇幅的展现在应用Let’s Encrypt证书的过程,这篇文章分享申请的方法教程。
安装准备
根据官方的要求,我们在VPS、服务器上部署Let’s Encrypt免费SSL证书之前,需要系统支持Python2.7以上版本以及支持GIT工具。这个需要根据我们不同的系统版本进行安装和升级。
首先安装Git
1 |
yum -y install git-core |
安装过程如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
Dependencies Resolved ============================================================================================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================================================================================ Installing: git x86_64 1.8.3.1-14.el7_5 updates 4.4 M Installing for dependencies: libgnome-keyring x86_64 3.12.0-1.el7 base 109 k perl-Error noarch 1:0.17020-2.el7 base 32 k perl-Git noarch 1.8.3.1-14.el7_5 updates 54 k perl-TermReadKey x86_64 2.30-20.el7 base 31 k rsync x86_64 3.1.2-4.el7 base 403 k Transaction Summary ============================================================================================================================================================================================================================================ Install 1 Package (+5 Dependent packages) Total download size: 5.0 M Installed size: 23 M Is this ok [y/d/N]: y Downloading packages: (1/6): perl-Git-1.8.3.1-14.el7_5.noarch.rpm | 54 kB 00:00:00 (2/6): libgnome-keyring-3.12.0-1.el7.x86_64.rpm | 109 kB 00:00:00 (3/6): perl-Error-0.17020-2.el7.noarch.rpm | 32 kB 00:00:00 (4/6): git-1.8.3.1-14.el7_5.x86_64.rpm | 4.4 MB 00:00:00 (5/6): perl-TermReadKey-2.30-20.el7.x86_64.rpm | 31 kB 00:00:00 (6/6): rsync-3.1.2-4.el7.x86_64.rpm | 403 kB 00:00:00 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 17 MB/s | 5.0 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:perl-Error-0.17020-2.el7.noarch 1/6 Installing : rsync-3.1.2-4.el7.x86_64 2/6 Installing : perl-TermReadKey-2.30-20.el7.x86_64 3/6 Installing : libgnome-keyring-3.12.0-1.el7.x86_64 4/6 Installing : perl-Git-1.8.3.1-14.el7_5.noarch 5/6 Installing : git-1.8.3.1-14.el7_5.x86_64 6/6 Verifying : git-1.8.3.1-14.el7_5.x86_64 1/6 Verifying : libgnome-keyring-3.12.0-1.el7.x86_64 2/6 Verifying : perl-TermReadKey-2.30-20.el7.x86_64 3/6 Verifying : 1:perl-Error-0.17020-2.el7.noarch 4/6 Verifying : rsync-3.1.2-4.el7.x86_64 5/6 Verifying : perl-Git-1.8.3.1-14.el7_5.noarch 6/6 Installed: git.x86_64 0:1.8.3.1-14.el7_5 Dependency Installed: libgnome-keyring.x86_64 0:3.12.0-1.el7 perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-14.el7_5 perl-TermReadKey.x86_64 0:2.30-20.el7 rsync.x86_64 0:3.1.2-4.el7 Complete! |
快速获取Let’s Encrypt免费SSL证书
1 2 3 4 |
cd / git clone https://github.com/letsencrypt/letsencrypt cd letsencrypt ./letsencrypt-auto certonly --standalone --email admin@code2048.net -d code2048.net -d www.code2048.net |
注意事项:
1.把需要支持的所有域名 都写上 -d 后面跟域名,有几个写几个
然后执行上面的脚本,我们需要根据自己的实际站点情况将域名更换成自己需要部署的。
2.填的邮箱最好是国外邮箱或QQ邮箱,要不然发邮件收不到(下面过程中会发一个邮箱激活邮件)
3.执行的时候要把域名解析到这个服务器,要不然检测不到
4.执行的时候如果80和443端口被占用,就先暂时关闭占用端口的应用
执行过程如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
[root@poxiao ~]# git clone https://github.com/letsencrypt/letsencrypt Cloning into 'letsencrypt'... remote: Counting objects: 58233, done. remote: Compressing objects: 100% (52/52), done. remote: Total 58233 (delta 22), reused 15 (delta 6), pack-reused 58175 Receiving objects: 100% (58233/58233), 18.86 MiB | 25.54 MiB/s, done. Resolving deltas: 100% (42101/42101), done. [root@poxiao ~]# ls letsencrypt [root@poxiao ~]# cd letsencrypt [root@poxiao letsencrypt]# ./letsencrypt-auto certonly --standalone --email admin@code2048.net -d code2048.net -d www.code2048.net Bootstrapping dependencies for RedHat-based OSes... (you can skip this with --no-bootstrap) yum is /usr/bin/yum yum is hashed (/usr/bin/yum) Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package augeas-libs.x86_64 0:1.4.0-5.el7_5.1 will be installed ---> Package ca-certificates.noarch 0:2017.2.14-71.el7 will be updated ---> Package ca-certificates.noarch 0:2018.2.22-70.0.el7_5 will be an update ---> Package gcc.x86_64 0:4.8.5-16.el7 will be updated ---> Package gcc.x86_64 0:4.8.5-28.el7_5.1 will be an update --> Processing Dependency: libgomp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64 --> Processing Dependency: cpp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64 --> Processing Dependency: libgcc >= 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64 ---> Package libffi-devel.x86_64 0:3.0.13-18.el7 will be installed ---> Package openssl.x86_64 1:1.0.2k-8.el7 will be updated ---> Package openssl.x86_64 1:1.0.2k-12.el7 will be an update --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-12.el7 for package: 1:openssl-1.0.2k-12.el7.x86_64 ---> Package openssl-devel.x86_64 1:1.0.2k-12.el7 will be installed --> Processing Dependency: zlib-devel(x86-64) for package: 1:openssl-devel-1.0.2k-12.el7.x86_64 --> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-12.el7.x86_64 ---> Package python-devel.x86_64 0:2.7.5-68.el7 will be installed --> Processing Dependency: python(x86-64) = 2.7.5-68.el7 for package: python-devel-2.7.5-68.el7.x86_64 ---> Package python-tools.x86_64 0:2.7.5-68.el7 will be installed --> Processing Dependency: tkinter = 2.7.5-68.el7 for package: python-tools-2.7.5-68.el7.x86_64 ---> Package python-virtualenv.noarch 0:15.1.0-2.el7 will be installed ---> Package python2-pip.noarch 0:8.1.2-5.el7 will be updated ---> Package python2-pip.noarch 0:8.1.2-6.el7 will be an update ---> Package redhat-rpm-config.noarch 0:9.1.0-80.el7.centos will be installed --> Processing Dependency: dwz >= 0.4 for package: redhat-rpm-config-9.1.0-80.el7.centos.noarch --> Processing Dependency: zip for package: redhat-rpm-config-9.1.0-80.el7.centos.noarch --> Processing Dependency: perl-srpm-macros for package: redhat-rpm-config-9.1.0-80.el7.centos.noarch --> Running transaction check ---> Package cpp.x86_64 0:4.8.5-16.el7 will be updated ---> Package cpp.x86_64 0:4.8.5-28.el7_5.1 will be an update ---> Package dwz.x86_64 0:0.11-3.el7 will be installed ---> Package krb5-devel.x86_64 0:1.15.1-19.el7 will be installed --> Processing Dependency: libkadm5(x86-64) = 1.15.1-19.el7 for package: krb5-devel-1.15.1-19.el7.x86_64 --> Processing Dependency: krb5-libs(x86-64) = 1.15.1-19.el7 for package: krb5-devel-1.15.1-19.el7.x86_64 --> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-19.el7.x86_64 --> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-19.el7.x86_64 --> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-19.el7.x86_64 --> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-19.el7.x86_64 ---> Package libgcc.x86_64 0:4.8.5-16.el7 will be updated ---> Package libgcc.x86_64 0:4.8.5-28.el7_5.1 will be an update ---> Package libgomp.x86_64 0:4.8.5-16.el7 will be updated ---> Package libgomp.x86_64 0:4.8.5-28.el7_5.1 will be an update ---> Package openssl-libs.x86_64 1:1.0.2k-8.el7 will be updated ---> Package openssl-libs.x86_64 1:1.0.2k-12.el7 will be an update ---> Package perl-srpm-macros.noarch 0:1-8.el7 will be installed ---> Package python.x86_64 0:2.7.5-58.el7 will be updated ---> Package python.x86_64 0:2.7.5-68.el7 will be an update --> Processing Dependency: python-libs(x86-64) = 2.7.5-68.el7 for package: python-2.7.5-68.el7.x86_64 ---> Package tkinter.x86_64 0:2.7.5-68.el7 will be installed --> Processing Dependency: libtk8.5.so()(64bit) for package: tkinter-2.7.5-68.el7.x86_64 --> Processing Dependency: libtcl8.5.so()(64bit) for package: tkinter-2.7.5-68.el7.x86_64 --> Processing Dependency: libX11.so.6()(64bit) for package: tkinter-2.7.5-68.el7.x86_64 --> Processing Dependency: libTix.so()(64bit) for package: tkinter-2.7.5-68.el7.x86_64 ---> Package zip.x86_64 0:3.0-11.el7 will be installed ---> Package zlib-devel.x86_64 0:1.2.7-17.el7 will be installed --> Running transaction check ---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed ---> Package krb5-libs.x86_64 0:1.15.1-8.el7 will be updated ---> Package krb5-libs.x86_64 0:1.15.1-19.el7 will be an update ---> Package libX11.x86_64 0:1.6.5-1.el7 will be installed --> Processing Dependency: libX11-common >= 1.6.5-1.el7 for package: libX11-1.6.5-1.el7.x86_64 --> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-1.el7.x86_64 ---> Package libcom_err-devel.x86_64 0:1.42.9-12.el7_5 will be installed --> Processing Dependency: libcom_err(x86-64) = 1.42.9-12.el7_5 for package: libcom_err-devel-1.42.9-12.el7_5.x86_64 ---> Package libkadm5.x86_64 0:1.15.1-19.el7 will be installed ---> Package libselinux-devel.x86_64 0:2.5-12.el7 will be installed --> Processing Dependency: libselinux(x86-64) = 2.5-12.el7 for package: libselinux-devel-2.5-12.el7.x86_64 --> Processing Dependency: libsepol-devel(x86-64) >= 2.5-6 for package: libselinux-devel-2.5-12.el7.x86_64 --> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-12.el7.x86_64 --> Processing Dependency: pkgconfig(libpcre) for package: libselinux-devel-2.5-12.el7.x86_64 ---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed ---> Package python-libs.x86_64 0:2.7.5-58.el7 will be updated ---> Package python-libs.x86_64 0:2.7.5-68.el7 will be an update ---> Package tcl.x86_64 1:8.5.13-8.el7 will be installed ---> Package tix.x86_64 1:8.4.3-12.el7 will be installed ---> Package tk.x86_64 1:8.5.13-6.el7 will be installed --> Processing Dependency: libXft.so.2()(64bit) for package: 1:tk-8.5.13-6.el7.x86_64 --> Running transaction check ---> Package libX11-common.noarch 0:1.6.5-1.el7 will be installed ---> Package libXft.x86_64 0:2.3.2-2.el7 will be installed --> Processing Dependency: fontconfig >= 2.2-1 for package: libXft-2.3.2-2.el7.x86_64 --> Processing Dependency: libfontconfig.so.1()(64bit) for package: libXft-2.3.2-2.el7.x86_64 --> Processing Dependency: libXrender.so.1()(64bit) for package: libXft-2.3.2-2.el7.x86_64 ---> Package libcom_err.x86_64 0:1.42.9-10.el7 will be updated --> Processing Dependency: libcom_err(x86-64) = 1.42.9-10.el7 for package: e2fsprogs-1.42.9-10.el7.x86_64 --> Processing Dependency: libcom_err(x86-64) = 1.42.9-10.el7 for package: libss-1.42.9-10.el7.x86_64 --> Processing Dependency: libcom_err(x86-64) = 1.42.9-10.el7 for package: e2fsprogs-libs-1.42.9-10.el7.x86_64 ---> Package libcom_err.x86_64 0:1.42.9-12.el7_5 will be an update ---> Package libselinux.x86_64 0:2.5-11.el7 will be updated --> Processing Dependency: libselinux(x86-64) = 2.5-11.el7 for package: libselinux-utils-2.5-11.el7.x86_64 --> Processing Dependency: libselinux(x86-64) = 2.5-11.el7 for package: libselinux-python-2.5-11.el7.x86_64 ---> Package libselinux.x86_64 0:2.5-12.el7 will be an update ---> Package libsepol-devel.x86_64 0:2.5-8.1.el7 will be installed --> Processing Dependency: libsepol(x86-64) = 2.5-8.1.el7 for package: libsepol-devel-2.5-8.1.el7.x86_64 ---> Package libxcb.x86_64 0:1.12-1.el7 will be installed --> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.12-1.el7.x86_64 ---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed --> Running transaction check ---> Package e2fsprogs.x86_64 0:1.42.9-10.el7 will be updated ---> Package e2fsprogs.x86_64 0:1.42.9-12.el7_5 will be an update ---> Package e2fsprogs-libs.x86_64 0:1.42.9-10.el7 will be updated ---> Package e2fsprogs-libs.x86_64 0:1.42.9-12.el7_5 will be an update ---> Package fontconfig.x86_64 0:2.10.95-11.el7 will be installed --> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.10.95-11.el7.x86_64 --> Processing Dependency: font(:lang=en) for package: fontconfig-2.10.95-11.el7.x86_64 ---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed ---> Package libXrender.x86_64 0:0.9.10-1.el7 will be installed ---> Package libselinux-python.x86_64 0:2.5-11.el7 will be updated ---> Package libselinux-python.x86_64 0:2.5-12.el7 will be an update ---> Package libselinux-utils.x86_64 0:2.5-11.el7 will be updated ---> Package libselinux-utils.x86_64 0:2.5-12.el7 will be an update ---> Package libsepol.x86_64 0:2.5-6.el7 will be updated ---> Package libsepol.x86_64 0:2.5-8.1.el7 will be an update ---> Package libss.x86_64 0:1.42.9-10.el7 will be updated ---> Package libss.x86_64 0:1.42.9-12.el7_5 will be an update --> Running transaction check ---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed ---> Package lyx-fonts.noarch 0:2.2.3-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================================================================================ Installing: augeas-libs x86_64 1.4.0-5.el7_5.1 updates 355 k libffi-devel x86_64 3.0.13-18.el7 base 23 k openssl-devel x86_64 1:1.0.2k-12.el7 base 1.5 M python-devel x86_64 2.7.5-68.el7 base 397 k python-tools x86_64 2.7.5-68.el7 base 855 k python-virtualenv noarch 15.1.0-2.el7 base 1.7 M redhat-rpm-config noarch 9.1.0-80.el7.centos base 79 k Updating: ca-certificates noarch 2018.2.22-70.0.el7_5 updates 392 k gcc x86_64 4.8.5-28.el7_5.1 updates 16 M openssl x86_64 1:1.0.2k-12.el7 base 492 k python2-pip noarch 8.1.2-6.el7 epel 1.7 M Installing for dependencies: dwz x86_64 0.11-3.el7 base 99 k fontconfig x86_64 2.10.95-11.el7 base 229 k fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k krb5-devel x86_64 1.15.1-19.el7 updates 269 k libX11 x86_64 1.6.5-1.el7 base 606 k libX11-common noarch 1.6.5-1.el7 base 164 k libXau x86_64 1.0.8-2.1.el7 base 29 k libXft x86_64 2.3.2-2.el7 base 58 k libXrender x86_64 0.9.10-1.el7 base 26 k libcom_err-devel x86_64 1.42.9-12.el7_5 updates 31 k libkadm5 x86_64 1.15.1-19.el7 updates 175 k libselinux-devel x86_64 2.5-12.el7 base 186 k libsepol-devel x86_64 2.5-8.1.el7 base 77 k libverto-devel x86_64 0.2.5-4.el7 base 12 k libxcb x86_64 1.12-1.el7 base 211 k lyx-fonts noarch 2.2.3-1.el7 epel 159 k pcre-devel x86_64 8.32-17.el7 base 480 k perl-srpm-macros noarch 1-8.el7 base 4.6 k tcl x86_64 1:8.5.13-8.el7 base 1.9 M tix x86_64 1:8.4.3-12.el7 base 254 k tk x86_64 1:8.5.13-6.el7 base 1.4 M tkinter x86_64 2.7.5-68.el7 base 324 k zip x86_64 3.0-11.el7 base 260 k zlib-devel x86_64 1.2.7-17.el7 base 50 k Updating for dependencies: cpp x86_64 4.8.5-28.el7_5.1 updates 5.9 M e2fsprogs x86_64 1.42.9-12.el7_5 updates 699 k e2fsprogs-libs x86_64 1.42.9-12.el7_5 updates 167 k krb5-libs x86_64 1.15.1-19.el7 updates 747 k libcom_err x86_64 1.42.9-12.el7_5 updates 41 k libgcc x86_64 4.8.5-28.el7_5.1 updates 101 k libgomp x86_64 4.8.5-28.el7_5.1 updates 156 k libselinux x86_64 2.5-12.el7 base 162 k libselinux-python x86_64 2.5-12.el7 base 235 k libselinux-utils x86_64 2.5-12.el7 base 151 k libsepol x86_64 2.5-8.1.el7 base 297 k libss x86_64 1.42.9-12.el7_5 updates 45 k openssl-libs x86_64 1:1.0.2k-12.el7 base 1.2 M python x86_64 2.7.5-68.el7 base 93 k python-libs x86_64 2.7.5-68.el7 base 5.6 M Transaction Summary ============================================================================================================================================================================================================================================ Install 7 Packages (+25 Dependent packages) Upgrade 4 Packages (+15 Dependent packages) Total download size: 46 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/51): ca-certificates-2018.2.22-70.0.el7_5.noarch.rpm | 392 kB 00:00:00 (2/51): augeas-libs-1.4.0-5.el7_5.1.x86_64.rpm | 355 kB 00:00:00 (3/51): e2fsprogs-1.42.9-12.el7_5.x86_64.rpm | 699 kB 00:00:00 (4/51): dwz-0.11-3.el7.x86_64.rpm | 99 kB 00:00:00 (5/51): e2fsprogs-libs-1.42.9-12.el7_5.x86_64.rpm | 167 kB 00:00:00 (6/51): fontpackages-filesystem-1.44-8.el7.noarch.rpm | 9.9 kB 00:00:00 (7/51): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00:00 (8/51): cpp-4.8.5-28.el7_5.1.x86_64.rpm | 5.9 MB 00:00:00 (9/51): fontconfig-2.10.95-11.el7.x86_64.rpm | 229 kB 00:00:00 (10/51): krb5-devel-1.15.1-19.el7.x86_64.rpm | 269 kB 00:00:00 (11/51): krb5-libs-1.15.1-19.el7.x86_64.rpm | 747 kB 00:00:00 (12/51): libX11-common-1.6.5-1.el7.noarch.rpm | 164 kB 00:00:00 (13/51): libXau-1.0.8-2.1.el7.x86_64.rpm | 29 kB 00:00:00 (14/51): libXft-2.3.2-2.el7.x86_64.rpm | 58 kB 00:00:00 (15/51): libXrender-0.9.10-1.el7.x86_64.rpm | 26 kB 00:00:00 (16/51): gcc-4.8.5-28.el7_5.1.x86_64.rpm | 16 MB 00:00:00 (17/51): libX11-1.6.5-1.el7.x86_64.rpm | 606 kB 00:00:00 (18/51): libcom_err-devel-1.42.9-12.el7_5.x86_64.rpm | 31 kB 00:00:00 (19/51): libcom_err-1.42.9-12.el7_5.x86_64.rpm | 41 kB 00:00:00 (20/51): libgcc-4.8.5-28.el7_5.1.x86_64.rpm | 101 kB 00:00:00 (21/51): libgomp-4.8.5-28.el7_5.1.x86_64.rpm | 156 kB 00:00:00 (22/51): libkadm5-1.15.1-19.el7.x86_64.rpm | 175 kB 00:00:00 (23/51): libselinux-2.5-12.el7.x86_64.rpm | 162 kB 00:00:00 (24/51): libffi-devel-3.0.13-18.el7.x86_64.rpm | 23 kB 00:00:00 (25/51): libselinux-devel-2.5-12.el7.x86_64.rpm | 186 kB 00:00:00 (26/51): libselinux-python-2.5-12.el7.x86_64.rpm | 235 kB 00:00:00 (27/51): libselinux-utils-2.5-12.el7.x86_64.rpm | 151 kB 00:00:00 (28/51): libsepol-devel-2.5-8.1.el7.x86_64.rpm | 77 kB 00:00:00 (29/51): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00:00 (30/51): libsepol-2.5-8.1.el7.x86_64.rpm | 297 kB 00:00:00 (31/51): libxcb-1.12-1.el7.x86_64.rpm | 211 kB 00:00:00 (32/51): openssl-1.0.2k-12.el7.x86_64.rpm | 492 kB 00:00:00 (33/51): openssl-libs-1.0.2k-12.el7.x86_64.rpm | 1.2 MB 00:00:00 (34/51): libss-1.42.9-12.el7_5.x86_64.rpm | 45 kB 00:00:00 (35/51): openssl-devel-1.0.2k-12.el7.x86_64.rpm | 1.5 MB 00:00:00 (36/51): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00:00 (37/51): perl-srpm-macros-1-8.el7.noarch.rpm | 4.6 kB 00:00:00 (38/51): lyx-fonts-2.2.3-1.el7.noarch.rpm | 159 kB 00:00:00 (39/51): python-2.7.5-68.el7.x86_64.rpm | 93 kB 00:00:00 (40/51): python-devel-2.7.5-68.el7.x86_64.rpm | 397 kB 00:00:00 (41/51): python-libs-2.7.5-68.el7.x86_64.rpm | 5.6 MB 00:00:00 (42/51): python-virtualenv-15.1.0-2.el7.noarch.rpm | 1.7 MB 00:00:00 (43/51): python-tools-2.7.5-68.el7.x86_64.rpm | 855 kB 00:00:00 (44/51): redhat-rpm-config-9.1.0-80.el7.centos.noarch.rpm | 79 kB 00:00:00 (45/51): tix-8.4.3-12.el7.x86_64.rpm | 254 kB 00:00:00 (46/51): tk-8.5.13-6.el7.x86_64.rpm | 1.4 MB 00:00:00 (47/51): tkinter-2.7.5-68.el7.x86_64.rpm | 324 kB 00:00:00 (48/51): zip-3.0-11.el7.x86_64.rpm | 260 kB 00:00:00 (49/51): zlib-devel-1.2.7-17.el7.x86_64.rpm | 50 kB 00:00:00 (50/51): tcl-8.5.13-8.el7.x86_64.rpm | 1.9 MB 00:00:00 (51/51): python2-pip-8.1.2-6.el7.noarch.rpm | 1.7 MB 00:00:00 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 41 MB/s | 46 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : libcom_err-1.42.9-12.el7_5.x86_64 1/70 Updating : libsepol-2.5-8.1.el7.x86_64 2/70 Updating : libselinux-2.5-12.el7.x86_64 3/70 Installing : 1:tcl-8.5.13-8.el7.x86_64 4/70 Updating : libgcc-4.8.5-28.el7_5.1.x86_64 5/70 Installing : fontpackages-filesystem-1.44-8.el7.noarch 6/70 Installing : lyx-fonts-2.2.3-1.el7.noarch 7/70 Installing : fontconfig-2.10.95-11.el7.x86_64 8/70 Installing : libsepol-devel-2.5-8.1.el7.x86_64 9/70 Updating : e2fsprogs-libs-1.42.9-12.el7_5.x86_64 10/70 Updating : libss-1.42.9-12.el7_5.x86_64 11/70 Installing : libcom_err-devel-1.42.9-12.el7_5.x86_64 12/70 Installing : perl-srpm-macros-1-8.el7.noarch 13/70 Installing : dwz-0.11-3.el7.x86_64 14/70 Installing : libXau-1.0.8-2.1.el7.x86_64 15/70 Installing : libxcb-1.12-1.el7.x86_64 16/70 Updating : ca-certificates-2018.2.22-70.0.el7_5.noarch 17/70 Updating : 1:openssl-libs-1.0.2k-12.el7.x86_64 18/70 Updating : krb5-libs-1.15.1-19.el7.x86_64 19/70 Updating : python-libs-2.7.5-68.el7.x86_64 20/70 Updating : python-2.7.5-68.el7.x86_64 21/70 Installing : python-devel-2.7.5-68.el7.x86_64 22/70 Installing : libkadm5-1.15.1-19.el7.x86_64 23/70 Installing : libX11-common-1.6.5-1.el7.noarch 24/70 Installing : libX11-1.6.5-1.el7.x86_64 25/70 Installing : libXrender-0.9.10-1.el7.x86_64 26/70 Installing : libXft-2.3.2-2.el7.x86_64 27/70 Installing : 1:tk-8.5.13-6.el7.x86_64 28/70 Installing : 1:tix-8.4.3-12.el7.x86_64 29/70 Installing : tkinter-2.7.5-68.el7.x86_64 30/70 Updating : cpp-4.8.5-28.el7_5.1.x86_64 31/70 Installing : pcre-devel-8.32-17.el7.x86_64 32/70 Installing : libselinux-devel-2.5-12.el7.x86_64 33/70 Installing : libverto-devel-0.2.5-4.el7.x86_64 34/70 Updating : libgomp-4.8.5-28.el7_5.1.x86_64 35/70 Installing : zip-3.0-11.el7.x86_64 36/70 Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 37/70 Installing : krb5-devel-1.15.1-19.el7.x86_64 38/70 Installing : zlib-devel-1.2.7-17.el7.x86_64 39/70 Installing : 1:openssl-devel-1.0.2k-12.el7.x86_64 40/70 Installing : redhat-rpm-config-9.1.0-80.el7.centos.noarch 41/70 Updating : gcc-4.8.5-28.el7_5.1.x86_64 42/70 Installing : python-tools-2.7.5-68.el7.x86_64 43/70 Installing : python-virtualenv-15.1.0-2.el7.noarch 44/70 Updating : python2-pip-8.1.2-6.el7.noarch 45/70 Updating : libselinux-python-2.5-12.el7.x86_64 46/70 Updating : 1:openssl-1.0.2k-12.el7.x86_64 47/70 Updating : e2fsprogs-1.42.9-12.el7_5.x86_64 48/70 Installing : augeas-libs-1.4.0-5.el7_5.1.x86_64 49/70 Updating : libselinux-utils-2.5-12.el7.x86_64 50/70 Installing : libffi-devel-3.0.13-18.el7.x86_64 51/70 Cleanup : python2-pip-8.1.2-5.el7.noarch 52/70 Cleanup : 1:openssl-1.0.2k-8.el7.x86_64 53/70 Cleanup : e2fsprogs-1.42.9-10.el7.x86_64 54/70 Cleanup : gcc-4.8.5-16.el7.x86_64 55/70 Cleanup : libselinux-utils-2.5-11.el7.x86_64 56/70 Cleanup : libselinux-python-2.5-11.el7.x86_64 57/70 Cleanup : python-2.7.5-58.el7.x86_64 58/70 Cleanup : python-libs-2.7.5-58.el7.x86_64 59/70 Cleanup : krb5-libs-1.15.1-8.el7.x86_64 60/70 Cleanup : 1:openssl-libs-1.0.2k-8.el7.x86_64 61/70 Cleanup : libselinux-2.5-11.el7.x86_64 62/70 Cleanup : e2fsprogs-libs-1.42.9-10.el7.x86_64 63/70 Cleanup : libss-1.42.9-10.el7.x86_64 64/70 Cleanup : ca-certificates-2017.2.14-71.el7.noarch 65/70 Cleanup : libcom_err-1.42.9-10.el7.x86_64 66/70 Cleanup : libsepol-2.5-6.el7.x86_64 67/70 Cleanup : cpp-4.8.5-16.el7.x86_64 68/70 Cleanup : libgcc-4.8.5-16.el7.x86_64 69/70 Cleanup : libgomp-4.8.5-16.el7.x86_64 70/70 Verifying : krb5-devel-1.15.1-19.el7.x86_64 1/70 Verifying : python-libs-2.7.5-68.el7.x86_64 2/70 Verifying : zlib-devel-1.2.7-17.el7.x86_64 3/70 Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 4/70 Verifying : libX11-1.6.5-1.el7.x86_64 5/70 Verifying : fontconfig-2.10.95-11.el7.x86_64 6/70 Verifying : libXrender-0.9.10-1.el7.x86_64 7/70 Verifying : 1:tcl-8.5.13-8.el7.x86_64 8/70 Verifying : zip-3.0-11.el7.x86_64 9/70 Verifying : tkinter-2.7.5-68.el7.x86_64 10/70 Verifying : libsepol-2.5-8.1.el7.x86_64 11/70 Verifying : 1:openssl-libs-1.0.2k-12.el7.x86_64 12/70 Verifying : python2-pip-8.1.2-6.el7.noarch 13/70 Verifying : libgomp-4.8.5-28.el7_5.1.x86_64 14/70 Verifying : libselinux-python-2.5-12.el7.x86_64 15/70 Verifying : 1:openssl-devel-1.0.2k-12.el7.x86_64 16/70 Verifying : libverto-devel-0.2.5-4.el7.x86_64 17/70 Verifying : libselinux-devel-2.5-12.el7.x86_64 18/70 Verifying : 1:tk-8.5.13-6.el7.x86_64 19/70 Verifying : gcc-4.8.5-28.el7_5.1.x86_64 20/70 Verifying : fontpackages-filesystem-1.44-8.el7.noarch 21/70 Verifying : redhat-rpm-config-9.1.0-80.el7.centos.noarch 22/70 Verifying : pcre-devel-8.32-17.el7.x86_64 23/70 Verifying : e2fsprogs-1.42.9-12.el7_5.x86_64 24/70 Verifying : libxcb-1.12-1.el7.x86_64 25/70 Verifying : e2fsprogs-libs-1.42.9-12.el7_5.x86_64 26/70 Verifying : libgcc-4.8.5-28.el7_5.1.x86_64 27/70 Verifying : libcom_err-1.42.9-12.el7_5.x86_64 28/70 Verifying : libss-1.42.9-12.el7_5.x86_64 29/70 Verifying : libcom_err-devel-1.42.9-12.el7_5.x86_64 30/70 Verifying : cpp-4.8.5-28.el7_5.1.x86_64 31/70 Verifying : python-devel-2.7.5-68.el7.x86_64 32/70 Verifying : lyx-fonts-2.2.3-1.el7.noarch 33/70 Verifying : python-virtualenv-15.1.0-2.el7.noarch 34/70 Verifying : krb5-libs-1.15.1-19.el7.x86_64 35/70 Verifying : libffi-devel-3.0.13-18.el7.x86_64 36/70 Verifying : python-2.7.5-68.el7.x86_64 37/70 Verifying : libX11-common-1.6.5-1.el7.noarch 38/70 Verifying : ca-certificates-2018.2.22-70.0.el7_5.noarch 39/70 Verifying : libselinux-2.5-12.el7.x86_64 40/70 Verifying : libXau-1.0.8-2.1.el7.x86_64 41/70 Verifying : python-tools-2.7.5-68.el7.x86_64 42/70 Verifying : augeas-libs-1.4.0-5.el7_5.1.x86_64 43/70 Verifying : libselinux-utils-2.5-12.el7.x86_64 44/70 Verifying : dwz-0.11-3.el7.x86_64 45/70 Verifying : libXft-2.3.2-2.el7.x86_64 46/70 Verifying : libkadm5-1.15.1-19.el7.x86_64 47/70 Verifying : 1:openssl-1.0.2k-12.el7.x86_64 48/70 Verifying : libsepol-devel-2.5-8.1.el7.x86_64 49/70 Verifying : perl-srpm-macros-1-8.el7.noarch 50/70 Verifying : 1:tix-8.4.3-12.el7.x86_64 51/70 Verifying : libselinux-2.5-11.el7.x86_64 52/70 Verifying : python-libs-2.7.5-58.el7.x86_64 53/70 Verifying : libss-1.42.9-10.el7.x86_64 54/70 Verifying : krb5-libs-1.15.1-8.el7.x86_64 55/70 Verifying : gcc-4.8.5-16.el7.x86_64 56/70 Verifying : e2fsprogs-1.42.9-10.el7.x86_64 57/70 Verifying : libgcc-4.8.5-16.el7.x86_64 58/70 Verifying : 1:openssl-1.0.2k-8.el7.x86_64 59/70 Verifying : python2-pip-8.1.2-5.el7.noarch 60/70 Verifying : 1:openssl-libs-1.0.2k-8.el7.x86_64 61/70 Verifying : libgomp-4.8.5-16.el7.x86_64 62/70 Verifying : libsepol-2.5-6.el7.x86_64 63/70 Verifying : libselinux-python-2.5-11.el7.x86_64 64/70 Verifying : ca-certificates-2017.2.14-71.el7.noarch 65/70 Verifying : libcom_err-1.42.9-10.el7.x86_64 66/70 Verifying : cpp-4.8.5-16.el7.x86_64 67/70 Verifying : e2fsprogs-libs-1.42.9-10.el7.x86_64 68/70 Verifying : libselinux-utils-2.5-11.el7.x86_64 69/70 Verifying : python-2.7.5-58.el7.x86_64 70/70 Installed: augeas-libs.x86_64 0:1.4.0-5.el7_5.1 libffi-devel.x86_64 0:3.0.13-18.el7 openssl-devel.x86_64 1:1.0.2k-12.el7 python-devel.x86_64 0:2.7.5-68.el7 python-tools.x86_64 0:2.7.5-68.el7 python-virtualenv.noarch 0:15.1.0-2.el7 redhat-rpm-config.noarch 0:9.1.0-80.el7.centos Dependency Installed: dwz.x86_64 0:0.11-3.el7 fontconfig.x86_64 0:2.10.95-11.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-19.el7 libX11.x86_64 0:1.6.5-1.el7 libX11-common.noarch 0:1.6.5-1.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXft.x86_64 0:2.3.2-2.el7 libXrender.x86_64 0:0.9.10-1.el7 libcom_err-devel.x86_64 0:1.42.9-12.el7_5 libkadm5.x86_64 0:1.15.1-19.el7 libselinux-devel.x86_64 0:2.5-12.el7 libsepol-devel.x86_64 0:2.5-8.1.el7 libverto-devel.x86_64 0:0.2.5-4.el7 libxcb.x86_64 0:1.12-1.el7 lyx-fonts.noarch 0:2.2.3-1.el7 pcre-devel.x86_64 0:8.32-17.el7 perl-srpm-macros.noarch 0:1-8.el7 tcl.x86_64 1:8.5.13-8.el7 tix.x86_64 1:8.4.3-12.el7 tk.x86_64 1:8.5.13-6.el7 tkinter.x86_64 0:2.7.5-68.el7 zip.x86_64 0:3.0-11.el7 zlib-devel.x86_64 0:1.2.7-17.el7 Updated: ca-certificates.noarch 0:2018.2.22-70.0.el7_5 gcc.x86_64 0:4.8.5-28.el7_5.1 openssl.x86_64 1:1.0.2k-12.el7 python2-pip.noarch 0:8.1.2-6.el7 Dependency Updated: cpp.x86_64 0:4.8.5-28.el7_5.1 e2fsprogs.x86_64 0:1.42.9-12.el7_5 e2fsprogs-libs.x86_64 0:1.42.9-12.el7_5 krb5-libs.x86_64 0:1.15.1-19.el7 libcom_err.x86_64 0:1.42.9-12.el7_5 libgcc.x86_64 0:4.8.5-28.el7_5.1 libgomp.x86_64 0:4.8.5-28.el7_5.1 libselinux.x86_64 0:2.5-12.el7 libselinux-python.x86_64 0:2.5-12.el7 libselinux-utils.x86_64 0:2.5-12.el7 libsepol.x86_64 0:2.5-8.1.el7 libss.x86_64 0:1.42.9-12.el7_5 openssl-libs.x86_64 1:1.0.2k-12.el7 python.x86_64 0:2.7.5-68.el7 python-libs.x86_64 0:2.7.5-68.el7 Complete! Creating virtual environment... Installing Python packages... Installation succeeded. Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None ------------------------------------------------------------------------------- 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-v01.api.letsencrypt.org/directory ------------------------------------------------------------------------------- (A)gree/(C)ancel: A |
到这里直接输入 A 同意 然后回车
1 2 3 4 5 6 7 |
------------------------------------------------------------------------------- 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 |
输入 y回车
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
Obtaining a new certificate Performing the following challenges: http-01 challenge for code2048.net http-01 challenge for www.code2048.net Waiting for verification... Cleaning up challenges IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/code2048.net/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/code2048.net/privkey.pem Your cert will expire on 2018-10-08. To obtain a new or tweaked version of this certificate in the future, simply run letsencrypt-auto again. To non-interactively renew *all* of your certificates, run "letsencrypt-auto 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 |
然后看到这个界面表示部署成功。中间会收到一个邮件激活一下即可。
然后查看生成的证书:
1 2 3 |
[root@poxiao letsencrypt]# cd /etc/letsencrypt/live/code2048.net [root@poxiao code2048.net]# ls cert.pem chain.pem fullchain.pem privkey.pem README |
Let’s Encrypt免费SSL证书获取与应用
cert.pem – Apache服务器端证书
chain.pem – Apache根证书和中继证书
fullchain.pem – Nginx所需要ssl_certificate文件
privkey.pem – 安全证书KEY文件
如果我们使用的Nginx环境,那就需要用到fullchain.pem和privkey.pem两个证书文件,在部署Nginx的时候需要用到,如果是Tomcat 则需要cert.pem,chain.pem和privkey.pem
解决Let’s Encrypt免费SSL证书有效期问题
我们从生成的文件中可以看到,Let’s Encrypt证书是有效期90天的,需要我们自己手工更新续期才可以。
1 |
./letsencrypt-auto certonly --renew-by-default --email admin@code2048.net -d code2048.net -d www.code2048.net |
这样我们在90天内再去执行一次就可以解决续期问题,这样又可以继续使用90天。如果我们怕忘记的话也可以制作成定时执行任务,比如每个月执行一次。
可以写个计划任务脚本:
1 2 3 4 5 |
#!/bin/bash cd /etc/letsencrypt/live/code2048.net ./letsencrypt-auto certonly --renew-by-default --email admin@code2048.net -d code2048.net -d www.code2048.net |
加上定期执行
关于Let’s Encrypt免费SSL证书总结
通过以上几个步骤的学习和应用,我们肯定学会了利用Let’s Encrypt免费生成和获取SSL证书文件,随着Let’s Encrypt的应用普及,SSL以后直接免费不需要购买,因为大部分主流浏览器都支持且有更多的主流商家的支持和赞助,HTTPS以后看来也是趋势。在Let’s Encrypt执行过程在中我们需要解决几个问题。
A – 域名DNS和解析问题。在配置Let’s Encrypt免费SSL证书的时候域名一定要解析到当前VPS服务器,而且DNS必须用到海外域名DNS,如果用国内免费DNS可能会导致获取不到错误。
B – 安装Let’s Encrypt部署之前需要服务器支持PYTHON2.7以及GIT环境,要不无法部署。
C – Let’s Encrypt默认是90天免费,需要手工或者自动续期才可以继续使用。
参考资料:
http://www.laozuo.org/7676.html
https://www.jianshu.com/p/c5c9d071e395
本文链接:使用Let's Encrypt的免费证书在Centos7搭建SSL服务 一 (申请免费证书)
转载声明:本站文章若无特别说明,皆为原创,转载请注明来源:破晓(http://www.code2048.net),谢谢!^^