我想在启动时运行pfctl,因为守护程序不起作用(我不知道为什么) 请告诉我如何正确地做到这一点。我试过了:
pfctl_autoload.sh
#!/usr/bin/env bash
sudo pfctl -e -f /etc/pf.conf
/Users/username/Library/LaunchAgents/com.test.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.test.plist/string>
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>-a</string>
<string>Terminal</string>
<string>/Users/username/Desktop/pfctl_autoload.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
终端测试
launchctl load /Users/username/Library/LaunchAgents/com.test.plist
/Users/username/Library/LaunchAgents/com.test.plist: Invalid property list
答案 0 :(得分:0)
从终端你可以做到:
public async Task<IDataOperationResult> UpdateJobAsync(Job job) {
_context.Jobs.Update(job);
try {
await _context.SaveChangesAsync();
return new OperationResult(true);
} catch {
return new OperationResult(false);
}
}
加载默认规则:
sudo pfctl -Fa -f /tmp/your.pf.conf -e
或者更容易就是启用防火墙:
使用以下步骤启用应用程序防火墙: