Add more details for OSX code signing

This commit is contained in:
pancake 2015-07-23 03:34:46 +02:00
parent d21a2c92d6
commit 0639261e26
5 changed files with 47 additions and 14 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
@ -12,9 +12,10 @@
<string>radare2</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>SecTaskAccess</key>
<array>
<key>SecTaskAccess</key>
<array>
<string>allowed</string>
<string>safe</string>
</array>
</dict>
</plist>

View file

@ -26,10 +26,16 @@ ios_sdk_sign:
-codesign -s- --entitlements radare2.xml radare2
osx-sign osxsign:
rm -f radare2
${CC} radare2.c ${CFLAGS} ${LDFLAGS} -o radare2 \
-sectcreate __TEXT __info_plist ./Info.plist
xcrun --sdk $(MACSDK) codesign -f -s ${CERTID} radare2
#codesign -f -s ${CERTID} radare2
-sectcreate __TEXT __info_plist Info.plist \
-framework Security -framework CoreFoundation
#xcrun --sdk $(MACSDK) codesign -f -s ${CERTID} radare2
codesign -dvvv --deep -f -s ${CERTID} -i ${BUNDLE} radare2
#sudo chown root:_developer radare2
# sudo chown root:procmod radare2
#sudo chmod g+s radare2
# sudo chmod 4755 radare2
osx-sign-libs:
for a in ${SIGN_LIBS} ; do \

View file

@ -82,6 +82,35 @@ Follow those steps to fix this issue:
And run `codesign -dv` and `spctl -av` to confirm.
Troubleshooting
---------------
Make sure that taskgated runs with -p by editing `com.apple.taskgated.plist`:
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/taskgated</string>
<string>-p</string>
<string>-s</string>
</array>
Then run those lines:
launchctl unload /System/Library/LaunchDaemons/com.apple.taskgated.plist
sudo vim /System/Library/LaunchDaemons/com.apple.taskgated.plist
launchctl load /System/Library/LaunchDaemons/com.apple.taskgated.plist
To root your certificate read the following instructions:
https://llvm.org/svn/llvm-project/lldb/trunk/docs/code-signing.txt
sudo security add-trust -d -r trustRoot \
-p basic -p codeSign \
-k /Library/Keychains/System.keychain \
~/Desktop/org.radare.radare2.cer
And then reboot!
Packaging
---------

View file

@ -320,13 +320,8 @@ task_t pid_to_task(int pid) {
eprintf ("Failed to get task %d for pid %d.\n", (int)task, (int)pid);
eprintf ("Reason: 0x%x: %s\n", err, (char *)MACH_ERROR_STRING (err));
eprintf ("You probably need to run as root or sign the binary.\n"
#if __IPHONE_2_0
" Read doc/ios.md\n"
" make -C binr/radare2 ios-sign\n");
#else
" Read doc/osx.md\n"
" make -C binr/radare2 osx-sign\n");
#endif
" Read doc/ios.md || doc/osx.md\n"
" make -C binr/radare2 ios-sign || osx-sign\n");
return -1;
}
old_pid = pid;

View file

@ -49,10 +49,12 @@ static task_t pid_to_task(int pid) {
int err = task_for_pid (mach_task_self (), (pid_t)pid, &task);
if ((err != KERN_SUCCESS) || !MACH_PORT_VALID (task)) {
eprintf ("Failed to get task %d for pid %d.\n", (int)task, (int)pid);
eprintf ("Reason: 0x%x: %s\n", err, MACH_ERROR_STRING (err));
eprintf ("Missing priviledges? 0x%x: %s\n", err, MACH_ERROR_STRING (err));
#if 0
eprintf ("You probably need to add user to procmod group.\n"
" Or chmod g+s radare && chown root:procmod radare\n");
eprintf ("FMI: http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/taskgated.8.html\n");
#endif
return -1;
}
return task;