惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
腾讯CDC
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
博客园_首页
D
DataBreaches.Net
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
月光博客
月光博客
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Vercel News
Vercel News
WordPress大学
WordPress大学
J
Java Code Geeks
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
U
Unit 42

LanYunのBlog

优化macOS Dock栏的显示与隐藏 解决macOS全屏模式下某些情况显示原始鼠标指针的问题 Yarn从Classic迁移到Modern nginx自编译 ESXI 8.0安装黑群晖DSM 7.x openwrt编译过程记录 编译monero For macOS ARM 自建busuanzi不蒜子平台统计平台 浅记博客更新日志 (机翻)Kubo配置文件 修改brew services中服务的启动参数 技术杂记📝 解决Surge模块不能同步问题 为Arch Linux配置邮件服务 自编译NutClient-ESXI,更改邮件逻辑 解决ESXI和群晖使用SSH密钥登录问题 为J4125软路由ESXI中群晖提供UPS服务 在arch linux上搭建rustdesk server 解决虚拟机扩容中GPT PMBR大小不符问题 搭建Tuic V5 优雅地为macOS提供python多版本的支持 修复root路径下文件权限问题 解决macOS 14上利用Whisky运行steam时有关问题 在macOS中用PhpStorm配置Xdebug调试 利用CloudFlare Workers快速自建一个IP获取器 如何自动续期证书? 从0开始速配VPS用于网站等 搭建一个基于ChatGPT的QQ机器人(Yunzai-Bot) For Mac 010 Editor For Mac 13.0.1 Crack 破解 关于部署Cloudflare Zero Trust遇到的问题浅记录📝
用santa对二进制进行监控和授权
LanYun · 2023-11-07 · via LanYunのBlog

前言

仅限macOS.

本文用到的项目: Santa

介绍:

Santa是macOS的二进制和文件访问授权系统。它由一个系统扩展组成,用于监视执行情况,一个守护程序根据本地数据库的内容做出执行决策,一个图形用户界面代理用于在决策被阻止时通知用户,以及一个用于管理系统和将数据库与服务器同步的命令行实用程序。

它之所以被称为Santa,是因为它跟踪二进制文件的行为,判断它们是好还是坏。

本文会快速部署并演示阻止QQ的ScreenCaptureAgent二进制程序.

如果要了解更多或者看不懂本文,请移步 官方文档

部署

起手先前往 Releases 下载最新版,然后安装,然后打开然后点Dismiss.

然后下载这个 Santa.7z 压缩包再解压出来.

如果要方便控制规则,请排除中央管理配置文件.

已使用 MDM 解决方案

排除中央管理配置文件,一共有4个文件,然后安装4次就行了.

安装方法: 双击mobileconfig文件来安装描述文件.

然后前往 设置 -> 隐私与安全性 -> 描述文件 中,看着操作把它安装了.

未使用/看不懂

安装配置文件和通知设置文件夹中的配置文件,一共2个文件.

然后前往 设置 -> 隐私与安全性 -> 完全磁盘访问权限

勾选 com.google.santa.daemon.然后再打开Santa可看到如图所示

image-20231108034238101

mobileconfig配置文件更多配置项可参考文档

检查状态

终端命令行运行

1
santactl status

输出了 Daemon Info 就没问题.

阻止

1
sudo santactl rule --block --path /Applications/QQ.app/Contents/Resources/app/ScreenCaptureAgent.framework/Versions/A/ScreenCaptureAgent

Tips: 这里演示的是路径阻止,实际还有阻止方式,此处懒的写了.

检验

1
santactl fileinfo /Applications/QQ.app/Contents/Resources/app/ScreenCaptureAgent.framework/Versions/A/ScreenCaptureAgent --key Rule

Tips: fileinfo 参数非常强大,远不止此功能,此处也懒的写了.

杂项

1
2
3
4
5
6
7
8
9
10
11
12
13
ls /var/db/santa 
santactl help
Usage: santactl:
fileinfo - Prints information about a file.
metrics - Show Santa metric information.
printlog - Prints the contents of Santa protobuf log files as JSON.
rule - Manually add/remove/check rules.
status - Show Santa status information.
sync - Synchronizes Santa with a configured server.
version - Show Santa component versions.

See 'santactl help <command>' to read about a specific subcommand.
santactl help rule

命令运行结果示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
santactl help rule
Help for 'rule':
Usage: santactl rule [options]
One of:
--allow: add to allow
--block: add to block
--silent-block: add to silent block
--compiler: allow and mark as a compiler
--remove: remove existing rule
--check: check for an existing rule
--import: import rules from a JSON file
--export: export rules to a JSON file

One of:
--path {path}: path of binary/bundle to add/remove.
Will add the hash of the file currently at that path.
Does not work with --check. Use the fileinfo verb to check.
the rule state of a file.
--identifier {sha256|teamID|signingID}: identifier to add/remove/check
--sha256 {sha256}: hash to add/remove/check [deprecated]
--json {path}: path to a JSON file containing a list of rules to add/remove

Optionally:
--teamid: add or check a team ID rule instead of binary
--signingid: add or check a signing ID rule instead of binary (see notes)
--certificate: add or check a certificate sha256 rule instead of binary
--message {message}: custom message

Notes:
The format of `identifier` when adding/checking a `signingid` rule is:

`TeamID:SigningID`

Because signing IDs are controlled by the binary author, this ensures
that the signing ID is properly scoped to a developer. For the special
case of platform binaries, `TeamID` should be replaced with the string
"platform" (e.g. `platform:SigningID`). This allows for rules
targeting Apple-signed binaries that do not have a team ID.

Importing / Exporting Rules:
If santa is not configured to use a sync server one can export
& import its non-static rules to and from JSON files using the
--export/--import flags. These files have the following form:

{"rules": [{rule-dictionaries}]}
e.g. {"rules": [
{"policy": "BLOCKLIST",
"identifier": "84de9c61777ca36b13228e2446d53e966096e78db7a72c632b5c185b2ffe68a6"
"custom_url" : "",
"custom_msg": "/bin/ls block for demo"}
]}

对于设备网络安全:

我目前是: 系统防火墙,阻止主动探测,Little Snitch 防火墙,阻止未手动添加的规则的流量,Proxifier 做前置代理,进行网络分流,adguard 做内容过滤,surge等工具做代理转发