如何保护每用户 GUI 启动代理免受非管理员用户禁用它的影响?

发布于 2024-07-26 06:36:06 字数 472 浏览 3 评论 0原文

我有一对 launchd 守护进程,其中一个是真正的守护进程(以 root 身份运行),另一个是作为每个 GUI 会话基础运行的 GUI 代理(会话类型 Aqua)。

我需要防止非管理员级别用户使用 launchctl 禁用用户级别代理,或者至少弄清楚如何从根级别守护程序重新加载代理。

到目前为止我发现的最好的文章是这篇,但是它并没有真正提供任何明确的解决方案。

最简单的方法似乎是在根守护程序中定期获取当前控制台用户,然后以该用户身份运行 launchctl load ... ,但我不完全知道如果这可能/我如何会这样做(如果我只是从守护进程运行加载而不冒充用户,它将在根用户下加载,这没有什么好处)。

有任何想法吗?

I have a pair of launchd daemons, one of which is a true daemon (runs as root) and one of which is a GUI agent that runs as a per GUI session basis (session type Aqua).

I need to prevent non admin level users from disabling the user level agent using launchctl, or at the very least figure out how to reload the agent from the root level daemon.

The best article I've found so far is this one, but it doesn't really offer any clear solutions.

The easiest way would seem to be to fetch the current console user periodically in the root daemon and then run launchctl load ... as that user, but I'm not entirely if if that's possible/how I would go about this (if I just run load from the daemon without posing as the user, it will be loaded under the root user, which does no good).

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑饮青盏花 2024-08-02 06:36:06

您可以在 SIGTERM 处理程序中检查授权,请参阅 http://developer .apple.com/mac/library/technotes/tn2002/tn2095.html 用于示例自定义授权检查

you could check for authorization in your SIGTERM handler, see http://developer.apple.com/mac/library/technotes/tn2002/tn2095.html for sample custom authorization check

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文