在使用 Cloudflare 的网站上,签发 Let’s Encrypt 证书的问题

[ Browse English version of this post. ]

最近对一个网站启用了Cloudflare CDN之后,起初一切顺利,不过在某天准备使用以往一直使用的 acme_tiny.py 进行Let’s Encrypt证书续签的时候出错。之前没有使用CDN的时候,一直是定期使用这个程序进行证书签发,然而这回却失败了,尝试数次均卡在 cannot download http://****/.well-known/acme-challenge/**** . 这个错误上。

简而言之就是,在证书签发之前,这个程序会在待签发的域名下的一个指定路径,临时生成一个challenge文件,然后签发方(Let’s Encrypt)尝试下载这个文件,用于验证请求者是否是域名所有人。

尝试直接用 wget 下载这个文件,最后是404错误。看了详细经过可以发现,在尝试通过http方式下载challenge文件的时候,被直接重定向到了https,因此产生了问题。由于源服务器仅在80端口配置了acme-challenge,所以当从https访问的时候就得到了404错误。

因为之前一直是OK的,所以这次想会不会是CDN的原因造成了这个错误。

而且源服务器端并未在这个acme-challenge路径上配置https rewrite,那么究竟是为什么访问会被自动重定向到https呢?经过一番调查,尝试了Cloudflare中的数个选项,发现原来是 SSL/TLS –> Edge Certificates下面的 “Always Use HTTPS”这个选项的关系。当打开了这个后,会直接重定向全部http请求到https。这就是为什么会造成acme-challenge被重定向的原因。

当关闭了这个选项后,通过acme_tiny.py签发Let’s Encrypt证书便可如同往常一样正常进行。

这回的总结就是,当网站使用了CDN之后,可能会因为CDN配置的关系,导致一些意想不到的问题发生。当源服务器配置并不是造成问题的原因后,就应转向调查CDN的配置是否是造成问题的原因。

SSL/TLS -> Edge Certificates: always use HTTPS.

File System directory of Chrome browser took a lot of disk space

When I was cleaning up my computer’s disk space, I noticed that the Chrome directory under AppData\Local\Google took almost 10 GB spaces, especially the directory File System, which is using 7.87 GB of disk space. In the File System directory, one largest directory used most of the space named 017. In this directory there are 9 very large files in it, each one is around 900 MB, and all of them were created on last November.

The “File System” directory used 7.87 GB of disk space.

After googling around, I found this article is useful:

https://www.ghacks.net/2015/06/24/hard-drive-filling-up-check-chromes-file-system-folder/

Quote: “Chrome (and Chromium) use the folder to store files stored with the help of the File System API which is part of HTML5.”

So, it looks like some web service were using File System API stored these data on the disk. But I can’t remember which website I used could take up almost 8 GB data on my disk.

Only thing I can do now is to delete these files, and monitor the File System directory frequently to see if there is any unusual amount of space used by this directory.

hosts 文件中出现 windows10.microdone.cn 的问题

准备把一只老机从 Windows 7 升级到 Windows 10。在做准备工作,往hosts里加入一些将来要用的条目时候发现,原本应该没有配置过的文件里出现了一条莫名其妙的记录:域名是 windows10.microdone.cn,而且IP指向的是本机的内网IP地址。并且即使删除了这条记录,重启后照样会回来。

搜索了下找到了microdone.cn这个网站,似乎这家公司主要是做支付和安全方面的软件。主页最下方列出了一排应该是有合作关系的企业Logo,翻了翻想找找是否和我电脑上装的几个网银有关。看完了长长的一排图标,有关的似乎也只有银联了。想起来之前电脑上装过银联支付的插件,难道是因为这个咚咚的缘故?

反正好久没用过了,干脆删了试试看。

Uninstall ……

Reboot ……

好了👌。hosts文件没有再被改回去。

MIUI 11 之无线显示

最近把自己的手机系统更新到了 MIUI 11 ,新系统新气象,还是有不少可圈可点的优点。不过对于新的“投屏”功能实在是爱不起来。简而言之,小米用了一个第三方的多功能投屏 App 替代了原本 Android 系统自有的“无线显示”功能,并且删除了系统无线显示功能的入口。新的投屏 App 可谓差强人意,虽然多了许多之前不具备的功能,但是有时候在投屏到电脑时反而会出现比如连接上的问题。

其实系统原本的无线显示(Miracast)功能还是在的,只不过被隐藏了。经过少许摸索,发现可以使用活动启动器 (Activity Launcher) ,并通过如下方式开启系统无线显示功能:

启动“活动启动器” ➡ 点击上方搜索按钮 ➡ 输入“无线显示”。

在下方搜索结果中会显示系统自带的无线显示(com.android.settings.Settings$MiracastSettingsActivity)

点击即可进入系统自带的无线显示功能。

为了便于日后直接使用,可以长按前一步搜索结果中的“无线显示”项目,然后选择创建快捷方式,在桌面建立“无线显示”的快捷方式。


活动启动器(Activity Launcher) 的 Google Play 地址:
https://play.google.com/store/apps/details?id=de.szalkowski.activitylauncher&hl=en_US