|
1 | 1 | # MacOS 的安全和隐私指南
|
2 | 2 |
|
3 | 3 | > * 原文地址:[macOS Security and Privacy Guide](https://github.com/drduh/macOS-Security-and-Privacy-Guide)
|
4 |
| -* 原文作者:[drduh](https://github.com/drduh) |
5 |
| -* 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner) |
6 |
| -* 译者:[Nicolas(Yifei) Li](https://github.com/yifili09), [MAYDAY1993](https://github.com/MAYDAY1993), [DeadLion](https://github.com/DeadLion) |
7 |
| -* 校对者:[lovelyCiTY](https://github.com/lovelyCiTY), [sqrthree](https://github.com/sqrthree) |
| 4 | +> * 原文作者:[drduh](https://github.com/drduh) |
| 5 | +> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner) |
| 6 | +> * 译者:[Nicolas(Yifei) Li](https://github.com/yifili09), [MAYDAY1993](https://github.com/MAYDAY1993), [DeadLion](https://github.com/DeadLion) |
| 7 | +> * 校对者:[lovelyCiTY](https://github.com/lovelyCiTY), [sqrthree](https://github.com/sqrthree) |
| 8 | +> * 这个 [链接](https://github.com/xitu/macOS-Security-and-Privacy-Guide/compare/master...drduh:master) 用来查看本翻译与英文版是否有差别(如果你没有看到 README.md 发生变化,那就意味着这份翻译文档是最新的)。 |
8 | 9 |
|
9 | 10 | 这里汇集了一些想法,它们是有关如何保护运行了 macOS 10.12 "Sierra" 操作系统(以前是 **OS X**)的现代化苹果 Mac 电脑,也包含了一些提高个人网络隐私的小贴士。
|
10 | 11 |
|
|
95 | 96 |
|
96 | 97 | 为固件设定一个密码,它能阻止除了你的启动盘之外的任何其它设备启动你的 Mac 电脑。它也能设定成每次启动时为必选项。
|
97 | 98 |
|
98 |
| -[当你的计算机被盗的时候,这个功能是非常有用的](https://www.ftc.gov/news-events/blogs/techftc/2015/08/virtues-strong-enduser-device-controls),因为唯一能重置固件密码的方式是通过 `Apple Store`,或者使用一个 [SPI 程序](https://reverse.put.as/2016/06/25/apple-efi-firmware-passwords-and-the-scbo-myth/),例如 [Bus Pirate](http://ho.ax/posts/2012/06/unbricking-a-macbook/) 或者其它刷新电路的程序。 |
| 99 | +[当你的计算机被盗或者丢失的时候,这个功能是非常有用的](https://www.ftc.gov/news-events/blogs/techftc/2015/08/virtues-strong-enduser-device-controls),该功能可以防止直接内存访问从而可以读取您的 FileVault 密码并注入诸如 [pcileech](https://github.com/ufrisk/pcileech) 之类的内核模块这种攻击方式,因为唯一能重置固件密码的方式是通过 `Apple Store`,或者使用一个 [SPI 程序](https://reverse.put.as/2016/06/25/apple-efi-firmware-passwords-and-the-scbo-myth/),例如 [Bus Pirate](http://ho.ax/posts/2012/06/unbricking-a-macbook/) 或者其它刷新电路的程序。 |
99 | 100 |
|
100 | 101 | 1. 开始时,按下 `Command` 和 `R` 键来启动[恢复模式 / Recovery Mode](https://support.apple.com/en-au/HT201314)。
|
101 | 102 |
|
|
113 | 114 |
|
114 | 115 | 这个固件密码会在下一次启动后激活。为了验证这个密码,在启动过程中按住 `Alt` 键 - 按照提示输入密码。
|
115 | 116 |
|
116 |
| -当启动进操作系统以后。固件密码也能通过 `firmwarepasswd` 工具管理。 |
| 117 | +当启动进操作系统以后。固件密码也能通过 `firmwarepasswd` 工具管理。例如,从另一个模式启动的时候可以这样: |
| 118 | + |
| 119 | +$ sudo firmwarepasswd -setpasswd -setmode command |
| 120 | + |
| 121 | +输入一个密码然后重启。 |
117 | 122 |
|
118 | 123 | <img width="750" alt="Using a Dediprog SF600 to dump and flash a 2013 MacBook SPI Flash chip to remove a firmware password, sans Apple" src="https://cloud.githubusercontent.com/assets/12475110/17075918/0f851c0c-50e7-11e6-904d-0b56cf0080c1.png">
|
119 | 124 |
|
@@ -286,10 +291,10 @@ $ /tmp/recovery/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartitio
|
286 | 291 | 在虚拟机内安装 macOS,可以使用 [VMware Fusion](https://www.vmware.com/products/fusion.html) 工具,按照上文中的说明来创建一个镜像。你**不需要**再下载,也不需要手动创建还原分区。
|
287 | 292 |
|
288 | 293 | ```
|
289 |
| -VMware-Fusion-8.5.2-4635224.dmg |
290 |
| -SHA-256: f6c54b98c9788d1df94d470661eedff3e5d24ca4fb8962fac5eb5dc56de63b77 |
291 |
| -SHA-1: 37ec465673ab802a3f62388d119399cb94b05408 |
292 |
| -``` |
| 294 | +VMware-Fusion-8.5.6-5234762.dmg |
| 295 | +SHA-256: 57a879095c9fcce0066bea0d3c203571689fb53205915fda156c0d742f7c7ad2 |
| 296 | +SHA-1: b7315d00a7c92dbad280d0f01f42dd8b56d96040 |
| 297 | + ``` |
293 | 298 |
|
294 | 299 | 选择 **Install OS X from the recovery parition** 这个安装方法。可自定义配置任意的内存和 CPU,之后完成设置。默认情况下,这个虚拟机应该进入 [Recovery Mode / 还原模式](https://support.apple.com/en-us/HT201314)。
|
295 | 300 |
|
@@ -385,7 +390,7 @@ $ dscl . -read /Users/<username> GeneratedUID
|
385 | 390 |
|
386 | 391 | [FileVault](https://en.wikipedia.org/wiki/FileVault) 提供了在 macOS 上对整个磁盘加密的能力(技术上来说,是**整个卷宗**。)
|
387 | 392 |
|
388 |
| -FileVault 加密将在休眠的时候保护数据,并且阻止其它人通过物理访问形式偷取数据或者使用你的 Mac 修改数据。 |
| 393 | +FileVault 加密在休眠的时候保护数据,并且使通过物理访问形式偷取数据或者使用你的 Mac 修改数据的某人更为艰难(但[不总是阻止](http://blog.frizk.net/2016/12/filevault-password-retrieval.html))。 |
389 | 394 |
|
390 | 395 | 因为大部分的加密操作都[高效地运作在硬件上](https://software.intel.com/en-us/articles/intel-advanced-encryption-standard-aes-instructions-set/),性能上的损失对 FireVault 来说并不凸显。
|
391 | 396 |
|
@@ -480,10 +485,10 @@ FileVault 的安全性依赖于伪随机数生成器 (PRNG)。
|
480 | 485 | **以下是一段 Little Snitch 监控会话的例子**
|
481 | 486 |
|
482 | 487 | ```
|
483 |
| -LittleSnitch-3.7.1.dmg |
484 |
| -SHA-256: e6332ee70385f459d9803b0a582d5344bb9dab28bcd56e247ae69866cc321802 |
485 |
| -SHA-1: d5d602c0f76cd73051792dff0ac334bbdc66ae32 |
486 |
| -``` |
| 488 | +LittleSnitch-3.7.4.dmg |
| 489 | +SHA-256: b0ce3519d72affbc7910c24c264efa94aa91c9ad9b1a905c52baa9769156ea22 |
| 490 | +SHA-1: 868ad75623c60cb9ad428c7c1d3e5ae449a9033e |
| 491 | + ``` |
487 | 492 |
|
488 | 493 | 这些程序都具备有监控和阻拦**对内**和**对外**网络连接的能力。然而,它们可能会需要使用一个闭源的[内核扩展](https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/Extend/Extend.html)。
|
489 | 494 |
|
@@ -593,7 +598,7 @@ $ curl -O https://fix-macosx.com/fix-macosx.py
|
593 | 598 |
|
594 | 599 | $ less fix-macosx.py
|
595 | 600 |
|
596 |
| -$ python fix-macosx.py |
| 601 | +$ /usr/bin/python fix-macosx.py |
597 | 602 | All done. Make sure to log out (and back in) for the changes to take effect.
|
598 | 603 | ```
|
599 | 604 |
|
@@ -665,12 +670,12 @@ fe80::1%lo0 localhost
|
665 | 670 |
|
666 | 671 | $ brew install dnsmasq --with-dnssec
|
667 | 672 |
|
668 |
| - $ cp ~/homebrew/opt/dnsmasq/dnsmasq.conf.example ~/homebrew/etc/dnsmasq.conf |
| 673 | + $ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf |
669 | 674 |
|
670 | 675 |
|
671 | 676 | 编辑配置项:
|
672 | 677 |
|
673 |
| - $ vim ~/homebrew/etc/dnsmasq.conf |
| 678 | + $ vim /usr/local/etc/dnsmasq.conf |
674 | 679 |
|
675 | 680 | 检查所有的选项。这有一些推荐启用的设置:
|
676 | 681 |
|
@@ -796,13 +801,17 @@ $ find ~/homebrew -name homebrew.mxcl.dnscrypt-proxy.plist
|
796 | 801 |
|
797 | 802 | $ sudo gsed -i "/sbin\\/dnscrypt-proxy<\\/string>/a<string>--local-address=127.0.0.1:5355<\\/string>\n" $(find ~/homebrew -name homebrew.mxcl.dnscrypt-proxy.plist)
|
798 | 803 |
|
799 |
| -默认情况下,`resolvers-list` 将会指向 dnscrypt 版本特定的 resolvers 文件。当更新了 dnscrypt,这一版本将不再存在,若它存在,可能指向一个过期的文件。在 `/Library/LaunchDaemons/homebrew.mxcl.dnscrypt-proxy.plist` 中把 resolvers 文件改为 `/usr/local/share` 中的符号链接的版本,能解决上述问题: |
| 804 | +默认情况下,`resolvers-list` 将会指向 dnscrypt 版本特定的 resolvers 文件。当更新了 dnscrypt,这一版本将不再存在,若它存在,可能指向一个过期的文件。在 `homebrew.mxcl.dnscrypt-proxy.plist` 中把 resolvers 文件改为 `/usr/local/share` 中的符号链接的版本,能解决上述问题: |
800 | 805 |
|
801 | 806 | <string>--resolvers-list=/usr/local/share/dnscrypt-proxy/dnscrypt-resolvers.csv</string>
|
802 | 807 |
|
| 808 | +还有下面这一行: |
| 809 | + |
| 810 | + <string>/usr/local/opt/dnscrypt-proxy/sbin/dnscrypt-proxy</string> |
| 811 | + |
803 | 812 | 启用 DNSCrypt:
|
804 | 813 |
|
805 |
| - $ brew services start dnscrypt-proxy |
| 814 | + $ sudo brew services start dnscrypt-proxy |
806 | 815 |
|
807 | 816 | 确保 DNSCrypt 在运行:
|
808 | 817 |
|
@@ -865,12 +874,12 @@ macOS 上有从像 Apple、Verisign、Thawte、Digicert 这样的营利性公司
|
865 | 874 |
|
866 | 875 | Apple 在他们的 [Cryptographic Services 指南](https://developer.apple.com/library/mac/documentation/Security/Conceptual/cryptoservices/GeneralPurposeCrypto/GeneralPurposeCrypto.html)文档中宣布**弃用** OpenSSL。他们的版本也有补丁,可能会[带来惊喜喔](https://hynek.me/articles/apple-openssl-verification-surprises/)。
|
867 | 876 |
|
868 |
| -如果你要在你的 Mac 上用 OpenSSL,用 `brew install openssl` 下载并安装一个 OpenSSL 最近的版本。注意,brew 已经链接了 `/usr/bin/openssl` ,可能和构建软件冲突。查看 [issue #39](https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/39)。 |
| 877 | +如果你要在你的 Mac 上用 OpenSSL,用 `brew install openssl` 下载并安装一个 OpenSSL 最近的版本。注意,brew 已经链接了 `/usr/bin/openssl` ,可能和内置软件冲突。查看 [issue #39](https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/39)。 |
869 | 878 |
|
870 | 879 | 在 homebrew 版本和 OpenSSL 系统版本之间比较 TLS 协议和密码:
|
871 | 880 |
|
872 | 881 | ```
|
873 |
| -$ ~/homebrew/bin/openssl version; echo | ~/homebrew/bin openssl s_client -connect github.com:443 2>&1 | grep -A2 SSL-Session |
| 882 | +$ ~/homebrew/bin/openssl version; echo | ~/homebrew/bin/openssl s_client -connect github.com:443 2>&1 | grep -A2 SSL-Session |
874 | 883 | OpenSSL 1.0.2j 26 Sep 2016
|
875 | 884 | SSL-Session:
|
876 | 885 | Protocol : TLSv1.2
|
@@ -1151,9 +1160,9 @@ gpg: assuming signed data in `TorBrowser-6.0.5-osx64_en-US.dmg'
|
1151 | 1160 | gpg: Signature made Fri Sep 16 07:51:52 2016 EDT using RSA key ID D40814E0
|
1152 | 1161 | gpg: Can't check signature: public key not found
|
1153 | 1162 |
|
1154 |
| -$ gpg --recv 0xD40814E0 |
1155 |
| -gpg: requesting key D40814E0 from hkp server keys.gnupg.net |
1156 |
| -gpg: key 93298290: public key "Tor Browser Developers (signing key) <torbrowser@torproject.org>" imported |
| 1163 | +$ gpg --recv 0x4E2C6E8793298290 |
| 1164 | +gpg: requesting key 0x4E2C6E8793298290 from hkp server keys.gnupg.net |
| 1165 | +gpg: key 0x4E2C6E8793298290: public key "Tor Browser Developers (signing key) <torbrowser@torproject.org>" imported |
1157 | 1166 | gpg: no ultimately trusted keys found
|
1158 | 1167 | gpg: Total number processed: 1
|
1159 | 1168 | gpg: imported: 1 (RSA: 1)
|
@@ -1426,6 +1435,8 @@ $ xattr -l ~/Downloads/TorBrowser-6.0.5-osx64_en-US.dmg
|
1426 | 1435 |
|
1427 | 1436 | 看看 [Yubikey](https://www.yubico.com/products/yubikey-hardware/yubikey-neo/) 的两因素和私钥(如:ssh、gpg)硬件令牌。 阅读 [drduh/YubiKey-Guide](https://github.com/drduh/YubiKey-Guide) 和 [trmm.net/Yubikey](https://trmm.net/Yubikey)。两个 Yubikey 的插槽之一可以通过编程来生成一个长的静态密码(例如可以与短的,记住的密码结合使用)。
|
1428 | 1437 |
|
| 1438 | +除了登录和其他 PAM 模块,也能用 Yubikey 来使你的登录和 sudo 更安全,这里有份来自[Yubico](https://www.yubico.com/wp-content/uploads/2016/02/Yubico_YubiKeyMacOSXLogin_en.pdf)的 pdf 文档。Yubikey 有点贵,这有个更便宜的替代品,但是没有它好,[U2F Zero](https://www.u2fzero.com/)。这有份文档来[启动它](https://microamps.gibsjose.com/u2f-authentication-on-os-x/)。 |
| 1439 | + |
1429 | 1440 | ## 备份
|
1430 | 1441 |
|
1431 | 1442 | 备份到外部介质或在线服务之前,总是先对本地文件进行加密。
|
@@ -1826,6 +1837,10 @@ Google Chrome 现在应该可以启动了,以后的更新也不会被阻止,
|
1826 | 1837 |
|
1827 | 1838 | 在 `/var/log/santa.log` 可以查看监控器**允许**和**拒绝**执行的决策记录。
|
1828 | 1839 |
|
| 1840 | +[Zentral](https://github.com/zentralopensource/zentral)里有针对 Santa 的一个日志和配置框架,Zentral 是一个开源的事件监控框架和针对osquery 和 Santa 的 TLS 服务器。 |
| 1841 | + |
| 1842 | +Zentral 会在监控和锁定模式支持 Santa。客户端需要建立一个 TLS 连接来同步 Santa 规则。所有来自终端的 Santa 事件会汇总并记录在 Zentral 里。Santa 事件能从 Zentral 框架内部触发行为和通知。 |
| 1843 | + |
1829 | 1844 | **注意** Python、Bash 和其它解释性语言是在白名单中的(因为它们是由苹果开发者证书签名的),所以 Santa 不会阻止这些脚本的运行。因此,要注意到 Santa 可能无法有效的拦截非二进制程序运行(这不算漏洞,因为它本身就这么设计的)。
|
1830 | 1845 |
|
1831 | 1846 | ## 其它
|
@@ -1912,6 +1927,9 @@ $ duti -s com.apple.Safari smb
|
1912 | 1927 |
|
1913 | 1928 | [CISOfy/lynis](https://github.com/CISOfy/lynis) - 跨平台安全审计工具,并协助合规性测试和系统强化。
|
1914 | 1929 |
|
| 1930 | +[Zentral](https://github.com/zentralopensource/zentral)- 一个针对 santa 和 osquery 的日志和配置框架。在盘点、事件 |
| 1931 | +日志文件,结合时点的提醒上运行排查和探测。一个完整的框架和 Django web 服务器搭建在 elastic stack(通常叫 ELK stack)基础上。 |
| 1932 | + |
1915 | 1933 | ## 其它资源
|
1916 | 1934 |
|
1917 | 1935 | **排名不分先后**
|
|
0 commit comments