Open4
Apple School Managerの相手ができるサーバーを作るときのメモ

Apple ConfiguratorでiPhoneをとあるApple School Managerの管理下に置く。
- MDMサーバーと管理組織は、適当にngrokで立ててるやつを指定。
- SIM入れてないデバイスではWiFiプロファイルの指定は必須(MDM構成プロファイルのダウンロードができず、途中でエラーになる)
- MDMサーバーのUser/Passは、適当に
user
password!
を指定

現れた。
はいこんにちは
MDMサーバーにアクセスが飛んできた!

にあるように、
get '/MDMServiceConfig' do
verbose_print_request
content_type 'application/json'
{
dep_enrollment_url: "#{ENV['MDM_SERVER_BASE_URL']}/mdm/dep_enroll",
dep_anchor_certs_url: "#{ENV['MDM_SERVER_BASE_URL']}/mdm/dep_anchor_certs",
}.to_json
end
post '/mdm/dep_enroll' do
verbose_print_request
require 'pry'
binding.pry
end
get '/mdm/dep_anchor_certs' do
verbose_print_request
content_type 'application/json'
'[]'
end
適当にこんな実装にしていたわけだが、
DEP関係なくApple Configurator経由で構成プロファイルをダウンロードするルートに流せばよかったようだ...
post '/mdm/dep_enroll' do
verbose_print_request
content_type 'application/x-apple-aspen-config'
rb :'mdm.mobileconfig'
end
再度トライ...
いけたいけた

でデバイスを取得してみると...
=> {"devices"=>
[{"serial_number"=>"FFN........Q",
"description"=>"IPHONE SE BLACK 64GB-JPN",
"model"=>"iPhone SE",
"os"=>"iOS",
"device_family"=>"iPhone",
"color"=>"BLACK",
"profile_status"=>"empty",
"device_assigned_by"=>"iwaki@xxxxxxx.com",
"device_assigned_date"=>"2024-01-25T14:42:30Z"}],
"fetched_until"=>"2024-01-25T14:43:29Z",
"more_to_follow"=>false,
"cursor"=>"MDo......0MTc"}
出てきた。