All Projects → albertyw → apple_dep_client

albertyw / apple_dep_client

Licence: AGPL-3.0 license
Apple Device Enrollment Program Client

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to apple dep client

Apns2
⚡ HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, Safari and OSX apps, using the APNs HTTP/2 protocol.
Stars: ✭ 2,569 (+11577.27%)
Mutual labels:  apple
Ipsw
iOS/macOS Research Swiss Army Knife
Stars: ✭ 230 (+945.45%)
Mutual labels:  apple
Swiftui Sliders
🚀 SwiftUI Sliders with custom styles
Stars: ✭ 241 (+995.45%)
Mutual labels:  apple
Doesitarm
🦾 A list of reported app support for Apple Silicon and the new Apple M1 Macs
Stars: ✭ 3,200 (+14445.45%)
Mutual labels:  apple
Wwdc
You don't have the time to watch all the WWDC session videos yourself? No problem me and many contributors extracted the gist for you 🥳
Stars: ✭ 2,561 (+11540.91%)
Mutual labels:  apple
Openradar Mirror
A mirror of radars pulled from http://openradar.me/.
Stars: ✭ 238 (+981.82%)
Mutual labels:  apple
React Native Header View
Fully customizable Header View with multiple design options for React Native.
Stars: ✭ 221 (+904.55%)
Mutual labels:  apple
Nativepopup
Clone of Apple iOS App's feedback popup, and easily customizable.
Stars: ✭ 247 (+1022.73%)
Mutual labels:  apple
Pass Js
Apple Wallet Passes generating library for Node.JS
Stars: ✭ 230 (+945.45%)
Mutual labels:  apple
Musish
Apple Music...ish
Stars: ✭ 2,775 (+12513.64%)
Mutual labels:  apple
Swiftvalidators
String (and more) validation for iOS
Stars: ✭ 226 (+927.27%)
Mutual labels:  apple
Unshaky
A software attempt to address the "double key press" issue on Apple's butterfly keyboard [not actively maintained]
Stars: ✭ 2,711 (+12222.73%)
Mutual labels:  apple
Watusi For Whatsapp
Your all-in-one tweak for WhatsApp Messenger!
Stars: ✭ 240 (+990.91%)
Mutual labels:  apple
Human Interface Guidelines Extras
Community additions to Apple's Human Interface Guidelines
Stars: ✭ 225 (+922.73%)
Mutual labels:  apple
Applereserver
Apple 官方预约监控助手
Stars: ✭ 245 (+1013.64%)
Mutual labels:  apple
Language Manager Ios
Language Manager iOS
Stars: ✭ 222 (+909.09%)
Mutual labels:  apple
Framegrabber
📱iOS app to extract full-resolution video frames as images.
Stars: ✭ 237 (+977.27%)
Mutual labels:  apple
Secureenclavecrypto
Demonstration library for using the Secure Enclave on iOS
Stars: ✭ 251 (+1040.91%)
Mutual labels:  apple
Pyapns2
Python library for interacting with the Apple Push Notification service (APNs) via HTTP/2 protocol
Stars: ✭ 246 (+1018.18%)
Mutual labels:  apple
2017
Student Submissions for the WWDC 2017 Scholarship
Stars: ✭ 240 (+990.91%)
Mutual labels:  apple

Apple Device Enrollment Program Client

Gem Version Build Status Dependency Status Code Climate Test Coverage security

This gem allows for easy interaction with the Apple DEP API.

Installation

Run gem install apple_dep_client or add gem 'apple_dep_client' to your Gemfile then run bundle install.

This gem also also requires OpenSSL to be installed. You can test it by running require 'openssl' in irb and checking that it works.

It is highly recommended that you use a patched version of the plist gem available at https://github.com/albertyw/plist. To do so, you should add gem 'plist', git: 'https://github.com/albertyw/plist', ref: '3.1.2' to your software's Gemfile.

Usage

See Apple's Mobile Device Management Protocol Reference for more information about the high level usage of their DEP Workflow. All commands are under the AppleDEPClient namespace. AppleDEPClient will automatically handle OAuth for DEP endpoints.

Getting DEP Server Tokens

In order for you to read the DEP tokens returned by Apple from a DEP account, you must decrypt it using a private key. This will give the individual keys needed for issuing commands to the DEP devices.

AppleDEPClient.configure do |config|
  config.private_key = 'PRIVATE_KEY'
end
# Get S/MIME encrypted Server Token from Apple
token_data = AppleDEPClient::Token.decode_token(smime_data)
token_data[:consumer_key]
token_data[:consumer_secret]
...

Interacting with DEP endpoints

The main DEP management commands are issued like this. See Apple's MDM Protocol Reference for information about all the commands.

AppleDEPClient.configure do |config|
  config.consumer_key        = token_data[:consumer_key]        # XXX
  config.consumer_secret     = token_data[:consumer_secret]     # XXX
  config.access_token        = token_data[:access_token]        # XXX
  config.access_secret       = token_data[:access_secret]       # XXX
  config.access_token_expiry = token_data[:access_token_expiry] # XXX
end

data = AppleDEPClient::Account.fetch()
data["server_name"]
data["server_uuid"]
data["org_name"]
...

The full list of commands is

AppleDEPClient::Account.fetch
AppleDEPClient::Device.fetch(cursor: nil)
AppleDEPClient::Device.sync(cursor){|device| pass }
AppleDEPClient::Device.details(devices)
AppleDEPClient::Device.disown(devices)
AppleDEPClient::Profile.define(profile_hash)
AppleDEPClient::Profile.assign(profile_uuid, devices)
AppleDEPClient::Profile.fetch(profile_uuid)
AppleDEPClient::Profile.remove(devices)

Device Callbacks

After assigning a DEP profile to a device, the device will hit the url in the profile. The returned data will be "encoded as a XML plist and then CMS-signed and DER-encoded" and can be parsed as below:

data = AppleDEPClient::Callback.decode_callback(request_body)
data["UDID"]
data["SERIAL"]
...

Depsim

There is an example script at example/example.rb which can be run against Apple's DEP simulator. You'll need to download the simulator binary and run it with path/to/depsim start -p 80 example/depsim_config.json. You can then run the script using bundle exec ruby example/example.rb. example.rb can of course be edited to use real DEP keys for manual DEP work (but be careful to keep the keys secret).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].