简体   繁体   English

使用SMJobBless时防止授权弹出窗口

[英]Prevent authorization popup when using SMJobBless

we are developing an application with a Helper Tool - which is installed into the system using SMJobBless. 我们正在使用Helper Tool开发一个应用程序-使用SMJobBless将其安装到系统中。 This works as expected; 这按预期工作; but there is a caveat. 但有一个警告。

We do frequent automatic deployments - sometimes more than one per week. 我们会进行频繁的自动部署-有时每周超过一次。 Everytime the Helper Tool version changes, we re-register it - causing a password prompt. 每当助手工具版本更改时,我们都会重新注册它-导致出现密码提示。 These 2 factors would quickly become irritating to our users. 这两个因素将很快使我们的用户恼火。

Is there a way to have the password prompt appear only once, during the initial Helper Tool installation? 在最初的Helper Tool安装过程中,是否有办法让密码提示仅出现一次? Could subsequent updates happen without a prompt? 可能会在没有提示的情况下进行后续更新吗? Perhaps there is a way to leverage the existing Helper Tool to install a newer version of itself? 也许有一种方法可以利用现有的帮助器工具来安装自身的更新版本?

Short answer: No. SMJobBless() always prompts for admin credentials. 简短答案:否SMJobBless()总是提示输入管理员凭据。 There's no way to stop it from prompting. 无法阻止它提示。 If you call this API, it'll prompt (or fail). 如果调用此API,它将提示(或失败)。


Longer answer on workarounds: 解决方法的更长答案:

If your helper tool is running with admin/root privileges, it could theoretically replace itself with a new version. 如果您的帮助程序工具以admin / root特权运行,则理论上可以用新版本替换自己。 Think very carefully before doing this. 在执行此操作之前,请仔细考虑。 Getting this right and maintaining security is very difficult , and the fact that even the major OSes have had vulnerabilities in installer functionality is a strong indicator that the risks of going this route may outweigh the benefits. 正确地做到这一点并维护安全性是非常困难的 ,而且即使主要的OS都存在安装程序功能 漏洞的事实,也充分说明了采用这种方法的风险可能大于收益。

If you must proceed, read up on: 如果必须继续,请继续阅读以下内容:

You would have to ensure that your helper tool cannot be tricked into replacing itself with (or executing) malicious code, or you will have opened your software up to being a trivial root exploit vector. 您将必须确保您的助手工具不会被诱骗用(或执行)恶意代码替换自身,否则您将把软件开放为琐碎的根漏洞利用程序。

Also note: Regardless of what Apple currently does to verify helper tools installed by SMJobBless , it is conceivable that they could tighten the requirements in the future and refuse to run helper tools that have been modified since they were installed via SMJobBless . 另请注意:不管Apple目前正在做什么,以验证SMJobBless安装的帮助程序工具,可以想象它们将来会收紧要求,并拒绝运行自通过SMJobBless安装以来已修改的帮助程序工具。 The safest method (in multiple respects) is to just call SMJobBless whenever you need to install/update the helper. 最安全的方法(在多个方面)是在需要安装/更新帮助SMJobBless时仅调用SMJobBless

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM