Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
a8d11f02
D
delve
项目概览
pubx
/
delve
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
delve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a8d11f02
编写于
3月 13, 2017
作者:
J
Justin Clift
提交者:
Derek Parker
3月 13, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bash script to generate & install signing certificate for delve (#760)
上级
b7f9e3c7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
1 deletion
+61
-1
Makefile
Makefile
+2
-1
scripts/gencert.sh
scripts/gencert.sh
+59
-0
未找到文件。
Makefile
浏览文件 @
a8d11f02
...
...
@@ -29,7 +29,8 @@ check-cert:
ifneq
"$(TRAVIS)" "true"
ifdef
DARWIN
ifeq
"$(CERT)" ""
$(
error
You must provide a CERT environment variable
in
order to codesign the binary.
)
scripts/gencert.sh
||
(
echo
"An error occurred when generating and installing a new certicate"
;
exit
1
)
CERT
=
dlv-cert
endif
endif
endif
...
...
scripts/gencert.sh
0 → 100755
浏览文件 @
a8d11f02
#!/bin/bash
# Check if the certificate is already present in the system keychain
security find-certificate
-Z
-p
-c
"dlv-cert"
/Library/Keychains/System.keychain
>
/dev/null 2>&1
EXIT_CODE
=
$?
if
[
$EXIT_CODE
-eq
0
]
;
then
# Certificate has already been generated and installed
exit
0
fi
CERT
=
"dlv-cert"
# Create the certificate template
cat
<<
EOF
>
$CERT
.tmpl
[ req ]
default_bits = 2048 # RSA key size
encrypt_key = no # Protect private key
default_md = sha512 # MD to use
prompt = no # Prompt for DN
distinguished_name = codesign_dn # DN template
[ codesign_dn ]
commonName = "dlv-cert"
[ codesign_reqext ]
keyUsage = critical,digitalSignature
extendedKeyUsage = critical,codeSigning
EOF
# Generate a new certificate
openssl req
-new
-newkey
rsa:2048
-x509
-days
3650
-nodes
-config
$CERT
.tmpl
-extensions
codesign_reqext
-batch
-out
$CERT
.cer
-keyout
$CERT
.key
>
/dev/null 2>&1
EXIT_CODE
=
$?
if
[
$EXIT_CODE
-ne
0
]
;
then
# Something went wrong when generating the certificate
exit
1
fi
# Install the certificate in the system keychain
sudo
security add-trusted-cert
-d
-r
trustRoot
-k
/Library/Keychains/System.keychain
$CERT
.cer
>
/dev/null 2>&1
EXIT_CODE
=
$?
if
[
$EXIT_CODE
-ne
0
]
;
then
# Something went wrong when installing the certificate
exit
1
fi
# Install the key for the certificate in the system keychain
sudo
security import
$CERT
.key
-A
-k
/Library/Keychains/System.keychain
>
/dev/null 2>&1
EXIT_CODE
=
$?
if
[
$EXIT_CODE
-ne
0
]
;
then
# Something went wrong when installing the key
exit
1
fi
# Kill task_for_pid access control daemon
sudo
pkill
-f
/usr/libexec/taskgated
>
/dev/null 2>&1
# Remove generated files
rm
$CERT
.tmpl
$CERT
.cer
$CERT
.key
>
/dev/null 2>&1
# Exit indicating the certificate is now generated and installed
exit
0
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录