背景

  1. 后web时代,https加密的重要性不言而喻。主流浏览器均对http站点标记不安全,敦促web服务提供商尽快升级至https。

  2. 原先的https证书多由各大域名服务商提供,动辄成千上万的部署证书的费用,一般个人站点及小微企业根本无力承担。感谢开源,我们现在拥有无需付费的 Let s Encrypt 证书进行选择。越来越多的企业开始加入Let s Encrypt 。

  3. Apple的上架审核,微信的小程序审核,都需要https证书作为支撑。

  4. Let s Encrypt 部署在Linux服务器下,有官方推荐Certbot客户端 可以说是非常方便了。而想在Windows Server上部署,我们还需要一系列的操作进行证书的生成。

准备

在Windows平台上,许多优秀的开源作者已经为我们提供了相当好用的 Let s Encrypt 客户端:

ACMESharp

Certify The Web

win-acme

ssl for free

制作证书

我用的第4个web客户端,win平台下win-acme , ACMESharp(基于PowserShell)这两种用的人都蛮多的。

  1. 输入你想要部署https证书的域名(截至2018年04月,Let s encrypt已经支持免费的通配符域名)

  2. 我选择的是 dns 校验方式。域名新增一条符合规则的 txt 记录就好。

  3. 注意!强烈推荐使用自己的 CSR !勾选 I have my own CSR 。确保证书的私钥仅有自己知道。

  4. Windows平台 CSR生成方式:

在Windows下,在 IIS 中选择服务器->服务器证书->创建申请证书。

密钥位长选2048位

得到txt格式的文件,将公钥复制到sslforfree中(截取-----BEGIN NEW CERTIFICATE REQUEST-----和-----END NEW CERTIFICATE REQUEST-----之间的内容)

  1. Linux平台 CSR文件生成方式

利用openssl

openssl req -new -nodes -sha256 -newkey rsa:2048 -keyout myprivate.key -out mydomain.csr
  1. 下载证书: 这里证书有两份文件,private.key和certificate.crt,其中private.key应该是空的,这表示用的自己的CSR,sslforfree网站并不知道private.key是多少,安全可靠。

  2. crt证书转为iis可用的pfx证书。

这里需要使用open ssl,如果你有Linux服务器或虚拟机的话很方便。否则需要自行Google win平台安装open ssl的方法。

Linux平台下利用open ssl ,利用生成csr文件的private.key,执行下面的命令

openssl pkcs12 -export -out server.pfx -inkey private.key -in certificate.crt

部署证书

  1. 在 IIS 中选择服务器->服务器证书->导入上面生成的 pfx 文件。

  2. 选择站点,绑定https,选择证书。

  3. 开启入站的443端口,至此,部署完毕。

微信小程序 TLS 1.2

由于小程序要求的TLS版本必须大于等于1.2 , 而windows server 2008默认为TLS 1.0

1.解决方案:在Powershell中运行下面代码后重启。

# Enables TLS 1.2 on windows Server 2008 R2 and Windows 7

# These keys do not exist so they need to be created prior to setting values.
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2"
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server"
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" # Enable TLS 1.2 for client and server SCHANNEL communications
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value 1 -PropertyType "DWord"
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord"
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord" # Disable SSL 2.0 (PCI Compliance)
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server"
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" -name Enabled -value 0 -PropertyType "DWord"
# Enables TLS 1.2 on Windows Server 2008 R2 and Windows 7 # These keys do not exist so they need to be created prior to setting values. md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" # Enable TLS 1.2 for client and server SCHANNEL communications new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord" # Disable SSL 2.0 (PCI Compliance) md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" -name Enabled -value 0 -PropertyType "DWord"

2.注意:TLS 1.2 至少需要服务器版本为Windows Server 2008 Service Pack 2 (SP2)

