Nextcloud Mobile device management (MDM) integration

Continuing the discussion from Xperia 10 III stolen:

The idea is to create a Nextcloud app, acting as a Sailfish OS MDM backend. Allowing the user / nextcloud admin to

  • See all of its managed devices with IMEI, software version / update status and if enabled by the user or MDM profile the location of the device
  • Provise nextcloud account, calender and contacts sync and nextcloud backup target to the Sailfish device
  • Do additional provisions
  • Select apps to be installed
  • ā€¦

Minimal Viable Product to test the setup:

  • Nextcloud app, allowing to register managed devices and see their system info incl. software version / update status
  • Sailfish app, running as a MDM daemon and allowing to configure the connection to the nextcloud MDM backend

What do you think?

11 Likes

I have created a first nextcloud backend: GitHub - engsas/nextcloud-sfos-mdm: Nextcloud backend for Sailfish OS MDM app

The GUI is still broken, but the API is working for the MDM SysInfo scope. The endpoints are:

  • GET index.php/apps/sailfishmdm/api/0.1/sysinfos: Getting all sysinfo datasets
  • POST index.php/apps/sailfishmdm/api/0.1/sysinfos: Creating new sysinfo dataset
  • PUT index.php/apps/sailfishmdm/api/0.1/sysinfos/{ID}: Update an existing sysinfo dataset
  • DELETE index.php/apps/sailfishmdm/api/0.1/sysinfos/{ID}: Delete existing sysinfo dataset

For PUT and POST requests the sysinfo dataset needs to be the payload. It should look like this (just a copy of the MDM content):

{
  "bluetoothMacAddress": "BluetoothMacAddress",
  "deviceModel": "Test Model",
  "deviceUid": "Test Device Uid",
  "manufacturer": "Test Manufacturer",
  "productName": "Test Product Name",
  "softwareVersion": "Test Software Version",
  "softwareVersionId": "Test Software Version ID",
  "wlanMacAddress": "Test WLAN Mac Address"
}

With this curl commands you can test the API running in the standard nextcloud docker development environment (just copy the whole sailfishmdm folder from the git repo into workspace/server/apps-extra):

curl -i -X POST -H 'Content-Type: application/json' -d '{"bluetoothMacAddress": "BluetoothMacAddress", "deviceModel": "Test Model", "deviceUid": "Test Device Uid", "manufacturer": "Test Manufacturer", "productName": "Test Product Name", "softwareVersion": "Test Software Version", "softwareVersionId": "Test Software Version ID", "wlanMacAddress": "Test WLAN Mac Address" }' -u admin:admin http://nextcloud.local/index.php/apps/sailfishmdm/api/0.1/sysinfos

curl -u admin:admin http://nextcloud.local/index.php/apps/sailfishmdm/api/0.1/sysinfos


curl -i -X PUT -H 'Content-Type: application/json' -d '{"bluetoothMacAddress": "New BluetoothMacAddress", "deviceModel": "Test Model", "deviceUid": "Test Device Uid", "manufacturer": "Test Manufacturer", "productName": "Test Product Name", "softwareVersion": "Test Software Version", "softwareVersionId": "New Test Software Version ID", "wlanMacAddress": "Test WLAN Mac Address" }' -u admin:admin http://nextcloud.local/index.php/apps/sailfishmdm/api/0.1/sysinfos/1

curl -u admin:admin -X DELETE http://nextcloud.local/index.php/apps/sailfishmdm/api/0.1/sysinfos/1

Since Iā€™m still waiting for SFOS on Xperia 10 V, I can not really develop the app part for Sailfish right now. But anyone who wants to start is warmly welcomed.

The idea is, to extend the nextcloud backend API step by step with a new set of endpoints for each MDM class.

Any suggestions and improvements are welcome!

9 Likes