目录
Hshh's Cosmos
试用 Google 的 ACME 服务
简单来说, 如果已有项目, 在 web console 中运行以下命令获取 EAB_KID 和 EAB_HMAC_KEY.
gcloud config set project PROJECT_ID gcloud publicca external-account-keys create
自己修改了下 dehydrated, 用于支持 Google Trust Services. 首次注册需要指定 CONTACT_EMAIL, EAB_KID 和 EAB_HMAC_KEY.
优点:
- 国内有 OCSP 服务器.
缺点:
- CA 国内无法访问.
- http-01, CA无法访问国内.
- 如果申请 RSA 证书可能最高只支持 2048, 好在我用 ECDSA.
记录一次 ZFS 由于设备名称变更导致故障的修复
发现一台 ubuntu 23.10 的 ZFS 卷降级了
# zpool status stor pool: stor state: DEGRADED status: One or more devices could not be used because the label is missing or invalid. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Replace the device using 'zpool replace'. see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J scan: scrub repaired 0B in 19:13:23 with 0 errors on Sun Jun 9 19:37:31 2024 config: NAME STATE READ WRITE CKSUM stor DEGRADED 0 0 0 raidz2-0 DEGRADED 0 0 0 scsi-35000cca260cd1f18 ONLINE 0 0 0 scsi-35000cca260cc3084 ONLINE 0 0 0 scsi-35000cca260cc6be0 ONLINE 0 0 0 13184766210832087855 FAULTED 0 0 0 was /dev/sdf1 8984617841033776882 FAULTED 0 0 0 was /dev/sdg1 wwn-0x5000cca2604ac3e0 ONLINE 0 0 0 errors: No known data errors # zpool status -L stor pool: stor state: DEGRADED status: One or more devices could not be used because the label is missing or invalid. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Replace the device using 'zpool replace'. see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J scan: scrub repaired 0B in 19:13:23 with 0 errors on Sun Jun 9 19:37:31 2024 config: NAME STATE READ WRITE CKSUM stor DEGRADED 0 0 0 raidz2-0 DEGRADED 0 0 0 sdc ONLINE 0 0 0 sdd ONLINE 0 0 0 sde ONLINE 0 0 0 13184766210832087855 FAULTED 0 0 0 was /dev/sdf1 8984617841033776882 FAULTED 0 0 0 was /dev/sdg1 sdg ONLINE 0 0 0 errors: No known data errors
我的天, raidz2 掉了2个盘!
经检查, 硬盘并没有问题, 只是重启后设备名变了(从上面 sdg 在列里, 但是却说曾经的 sdg1 出错了可以看出), 这样 ZFS 就出问题了??!! 我在 FreeBSD 下重来没碰到过.
试着用 zpool replace, 报错
# zpool replace stor 13184766210832087855 /dev/sdf invalid vdev specification use '-f' to override the following errors: /dev/sdf1 is part of active pool 'stor' # zpool replace -f stor 13184766210832087855 /dev/sdf invalid vdev specification the following errors must be manually repaired: /dev/sdf1 is part of active pool 'stor'
尝试zpool labelclear, 报错. wipefs 掉再 replace, 还是报错
# zpool labelclear /dev/sdf failed to clear label for /dev/sdf # wipefs -a /dev/sdf /dev/sdf: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54 /dev/sdf: 8 bytes were erased at offset 0x74702555e00 (gpt): 45 46 49 20 50 41 52 54 /dev/sdf: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa /dev/sdf: calling ioctl to re-read partition table: Success # zpool replace stor 13184766210832087855 /dev/sdf cannot replace 13184766210832087855 with /dev/sdf: /dev/sdf is busy, or device removal is in progress
艹! 已经不能描述我当前的心情了.
最后查了下网上的一些案例, 先 export, 然后用 import -d 的方式. 但是如果只用 -d /dev/disk/by-id/ 是不行的, 直接用多次 -d 来解决.
将有问题的设备离线, 导出池后, 用 -d /dev/disk/by-id/ 加上多个 -d 设备名导入池. 然后将有问题的设备重新上线.
# zpool offline stor 13184766210832087855 # zpool offline stor 8984617841033776882 # zpool export stor # zpool import -d /dev/disk/by-id/ -d /dev/sdc -d /dev/sdd -d /dev/sde -d /dev/sdg -d /dev/sdf -d /dev/sdi stor # zpool online stor 13184766210832087855 # zpool online stor 8984617841033776882
最后终于池在线了, 并且对2个有问题的设备重建.
# zpool status stor pool: stor state: ONLINE status: One or more devices is currently being resilvered. The pool will continue to function, possibly in a degraded state. action: Wait for the resilver to complete. scan: resilver in progress since Sun Jul 7 01:17:01 2024 44.7G / 32.3T scanned at 1.09G/s, 0B / 32.3T issued 0B resilvered, 0.00% done, no estimated completion time config: NAME STATE READ WRITE CKSUM stor ONLINE 0 0 0 raidz2-0 ONLINE 0 0 0 scsi-35000cca260cd1f18 ONLINE 0 0 0 scsi-35000cca260cc3084 ONLINE 0 0 0 scsi-35000cca260cc6be0 ONLINE 0 0 0 wwn-0x5000cca260cc504c ONLINE 0 0 0 wwn-0x5000cca260cc32d0 ONLINE 0 0 0 (awaiting resilver) wwn-0x5000cca2604ac3e0 ONLINE 0 0 0 errors: No known data errors
实际重建速度在后面是很快的, 前面做扫描用了一段很长的时间.
又是鸡飞蛋打的时间
一堆 Linux 需要更新 OpenSSH: CVE-2024-6387.
禁用 Windows Defender
新版本的 win10/win11 对于只用注册表和组策略来禁用内置的杀毒, 已经没用了. 系统会自动重新启用杀毒.
简单的解决方法
在安全模式时运行以下命令, 可以提前写到 bat/cmd 文件, 启动到安全模式以管理员运行
reg add "HKLM\System\CurrentControlSet\Services\WdFilter" /v "Start" /t REG_DWORD /d "4" /f reg add "HKLM\System\CurrentControlSet\Services\WdNisDrv" /v "Start" /t REG_DWORD /d "4" /f reg add "HKLM\System\CurrentControlSet\Services\WdNisSvc" /v "Start" /t REG_DWORD /d "4" /f reg add "HKLM\System\CurrentControlSet\Services\WinDefend" /v "Start" /t REG_DWORD /d "4" /f
配合注册表更完美
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender] "DisableAntiSpyware"=dword:00000001 "DisableRealtimeMonitoring"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection] "DisableBehaviorMonitoring"=dword:00000001 "DisableOnAccessProtection"=dword:00000001 "DisableScanOnRealtimeEnable"=dword:00000001
rustdesk
现在 TeamViewer 越来越恶心, 国内用还会提示绑手机号. AnyDesk 连接服务器慢, 中继服务器国内连接不快, 直接端口连接对于同一个ip地址不同端口支持不好.
改用 RustDesk, 自己搭了个服务端, 连接速度真够快的.
btrfs
由于 btrfs 缺少 ext4 的 e2image 工具, 所以如果要把分区前部空出一段空间, 而且使用空间超过一半, 就要操作很多步才能达到目的.
把当前的文件系统缩小, 修改分区缩小后段, 新建分区, 加到 btrfs 的相同挂载点.
重复上面步骤. 最后就是新建了一堆临时分区, 最后腾出前段的空间, 再反向操作.
如果给 windows 设置测试用的 IPv6
根据命令 netsh interface ipv6 show prefixpolicies
Precedence Label Prefix ---------- ----- -------------------------------- 50 0 ::1/128 40 1 ::/0 35 4 ::ffff:0:0/96 30 2 2002::/16 5 5 2001::/32 3 13 fc00::/7 1 11 fec0::/10 1 12 3ffe::/16 1 3 ::/96
如果只是测试, 不要给 windows 使用大于 label 1 的 IPv6 地址段, 避免以后碰到的坑.
碰到 bhyve 的 efi boot var 坏了
bhyve 里的 arch linux 更新重启后, bhyve core dump, 启动不了了.
把 ini 的 lpc.bootvars 注释掉, 正常启动, 看来不知道什么原因把 efi 的 启动变量弄坏了.
重新把 /usr/local/share/edk2-bhyve/BHYVE_UEFI_VARS.fd 复制过来覆盖掉, 启动正常.
重新进到虚拟机后, 用 efibootmgr 添加启动项, 修改启动顺序. 再次重启, 没问题.
非常奇怪, 坏之前明明没有碰过 efi boot var 啊.
有点想把 locale 设为 C.UTF-8
一直以来都在用 en_US.UTF-8, 但是用 sort, comm 总是怪怪的.
Linux
用 en_US, 排序会忽略符号
$ printf "a.d\na_c\nab" | sort ab a_c a.d
用 C
$ printf "a.d\na_c\nab" | sort a.d a_c ab
用 awk 排序, 不依赖 locale
$ printf "a.d\na_c\nab" | awk '{if ($0!="") {a[$0]}} END {asorti(a); for (k in a) {print a[k]}}' a.d a_c ab
FreeBSD
用 en_US
$ printf "a.d\na_c\nab" | sort a_c a.d ab
用 C
$ printf "a.d\na_c\nab" | sort a.d a_c ab
用 gawk 排序和 Linux 一样 (FreeBSD 自身的 awk 不支持 asorti)
DNSSEC & EDNS
查 DNS 总是 DNSSEC 失败, 查了几天, 终于想起来, DNSSEC 需要用 EDNS, 而我对某些 IP 段关闭了 EDNS. 原来傻逼是自己.