-
Notifications
You must be signed in to change notification settings - Fork 2
Setting Up a MicroMDM Instance
- Download the latest zip from the micromdm GitHub repo Here
- Unzip the file.
- Move the appropriate binaries to /usr/local/bin
cp ~/Downloads/build/darwin/mdmctl /usr/local/bin
cp ~/Downloads/build/darwin/micromdm /usr/local/bin
The ngrok tool is used to create a secure tunnel to your test machine, so mdm clients can interact with your test server without having to set up all the DNS and Firewall rules.
- Download the latest zip from ngrok using Step 1 Here
- Unzip the file as described on Step 2 of the ngrok download page.
- Move the binary to /usr/local/bin
cp ~/Downloads/ngrok /usr/local/bin - Create and connect an account using Step 3 on the ngrok download page. (without "./" at the beginning of the command)
- Start ngrok in its own Terminal Window
ngrok http 8080
We use "8080" for our test setup because we will be starting our test micromdm instance without tls. - Open the ngrok Web Interface on the client running ngrok at this url:
http://127.0.0.1:4040
The following steps are listed in more detail in the micromdm GitHub Quickstart. For the purposes of the GusDay presentation, simplified directions are posted below.
The mdmctl tool acts as a command line interface to micromdm. We will use it to set up and configure your micromdm instance. For help using the mdmctl tool mdmctl with the "-h" option.
-
Configure mdmctl to connect to your micromdm instance through the ngrok tunnel.
mdmctl config set -api-token SUPER_SECRET_TOKEN -name UNIQUE_NAME -server-url NGROK_URLSUPER_SECRET_TOKENis a strong password that will be used to send all interface calls to your micromdm server instance.
UNIQUE_NAMEis any name to identify your server in the mdmctl config.
NGROK_URLis the url presented when starting ngrok. -
Set the newly configured server item as active in mdmctl.
mdmctl config switch -name UNIQUE_NAMEUse the
UNIQUE_NAMEvalue that you entered in the previous command.
-
Create a folder to serve as a file repo location
mkdir -p /Users/USERNAME/Documents/micromdm/filerepoUSERNAMEis your local account username
The repo can go anywhere else as well (ex. /opt/micromdm/filerepo) -
Start micromdm in its own Terminal Window
sudo micromdm serve -server-url=NGROK_URL -api-key SUPER_SECRET_TOKEN -filerepo /Users/USERNAME/Documents/micromdm/filerepo -tls=falseSUPER_SECRET_TOKENis the same value that you used when configuring mdmctl.
NGROK_URLis the same url that you used when configuring mdmctl.
Every Apple MDM instance needs a push certificate to communicate with clients. You can get a free push certificate for your organization using the steps below. Described in more detail HERE.
-
Register for a mdmcert.download account HERE
-
Verify your email address using the verification email sent to you.
-
Create a new request using mdmctl
mdmctl mdmcert.download -new -email=your-email@example.org
Replace the "-email" parameter value with the email you used to register in Step 1. -
In a few minutes, you will get an email with a signed request attachment. Download the attachment.
-
Decrypt the signed request using mdmctl
cd ~/Documents/micromdm
mdmctl mdmcert.download -decrypt=~/Downloads/YOUR_ATTACHMENT.p7YOUR_ATTACHMENTrefers to the file that you downloaded in the last step. -
A file called
mdmcert.download.push.reqis generated in the current working directory. Upload the file to https://identity.apple.com by using the green 'Create a Certificate' button at top right. You will then be able to download an actual Push Certificate! The filename will be similar toMDM_ McMurtrie Consulting LLC_Certificate.pem(note the accompanying private key will be inmdmcert.download.push.key. -
Upload the certificate to micromdm using mdmctl
mdmctl mdmcert upload -cert="~/Downloads/MDM_ McMurtrie Consulting LLC_Certificate.pem" -private-key=~/Documents/micromdm/mdmcert.download.push.key
To connect your micromdm instance to DEP, follow these steps. Described in more detail HERE
-
Extract the public key which you will need to upload, using mdmctl
mdmctl get dep-tokens -export-public-key ~/Documents/micromdm/DEP_Public_key.pem -
Go to the DEP portal and create a "MDM Server" (as its called in the DEP portal) record. You will be prompted to upload the
DEP_Public_key.pemfile. Once you successfully create the server, you'll be offered a new download - a file ending .p7m. This files contains the encrypted DEP tokens. -
Import the downloaded p7m file using mdmctl
mdmctl apply dep-tokens -import ~/Downloads/MY_DEP_TOKEN.p7mMY_DEP_TOKENrefers to the file you downloaded in Step 2.
To continue your micromdm setup go to Configuring a MicroMDM Imaging Setup