> ## Content Index
> Fetch the complete content index at: https://sgpublic.xyz/llms.txt
> Use this file to discover other available public pages before exploring further.

# 对抗 EasyConnect for macOS 的流氓行为
- URL: https://sgpublic.xyz/p/2025/03/6aac9cb1810a48000153360d/
- Published: 2025-03-23T01:29:59.000Z
- Updated: 2025-03-23T01:29:59.000Z
- Author: Haven Madray
- Tags: 桌面与终端, macOS, #wp-post

> 参考文章：[https://tryme.wang/archives/202401/macos-fuck-easyconnect.html](https://tryme.wang/archives/202401/macos-fuck-easyconnect.html?ref=sgpublic.xyz)

前排提醒：此文章针对 macOS 用户。

对于一些院校访问校内网站需使用 VPN，初衷大概是为了安全，但所使用的 EasyConnect 有点不对劲。

首先其会用 root 身份运行两个进程，完全停不掉，并且还会往系统注入一个证书。这会导致两个隐患：

1. 这两个进程能读取设备上任意文件，属于是底裤都被看穿了。
2. 注入证书就能实现中间人攻击，能监听甚至篡改请求。

因此，就需要对抗这些流氓行为。

首先对于已安装 EasyConnect 的用户，首先需要禁用开机自启。

```bash
sudo rm /Library/LaunchDaemons/com.sangfor.EasyMonitor.plist
sudo rm /Library/LaunchAgents/com.sangfor.ECAgentProxy.plist
```

然后立即重启电脑，然后删除证书：打开「钥匙串访问」-「系统」-「证书」，找到 Sangfor 关键字对证书，右键删除即可。

然后由于 EasyConnect 依赖这两个进程运行，直接启动就用不了了，可考虑两种方案（两种方案将在后续进行验证）：

### 方案一

在 `.zshrc` 中添加：

```bash
startEC() {
    /Applications/EasyConnect.app/Contents/Resources/bin/EasyMonitor > /dev/null 2>&1 &
    /Applications/EasyConnect.app/Contents/MacOS/EasyConnect > /dev/null 2>&1 &
}
fuckEC() {
function killprocess()
{
processname=$1
killall $processname >/dev/null 2>&1
proxypids=$(ps aux | grep -v grep | grep $processname | awk '{print $2}')
for proxypid in $proxypids
do
kill -9 $proxypid
done
}
killprocess svpnservice
killprocess CSClient
killprocess ECAgentProxy
killprocess /Applications/EasyConnect.app/Contents/MacOS/EasyConnect

pkill ECAgent
pkill EasyMonitor

}
```

需要使用时打开终端，执行 `startEC` 即可，用完的时候使用 `fuckEC` 完全停止 EasyConnect。

### 方案二

使用 [docker-easyconnect/docker-easyconnect](https://github.com/docker-easyconnect/docker-easyconnect?ref=sgpublic.xyz) 将 EasyConnect 搭建在软路由或 NAS 上，然后在浏览器中使用 [zero-peak/ZeroOmega](https://github.com/zero-peak/ZeroOmega?ref=sgpublic.xyz) 访问。

此方案将在后续进行验证。