UI: Add automatic EnrollMdm modal (#9455)

# Addresses #9365 

# Implements
MDM enrollment modal that handles both automatic and manual enrollment
instructions:
- Automatic:
<img width="1181" alt="Screenshot 2023-01-20 at 4 33 50 PM"
src="https://user-images.githubusercontent.com/61553566/213829293-6d4a5053-9a3c-4f52-8cf8-a6607dc8df4e.png">
- Manual:

<img width="1158" alt="Screenshot 2023-01-20 at 4 35 04 PM"
src="https://user-images.githubusercontent.com/61553566/213829369-73ae779d-14a8-4aa7-9c6a-b97d046d0dc1.png">

- Also includes (by mistake, but might as well include them now) some
small bash scripts for use in MDM development
# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/` 
- [x] Updated testing inventory
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
Jacob Shandling
2023-01-30 11:44:33 -08:00
committed by GitHub
co-authored by Jacob Shandling
parent d3565dc032
commit 60712144f2
12 changed files with 158 additions and 46 deletions
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# experimental doesn't always work right
docker compose exec mysql mysql -uroot -ptoor -Dfleet -e "DELETE FROM host_device_auth WHERE host_id=$1;"
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
docker compose exec mysql mysql -uroot -ptoor -Dfleet -e "SELECT host_id, token FROM host_device_auth;"
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
# experimental doesn't always work right
NEW_ID=$1
NEW_TOKEN=$2
docker compose exec mysql mysql -uroot -ptoor -Dfleet -e "INSERT INTO host_device_auth VALUES ($NEW_ID, $NEW_TOKEN, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);"
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# To toggle MDM, run `source toggle-mdm-dev`
# Requires the env at $FLEET_ENV_PATH to contain logic something like:
# if [[ $USE_MDM == "1" ]]; then
# # for UI dev:
# export FLEET_DEV_MDM_ENABLED=1
# # for MDM server
# export FLEET_MDM_APPLE_ENABLE=1
# export FLEET_MDM_APPLE_SCEP_CHALLENGE=scepchallenge
# MDM_PATH={PATH_TO_YOUR_MDM_RELATED_KEYS_AND_CERTS}
# export FLEET_MDM_APPLE_SCEP_CERT=$MDM_PATH"fleet-mdm-apple-scep.crt"
# export FLEET_MDM_APPLE_SCEP_KEY=$MDM_PATH"fleet-mdm-apple-scep.key"
# export FLEET_MDM_APPLE_BM_SERVER_TOKEN=$MDM_PATH"downloadtoken.p7m"
# export FLEET_MDM_APPLE_BM_CERT=$MDM_PATH"fleet-apple-mdm-bm-public-key.crt"
# export FLEET_MDM_APPLE_BM_KEY=$MDM_PATH"fleet-apple-mdm-bm-private.key"
# #below files are from the shared Fleet 1Password
# export FLEET_MDM_APPLE_APNS_CERT=$MDM_PATH"mdmcert.download.push.pem"
# export FLEET_MDM_APPLE_APNS_KEY=$MDM_PATH"mdmcert.download.push.key"
# else
# unset FLEET_DEV_MDM_ENABLED
# unset FLEET_MDM_APPLE_ENABLE
# unset FLEET_MDM_APPLE_SCEP_CHALLENGE
# unset FLEET_MDM_APPLE_SCEP_CERT
# unset FLEET_MDM_APPLE_SCEP_KEY
# unset FLEET_MDM_APPLE_BM_SERVER_TOKEN
# unset FLEET_MDM_APPLE_BM_CERT
# unset FLEET_MDM_APPLE_BM_KEY
# #below files are from the shared Fleet 1Password
# unset FLEET_MDM_APPLE_APNS_CERT
# unset FLEET_MDM_APPLE_APNS_KEY
# fi
if [[ $USE_MDM == "1" ]]; then
export USE_MDM=0
else
export USE_MDM=1
fi
source $FLEET_ENV_PATH