Open4

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

Yusuke IwakiYusuke Iwaki

https://support.apple.com/ja-jp/guide/apple-school-manager/axm200a54d59/web

Apple ConfiguratorでiPhoneをとあるApple School Managerの管理下に置く。

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

Yusuke IwakiYusuke Iwaki

https://developer.apple.com/documentation/devicemanagement/implementing_device_management/simplifying_mdm_server_administration_for_ios_devices

にあるように、

  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

再度トライ...

いけたいけた

Yusuke IwakiYusuke Iwaki

https://developer.apple.com/documentation/devicemanagement/get_a_list_of_devices

でデバイスを取得してみると...

=> {"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"}

出てきた。