2025-03-18 08:41:02
在观察一个 Web 服务器的日志的时候,看到一个现象,有大量的网络爬虫,或者说网络蜘蛛来访问,抓取内容。这个访问数量有些过分。
看这个截图。
714,290 (36.96%) | 101 (00.07%) | 11.8 GiB (39.11%) | GPTBot/1.2 |
47,085 (02.44%) | 299 (00.20%) | 8 GiB (26.31%) | GoogleOther |
9,350 (00.48%) | 453 (00.30%) | 578.1 MiB (01.87%) | meta-externalagent/1.1 |
35,038 (01.81%) | 20 (00.01%) | 470.2 MiB (01.52%) | Ai2Bot-Dolma |
39,785 (02.06%) | 852 (00.57%) | 376.3 MiB (01.21%) | AhrefsBot/7.0 |
32,944 (01.70%) | 216 (00.14%) | 375.7 MiB (01.21%) | MJ12bot/v1.4.8 |
28,577 (01.48%) | 3,695 (02.48%) | 313 MiB (01.01%) | ClaudeBot/1.0 |
3,953 (00.20%) | 967 (00.65%) | 297.4 MiB (00.96%) | Bytespider |
13,919 (00.72%) | 943 (00.63%) | 202.8 MiB (00.65%) | Googlebot/2.1 |
22,576 (01.17%) | 13 (00.01%) | 170.3 MiB (00.55%) | Scrapy/2.11.2 |
排最前面的几位就是 GPTBot, GoogleOther, A12Bot-dolma,之流。都属于人工智能派出来的网络蜘蛛,来各个网站抓取内容,而它们抓取的内容会怎样使用的,会给你的网站带来访客吗?
基本上是不会的,本质上,这些机器人会抓取你的内容,然后进行索引,对其重组织后,来产生人工智能所编写的内容。
这意味着任何用 ChatGPT 之类的智能工具所攥写的内容都是在剽窃你我的内容。
作为内容的创造者,你会愿意无偿提供内容给他们吗?
来看看 OpenAI 的 GPTBot 干了什么吧?
网站的站长允许 GPTBot 来抓取网站内容,就意味着允许 OpenAI:
作为内容的创造者,我对滥用 AI 的能力,无偿使用原创者的作品,十分担忧,也很反对。
目前我采用了 robots.txt 来封锁 GPTBot 和其它的一些人工智能 robot。
2025-02-21 08:23:00
升级到 MovableType 8.4.2, 无需赘述,下载一个 24M 的压缩包,解压缩,上传到安装目录,覆盖旧的文件。
然后登陆到后台,就直接完成升级 了。
虽然没有什么可以特别,还是介绍一下更新信息。
New and improved features
Updated Smarty from 4.5.3 to 4.5.5 (MTC-29974)
Updated MTBlockEditor to version 1.2.5
Updated MFA (Multi-Factor Authentication) plugin to version 1.0.5
Added support for MySQL caching_sha2_password authentication (MTC-29715)
Improved the response time of the admin screen by revising the processing of MT::Permission (MTC-29836)
Resolved issues
Fixed an issue where line breaks were not converted to
elements when pasting multi-line text in TinyMCE6 (MTC-30072)
Removed unnecessary files included in the package (MTC-30173)
Fixed an issue where inserting images in the old block editor caused an error when the width of thumbnails was specified (MTC-29967)
Fixed an issue where the user-specific archives of ContentType were not always fully rebuilt (MTC-29907)
Removed the use of the deprecated window.unload event in the Chrome browser (MTC-29851)
Fixed timing to call listReady event from Svelte on List view (MTC-29915)
Fixed to show confirm dialog after add/remove line on Table ContentField with browser backwording (MTC-29965)
Fixed to remove the filter item of username at List view with Svelte (MTC-29928)
Fixed to set a parameter to input field with filter_key on List view (MTC-29925)
Fixed the setting add / remove rows and lines swapped on Edit ContentType (MTC-29839)
Fixed to complete the process of mt-search.cgi with mass request parameters (MTC-29943)
Fixed performance issues of processing parameters of Data API (MTC-29962)
Fixed performance issues of processing parameters of Comment (MTC-29955)
Improve performance of mt-search.cgi with specific parameters (MTC-29961)
Fixed performance issues of processing parameters of mt-search.cgi (MTC-29953)
Updates JavaScript Libraries
Update a-table.js from 1.5.9 to 1.5.10 (MTC-29854)
Security fixes and improvements
Update TinyMCE 6 from 6.8.4 to 6.8.5 in the TinyMCE6 plugin (MTC-29922)
Fixed Cross Site Scripting (XSS) of object embedding in MT Blockeditor using TinyMCE6 Plugin (CVE-2025-24841, MTC-29997)
Fixed Cross Site Scripting (XSS) on the page of Edit a Custom Block in MT Blockeditor (CVE-2025-22888, MTC-29937)
Fixed Cross Site Scripting (XSS) on Edit user page (CVE-2025-25054, MTC-30057)
2024-11-13 08:04:11
本站用的就是古典 Blog 软件,MovableType。 升级之前是 8.0.4版本,最近 SixApart 发布了 MovableType 8.4.0, 8.0.5 等等。
今天找时间,升级了本站。
升级就是先做备份,备份了数据库,备份了整个网站。
然后从官方网站下载了最新的个人免费版本。
上传到服务器上,解压缩,然后覆盖原来的安装目录。
在自己的浏览器上,登录MovableType 后台,提示更新。
然后我习惯是重建了网站,看看使用有没有问题。
也是顺利完成。
看来从 MovableType 8.0.4 到 8.4.0 算是一个大的版本升级。
列一下,主要的变化。
首先是 从8.0.4 到 8.4.0,中间包括了 8.1,8.2,8.3 的重大改变。
UseRiot
to 0
to change to Svelte (MTC-28944, MTC-29006, MTC-29919)MTScript
and MTStylesheet
, which are used when loading JavaScript and stylesheets in mt-static
from the admin screen (MTC-25985)SuperuserRespectsDataAPIDisableSite
to force system administrators to set DataAPIDisableSite
(MTC-29694)charset="utf-8"
to places where external scripts are called (MTC-28113)看得懂,看不懂的,都看一眼,至少有些印象。
2024-10-09 02:06:07
在介绍了如何安装 Ubuntu 24.04 LTS, Webmin, Nginx, MariaDB, PHP8.1-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS上后,有些补充内容。
比如 acme.sh 现在安装的 SSL 证书,默认已经是 ecc 证书了,就是 ecc-256 (prime256v1, "ECDSA P-256")。
然而还有一些需要说明的情况就放在了下面。
实际使用上,现在我已经很少再用 TCP Wrap 来作安全防护,而是使用了 nftables 防火墙,配合 fail2ban 来组合配合。
Ubuntu 24.04.1 已经默认安装了 nftables 了,如果没有的话,就是用下面的来安装。
sudo apt install nftables
而 Ubuntu 24.04 默认是安装使用了 UFW,作为 nftables 的前端。这里我不打算使用。就需要卸掉。
sudo systemctl disable --now ufw
sudo apt remove ufw
当然还需要启用 nftables。
sudo systemctl enable --now nftables
sudo apt install fail2ban
有几个常见命令
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
sudo fail2ban-client version
返回 1.0.2,这是版本号。还有两个命令可以看 fail2ban 的状态,Ban了那些服务,哪些 IP 地址。
davidyin@walnut:~$ sudo fail2ban-client status
Status
|- Number of jail: 1
`- Jail list: sshd
davidyin@walnut:~$ sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
| |- Currently failed: 1
| |- Total failed: 10
| `- File list: /var/log/auth.log
`- Actions
|- Currently banned: 1
|- Total banned: 1
`- Banned IP list: 183.81.169.238
fail2ban 的配置文件,最好是修改 /etc/fail2ban/jail.local 这个是本机文件,以后升级系统,升级 fail2ban 也不会改变该文件。
有些参数需要设置在 jail.local 里面。比如下面,在 ignoreip 这里填入自己的 ip 地址,这样就不会不小心把自己给关在外面了。
另外还有 收件地址等等。
[sshd]
enabled = true
filter = sshd
backend = polling
action = %(action_mwl)s
ignoreip = 127.0.0.1 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
bantime = 24h
findtime = 10m
maxretry = 5
mta = sendmail
destemail = email@address
sendername = Fail2Ban
在 Webmin 管理界面,也有 Fail2Ban 的管理模块,使用也是很方便的。
大概启用 fail2ban 三个小时之后,看一眼封掉多少 IP。
在大约二十个小时之后,大约被封禁掉78个 IP 地址。大多是那些从各个机房过来扫描的。
在开机大约七天后,再次查看了 Fail2Ban 的记录,在 SSH服务上,各种登录尝试失败后的情况,被封禁的 IP 数量达到 831 次。当前还有 95 个 IP 地址。
这个对于网络传输很重要。好的这是 Google 搞出来的东西,BBR。
sudo nano /etc/sysctl.conf
在文件最后加上下面两行
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
再执行下面命令使之生效:
sudo sysctl -p
有两条命令可以用来查看情况,下面第一条是看有哪些可用的拥塞算法,第二条是看当前生效的是哪一种拥塞算法。
davidyin@walnut:~$ sudo sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
davidyin@walnut:~$ sudo sysctl -n net.ipv4.tcp_congestion_control
bbr
对于使用 php 重度用户,其实还需要开启 jit。
编辑 /etc/php/8.3/fpm/conf.d/10-opcache.ini
修改内容,增加下面这三项主要的修改。
opcache.enable_cli=1
opcache.jit_buffer_size=64M
opcache.jit=tracing
修改完成后,重启 php8.3-fpm 服务,用我常用的一些 php 性能测试 script,比较修改前后的测试结果。可以大体得出一个结论,速度快了。
用 bench.php 测试,平均时间从 0.395s 提高到了 0.101秒。
用 bubble.php 测试,时间从 0.0703 提高到 0.0257.
用 X Prober v8.19 内置的 Server Benchmark 测试,387,479 提高到了 425,905。
这种性能提高不是看数字,而是能实际感受得到的。
2024-10-08 07:44:34
安装 Ubuntu 24.04 LTS, Webmin, Nginx, MariaDB, PHP8.3-FPM,Perl-Fastcgi 到 DigitalOcean 的 VPS上。
之前介绍了如何在 DigitalOcean 创建新 VPS。并且完成基本的 Ubuntu 24.04.1 LTS的系统。然后介绍了如何安装 Webmin 主机控制面板,时区设置和 SSH 的安全设置。再之后说明一下如何用之前的新添加的用户来安装 Nginx Web 服务器和 MairaDB 数据库服务器。以及安装完 php 语言和 SSL 证书的申请。
现在要来介绍一下如何配置 nginx了。
修改 Nginx 配置文件,以满足证书的使用之前,先执行一个命令,来生成一个4096位的 dhparam 文件。
cd ~/ssl
openssl dhparam -out dhparam.pem 4096
需要等待一段时间,这个命令会执行比较长时间。
先来确认各个部分的版本信息,下面要用到。
davidyin@walnut:~/ssl$ nginx -v
nginx version: nginx/1.24.0 (Ubuntu)
davidyin@walnut:~/ssl$ openssl version
OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)
配置参数的来源根据 Mozilla SSL Configuration Generator 这个生成器来产生。
我会建议采取 Modern 方式的配置。
主机配置文件做相应的修改, http 网站重定向到 https。 采用 http2,还有就是 HSTS 与载入配置,最后完整的 u24.webexample.win 的配置文件,可以到 gist 查看,仅供参考。
到 SSL Labs 检测 SSL的配置,评分得到 A。
下面是对我而言很重要的语言支持,因为我有用 MovableType blog 系统,SEO网站优化 就是用它搭建的。而它是由 perl 语言支持的。
libfcgi-perl 可能已经有了,但下面还是再执行一遍安装,以防缺失。
sudo apt install libfcgi-perl
sudo apt install spawn-fcgi fcgiwrap
然后执行下面的命令,来启动服务。
sudo service fcgiwrap restart
最后在 Nginx 的配置文件中添加下面这块。
location ~ \.pl|cgi$ {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.pl;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
保存配置文件并重启 Nginx 服务。 接下来要测试,是否可以让 perl 文件运行。 新添加一个文件到 /home/davidyin/u24.webexample.win/index.pl 内容如下:
在服务器上的文件后缀名必须是 pl,然后给与可执行权限。
chmod 755 index.pl
在浏览器中输入 https://u24.webexample.win/index.pl
如果看到下面的输出内容,那就对了。
看到上面的信息,就可以证明 Perl 可以正常地在网站执行。
到目前为止,已经配置好一个 DigitalOcean 的 VPS,安装好了 Ubuntu 24.04 Lts,Webmin 管理控制面板,以及 Nginx web 服务器,MariaDB 数据库服务器,php8.3-fpm 服务,Perl-Fastcgi 服务,免费的 SSL 证书。配置好了一个测试网站。
之后,需要安装那些由 php 编写的网站程序, Perl 编写的网站程序,都可以安装了。