在Windows Server 2008上部署免费的https证书的更多相关文章

  1. 在Windows Server 2008上部署SVN代码管理总结

    这段时间在公司开发Flex程序,所以使用TortoiseSVN作为团队代码管理器,今天在公司服务器上部署SVN服务器,并实验成功,总结如下: 服务器环境: 操作系统:Windows Server 20 ...

  2. Windows server 2008 上部署 MVC (NopCommerce 3.4)网站

    自己用开源框架做了个商城,该框架是基于mvc4的,本地编译通过,运行一切正常,关于发布遇到了好几个问题. 本地: IIS7.5. VS2013 总结后发现只需要设置两个问题,就不会有那些古怪的问题:什 ...

  3. 关于在windows server 2008 上部署wampserver2.5部署的问题

    1.关闭windows自带防火墙 2.httpd.conf文件权限 apache 2.4.9 外网访问的问题参考此文: http://blog.csdn.net/lysc_forever/articl ...

  4. 阿里云服务器Windows Server 2008/2012部署Office Web Server 2013

    以前成功将Office Web Server 2013部署在了本地服务器上,此次是将Office Web Server 2013部署在阿里云服务器Windows Server 2008和2012上,中 ...

  5. 无需破解:Windows Server 2008 R2 至少免费使用 900天

    无需破解:Windows Server 2008 R2 至少免费使用 900天 2009年10月30日 星期五 02:10 1.首先安装后,有一个180天的试用期. 2.在180天试用期即将结束时,使 ...

  6. Windows Server 2008 R2 部署服务

    Windows Server 2008 R2 部署服务 部分参考: Windows Server 2008 R2 部署服务 - 马睿的技术博客 - 51CTO技术博客http://marui.blog ...

  7. asp.net网站部署在云服务器windows server 2008上

    搭建一个网站需要以下4个准备: 1.域名解析 2.(云)服务器 3.数据库 4.网站代码 其中1可以可以去DNSPOD申请,同时需要进行备案,在上面就都可以完成.2用的是阿里云服务器windows s ...

  8. 针对 SQL Server 2008 在Windows Server 2008上的访问配置 Windows 防火墙

    现在Windows Server 2008 服务器用的越来越多,2008的防火墙比2003的有了很大的增强,安全性有了更大的提高. 甚至80端口的出站默认都是被关闭的.所以如果在2008Server上 ...

  9. SQLite 在Windows Server 2008 R2 部署问题FAQ汇总[轉]

    轉自:http://www.steveluo.name/sqlite-windows-server-2008-r2-deploy-faq/ 今天花了一天的时间研究了一下SQLite,以取代一些轻量级项 ...

随机推荐

  1. javascript如何判断是手机还是电脑访问本网页

    var system ={}; var p = navigator.platform; system.win = p.indexOf("Win") == 0; system.mac ...

  2. 【Codeforces】Codeforces Round #492 (Div. 2) (Contest 996)

    题目 传送门:QWQ A:A - Hit the Lottery 分析: 大水题 模拟 代码: #include <bits/stdc++.h> using namespace std; ...

  3. 精《Linux内核精髓:精通Linux内核必会的75个绝技》一HACK #8 调度策略

    HACK #8 调度策略 本节介绍Linux的调度策略(scheduling policy).Linux调度策略的类别大致可以分为TSS(Time Sharing System,分时系统)和实时系统这 ...

  4. JSON格式化工具推荐

    JSON以其独特的简洁方便及与Javscript的无缝集成在WEB2.0时瓦风靡全球.   不过做为开发者,当看到一段很长的未格式化的JSON代码时,你会不会感到头晕? {"meta&quo ...

  5. OpenMP n 体问题

    ▶ <并行程序设计导论>第六章中讨论了 n 体问题,分别使用了 MPI,Pthreads,OpenMP 来进行实现,这里是 OpenMP 的代码,分为基本算法和简化算法(引力计算量为基本算 ...

  6. 单片机(TTL)与电脑RS232接口

    2010年11月28日 21:38 1.先介绍电脑上与单片机进行通讯的接口的名称 (1)一般是用电脑串口来进行通讯的,平常大家说的电脑的串口是指台式电脑主机后面的九针接口,如下图 ‍这个接口有个专业的 ...

  7. jquery中的data-icon和data-role

    转自:https://blog.csdn.net/Sayesan/article/details/83378524 jquery中的data-icon和data-role    data-role参数 ...

  8. redis一主二从三哨兵

    redis做集群的时候有很多种配置方法,一主二从三哨兵这种模式是官网推荐的.,写配置文件链接的时候,写的是哨兵地址,不是IP,用户名,密码之类的. 一主二从很好理解,一个主的redis,实时备份到两个 ...

  9. 安装zoom

    ubuntu zoom下载地址:https://zoom.us/download?os=linux 安装: sudo apt-get install libxcb-xtest0 sudo dpkg - ...

  10. set 续1

    --------siwuxie095             三.用 set 实现计算     语法: SET /A expression     /A 命令行开关指定等号右边的字符串为待计算的数字表 ...