【问题标题】:How to understand remote kernel extension code signing?如何理解远程内核扩展代码签名?
【发布时间】:2018-05-10 23:35:01
【问题描述】:

内核扩展签名比签署用户空间可执行文件更复杂。苹果给我发了一个 kext 签名证书。当我从 Xcode GUI 或使用 xcodebuild 构建时,它可以工作。

阅读 The Fine Manual 可以让我到达我想去的地方,但是每当我尝试签下我的司机时,我的头就晕了。

我正在为我的客户配置一个远程构建框。除了代码签名之外,我已经完成了所有工作。如果我登录到 GUI 然后运行我的“build_all”脚本,codesign 会显示一个提示输入密码的 GUI。如果我 ssh 进入,codesign 将失败。

我认为我要做的是:

$ security unlock-keychain ...
$ codesign ...
$ security lock-keychain ...

我可以弄清楚如何锁定和解锁我的钥匙链;让我困惑的是代码设计命令行。

这是 xcodebuild 的作用:

/usr/bin/codesign --force --sign 84208E9C30B70E303186BAF330554E82E1891492 --requirements =designated\ =>\ anchor\ apple\ generic\ \ and\ identifier\ \"$self.identifier\"\ and\ ((cert\ leaf[field.1.2.840.113635.100.6.1.9]\ exists)\ or\ (\ certificate\ 1[field.1.2.840.113635.100.6.2.6]\ exists\ and\ certificate\ leaf[field.1.2.840.113635.100.6.1.13]\ exists\ \ and\ certificate\ leaf[subject.OU]\ =\ \"444JK52Q93\"\ )) --timestamp=none /Users/build/BuildBox/FL2000/trunk/IOProxyVideoFamily/Release/IOProxyFramebuffer.kext

我试图复制上面的命令行,然后将其粘贴到终端,但是太多的括号导致命令失败:

Command-C
Command-V
-bash: syntax error near unexpected token `('

也许我只需要在 codesign 的命令行中添加一些引号或反斜杠。

【问题讨论】:

    标签: xcode driver code-signing keychain kernel-extension


    【解决方案1】:

    您在要求字符串周围缺少"

    改成:

    /usr/bin/codesign --force --sign 84208E9C30B70E303186BAF330554E82E1891492 --requirements "=designated => anchor apple generic  and identifier \"$self.identifier\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists  and certificate leaf[subject.OU] = \"444JK52Q93\" ))"--timestamp=none /Users/build/BuildBox/FL2000/trunk/IOProxyVideoFamily/Release/IOProxyFramebuffer.kext
    

    【讨论】:

    • 你是我的 Shell 脚本大师。我接受了你的回答。
    • 我们可以换行并在其中添加一些 \ 吗? :-)
    • 这有点难,因为你想要包装的是实际引用的字符串,它不应该有换行符......
    猜你喜欢
    • 1970-01-01
    • 2014-12-30
    • 1970-01-01
    • 2011-04-22
    • 1970-01-01
    • 2018-04-26
    • 2021-03-20
    • 1970-01-01
    • 2012-09-01
    相关资源
    最近更新 更多