MDM中描述文件的创建

  1. 生成脚本
#!/bin/sh

hostname="example.com"
echo ""
echo "1. Using the hostname of $hostname"
echo ""

echo ""
echo "2. Creating the private key and certificate request"
echo " ** Please enter your information **"
echo ""
if [ ! -f $hostname.key ]; then
  openssl ecparam -genkey -name secp384r1 | openssl ec -out $hostname.key
  openssl req -new -sha256 -key $hostname.key -nodes -out $hostname.csr -outform pem
fi

echo ""
echo "3. Creating the certificate with the CA. You'll use the PEM pass phrase from step 2."
echo ""
certbot certonly --csr $hostname.csr --manual --preferred-challenges http --server https://acme-v02.api.letsencrypt.org/directory
cp 0001_chain.pem $hostname.crt

echo ""
echo "4. Signing the identity key with the CA. You'll the PEM pass phrase from step 2."
echo " ** Create an export passphrase. You'll need to include it in the IPCU profile."
echo ""
openssl x509 -req -days 365 -in $hostname.csr -CA $hostname.crt -CAkey $hostname.key -CAcreateserial -out identity.crt
openssl pkcs12 -export -out identity.p12 -inkey $hostname.key -in $hostname.crt -certfile $hostname.crt

cp $hostname.crt $hostname.pem

2. 说明

上述步骤生成了一系列的文件,其中
$hostname.key, $hostname.p12一般用于nginx的服务器配置中
$hostname.crt, identity.p12 一般用于MDM的mobileconfig配置中,同时需要修改AccessRights中的IdentityCertificateUUID为identity.p12的uuid,否则会提示证书不正确

3.创建 Enroll.mobileconfig
打开Apple Configurator 2,单击菜单栏中的文件选项,然后单击新建配置文件。
在 General 类别中,选择一个名称来标识证书。对于标识符,请使用com.apple.mgmt.External.[uuid]
这里的uuid是mdm生成证书的topic的uuid,名字要一致

在证书类别中,单击配置并找到您identity.p12。对于密码,我们使用 PEM 密码或导出密码。此外,添加的$hostname.crt, identity.p12, Apple Root CAApple Worldwide Developer Relations CA - G2Apple Worldwide Developer Relations Certification Authority证书。您可以从Apple 网站下载这些证书因此,在这里您需要添加总共 5 个证书。
现在,将此移动配置保存为Enroll.mobileconfig

关于Zeno Chen

本人涉及的领域较多,杂而不精 程序设计语言: Perl, Java, PHP, Python; 数据库系统: MySQL,Oracle; 偶尔做做电路板的开发,主攻STM32单片机
此条目发表在Objective-C分类目录。将固定链接加入收藏夹。