SIP and SSV of Apple

Last updated on January 17, 2024 pm

最近输入法总是莫名其妙地跳 ABC,输入设置中也不能删除,查询一番后发现必须要更改 plist 文件,系统 plist 更改需要关闭电脑的 SIP,即 system integrity protection。关闭 SIP 之后我想起来之前想更改系统应用的图标时好像也需要这一操作,结果发现还是不能替换,原来苹果又搞了一个 SSV,即 signed system volume,不关闭 SSV 无法更改 read-only file system 中的内容。

删除 ABC

Apple silicon 系列关机后长按开机键进入 recovery system,然后在 terminal 中输入 csrutil disable 即可关闭 SIP。输入 reboot 重启。
在 ABC 状态下,进入 ~/Library/Preferences/com.apple.HIToolbox.plist,用 plist editor 打开,在 AppleEnabledInputSources 中找到包含 KeyboardLayout Name 为 ABC 的 item,将其删除并保存,重启即可删除 ABC。

替换系统图标

Excerpt from an Apple article:
In macOS Catalina, Apple introduced the read-only system volume, which is a dedicated, isolated volume for system content. Now, macOS Big Sur adds strong cryptographic protections to store system content on a signed system volume (SSV). SSV features a kernel mechanism that verifies the integrity of the system content at runtime, and rejects any data — code and non-code — that doesn’t have a valid cryptographic signature from Apple.
SSV helps prevent tampering with any Apple software that is part of the operating system. Additionally, it makes macOS Software Update more reliable and much safer. SSV utilizes APFS snapshots, so if an update cannot be performed, the old system version can be restored without reinstallation.

首先在 Security&Privacy 中关闭 fileVault,然后同样在 recovery terminal 中,输入 csrutil authenticated-root disable 即可关闭 SSV,接着 reboot。在 terminal 中输入 mount 查看已挂载文件系统的列表,其中系统盘的名称,即 on / 前的路径,我的电脑是 /dev/disk3s1s1,其中 dev 表示 device,disk3 指物理磁盘,s1 指其上的一个分区,紧接着的 s1 指的是分区中的一个卷,可能包含子卷或快照,即当前设备显示内容。
既然原本分区中的内容不可 write,在关闭 SSV 后可以将其挂载到 writable 的分区中,然后进行改写,最后再将改写后的分区覆盖原本的快照即可。
具体操作如下:

1
2
3
4
5
mkdir ~/mnt
sudo mount -o nobrowse -t apfs /dev/disk3s1 ~/mnt
#这里就将当前系统盘挂载到当前用户的mnt文件夹中,在这一可读写区中进行目标操作即可,对于我来说就是将maps和music的图标换成复古风格
sudo bless --mount "$HOME/mnt/System/Library/CoreServices/" --setBoot --create-snapshot
#setBoot指定挂载点作为下一次启动要使用的启动卷,并通过create-snapshot创建快照在下一次系统启动时使用

重启后即可发现更改已经生效。不过不能再开启 SSV,否则更改将失效。这里最后一步有指导用的是 sudo bless --folder ~/mnt/System/Library/CoreServices --bootefi --create-snapsho--folder 也是指定挂载路径,--bootefi 是指定 EFI 分区的路径作为启动卷,暂时不知道区别是啥,不过指导里说可以重新 enable SIP 和 SSV。

SSV 和文件保险箱
在 macOS 11 中,SSV 为系统内容提供对等的静息状态保护,因此系统宗卷不再需要加密。读取到对静息状态文件系统进行的任何修改时,文件系统会检测到这些修改。如果用户已启用文件保险箱,数据宗卷上的用户内容仍通过用户提供的密钥加密。
如果用户选择停用 SSV,处于静息状态的系统会变得易于篡改,此篡改可使攻击者能够在系统下次启动时提取加密的用户数据。因此,如果文件保险箱已启用,系统不会允许用户停用 SSV。静息状态保护必须同时为两个宗卷启用或停用。

值得注意的是,SSV 不能启用会导致 fileVault 也无法启用,文件不能被加密。目前来说,想要 DIY 一下就得留点风险出来,自己斟酌吧。
结果展示:
图标
还是原来的图标有味道。

参考

https://egpu.io/forums/mac-setup/macos-up-to-11/


Author
3cc
Posted on
January 17, 2024
Licensed under