在Windows Server 2008上部署免费的https证书
背景
后web时代,https加密的重要性不言而喻。主流浏览器均对http站点标记不安全,敦促web服务提供商尽快升级至https。
原先的https证书多由各大域名服务商提供,动辄成千上万的部署证书的费用,一般个人站点及小微企业根本无力承担。感谢开源,我们现在拥有无需付费的 Let s Encrypt 证书进行选择。越来越多的企业开始加入Let s Encrypt 。
Apple的上架审核,微信的小程序审核,都需要https证书作为支撑。
Let s Encrypt 部署在Linux服务器下,有官方推荐Certbot客户端 可以说是非常方便了。而想在Windows Server上部署,我们还需要一系列的操作进行证书的生成。
准备
在Windows平台上,许多优秀的开源作者已经为我们提供了相当好用的 Let s Encrypt 客户端:
制作证书
我用的第4个web客户端,win平台下win-acme , ACMESharp(基于PowserShell)这两种用的人都蛮多的。
输入你想要部署https证书的域名(截至2018年04月,Let s encrypt已经支持免费的通配符域名)
我选择的是 dns 校验方式。域名新增一条符合规则的 txt 记录就好。
注意!强烈推荐使用自己的 CSR !勾选 I have my own CSR 。确保证书的私钥仅有自己知道。
Windows平台 CSR生成方式:
在Windows下,在 IIS 中选择服务器->服务器证书->创建申请证书。
密钥位长选2048位
得到txt格式的文件,将公钥复制到sslforfree中(截取-----BEGIN NEW CERTIFICATE REQUEST-----和-----END NEW CERTIFICATE REQUEST-----之间的内容)
- Linux平台 CSR文件生成方式
利用openssl
openssl req -new -nodes -sha256 -newkey rsa:2048 -keyout myprivate.key -out mydomain.csr
下载证书: 这里证书有两份文件,private.key和certificate.crt,其中private.key应该是空的,这表示用的自己的CSR,sslforfree网站并不知道private.key是多少,安全可靠。
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
部署证书
在 IIS 中选择服务器->服务器证书->导入上面生成的 pfx 文件。
选择站点,绑定https,选择证书。
开启入站的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证书的更多相关文章
- 在Windows Server 2008上部署SVN代码管理总结
这段时间在公司开发Flex程序,所以使用TortoiseSVN作为团队代码管理器,今天在公司服务器上部署SVN服务器,并实验成功,总结如下: 服务器环境: 操作系统:Windows Server 20 ...
- Windows server 2008 上部署 MVC (NopCommerce 3.4)网站
自己用开源框架做了个商城,该框架是基于mvc4的,本地编译通过,运行一切正常,关于发布遇到了好几个问题. 本地: IIS7.5. VS2013 总结后发现只需要设置两个问题,就不会有那些古怪的问题:什 ...
- 关于在windows server 2008 上部署wampserver2.5部署的问题
1.关闭windows自带防火墙 2.httpd.conf文件权限 apache 2.4.9 外网访问的问题参考此文: http://blog.csdn.net/lysc_forever/articl ...
- 阿里云服务器Windows Server 2008/2012部署Office Web Server 2013
以前成功将Office Web Server 2013部署在了本地服务器上,此次是将Office Web Server 2013部署在阿里云服务器Windows Server 2008和2012上,中 ...
- 无需破解:Windows Server 2008 R2 至少免费使用 900天
无需破解:Windows Server 2008 R2 至少免费使用 900天 2009年10月30日 星期五 02:10 1.首先安装后,有一个180天的试用期. 2.在180天试用期即将结束时,使 ...
- Windows Server 2008 R2 部署服务
Windows Server 2008 R2 部署服务 部分参考: Windows Server 2008 R2 部署服务 - 马睿的技术博客 - 51CTO技术博客http://marui.blog ...
- asp.net网站部署在云服务器windows server 2008上
搭建一个网站需要以下4个准备: 1.域名解析 2.(云)服务器 3.数据库 4.网站代码 其中1可以可以去DNSPOD申请,同时需要进行备案,在上面就都可以完成.2用的是阿里云服务器windows s ...
- 针对 SQL Server 2008 在Windows Server 2008上的访问配置 Windows 防火墙
现在Windows Server 2008 服务器用的越来越多,2008的防火墙比2003的有了很大的增强,安全性有了更大的提高. 甚至80端口的出站默认都是被关闭的.所以如果在2008Server上 ...
- SQLite 在Windows Server 2008 R2 部署问题FAQ汇总[轉]
轉自:http://www.steveluo.name/sqlite-windows-server-2008-r2-deploy-faq/ 今天花了一天的时间研究了一下SQLite,以取代一些轻量级项 ...
随机推荐
- android中的一个圆角图片
RoundedImageView A fast ImageView (and Drawable) that supports rounded corners (and ovals or circles ...
- 基于DB的编程
现在我们大多数的开发都是基于数据库,虽然数据库为我们提供了事务机制,保证存储的数据的ACID,但是,当我们在完成一个业务操作时,涉及到对数据库的大量操作,如果把这些操作在一个事务中,肯定是安全的,但是 ...
- Solr Facet 统计查询
一)概述 Facet是solr的高级搜索功能之一,可以给用户提供更友好的搜索体验.在搜索关键字的同时,能够按照Facet的字段进行分组并统计.例如下图所示,你上淘宝,输入“电脑”进行搜索,就会出现品牌 ...
- pycharm(2016.3.2版本)导入工程文件执行程序时弹出Edit configuration
最近为了能在公司和住所连续写脚本,每写好一部分就压缩打包发送到手机,然后再发送到公司电脑或者自己的笔记本,但是发现重新打开工程文件时有时会弹出Edit configuration配置框,而且每执行一个 ...
- tensorflow-windows下安装,python3.6
安装: pip install tensorflow ps:我第一次安装了,但是导入却失败了. 进入\python3\Lib\site-packages\删除了tensorflow,再次pip ins ...
- CentOS7入门到精通实战课程课后习题
Linux自动化运维系列①: CentOS7入门到精通实战--->传送门 http://edu.51cto.com/course/13055.html 01.系统入门课后习题 1.口述一个命令执 ...
- maven 编译解决jdk 版本问题
1.在父工程中pom 添加版本限制: <plugins> <plugin> <groupId>org.apache.maven.plugins</groupI ...
- 「小程序JAVA实战」小程序的举报功能开发(68)
转自:https://idig8.com/2018/09/25/xiaochengxujavashizhanxiaochengxudeweixinapicaidancaozuo66-2/ 通过点击举报 ...
- html 1.0 鼠标放上去会亮 onmouseover onmouseout 以及this标签的使用
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 最值得学习阅读的10个C语言开源项目代码
阅读优秀代码是提高开发人员修为的一种捷径-- 1. Webbench Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我们设定的URL,测试网 ...