This Django project provides a custom webapp interface to microMDM service (https://github.com/micromdm/micromdm). It handles adding and removing records in .json record file, applying configuration and generally running a couple of defined commands.
- Linux host (preffered)
- Python 3.0+ and its Django library
- Micromdm json located in /PATH/TO/YOUR/DEP-Profile.json
- Path to mdmctl .json.
- MDMCTL_JSON = os.path.join(BASE_DIR, '/PATH/TO/YOUR/DEP-Profile.json')
- Database file located in /var/db/deptool/database.sqllite3 or /PATH/TO/YOUR/database.sqllite3
-
Clone the
DEPTool
Git repository:$ git clone https://github.com/trekkim/DEPTool.git $ cd DEPTool
-
Make sure you have .json record file in /PATH/TO/YOUR/DEP-Profile.json.
-
Create a Python virtual environment for
DEPTool
.$ python3 -m venv venv
-
Install Django library.
$ source venv/bin/activate $ pip3 install django
-
Create database. Make sure path /var/db/deptool exists.
$ python3 manage.py makemigrations $ python3 manage.py migrate $ python3 manage.py createsuperuser
-
You should be able to run the tool.
$ python3 manage.py runserver 0.0.0.0:8080
-
If you need to deploy it on Apache server you can follow:
-
Edit username in run_as_munkiadmin.sh
-
Edit env file
-
For quick testing .json and .db is in configs/ preloaded & test user: test pwd: test
Currently it is implemented in way that api calls are directed to /modular url. There is an "method" POST paramd which defines method which will be run on the server. If you need to add new button running command similiar to systemctl or journactl you just need to following actions:
- Add new form to DEP/templates/DEP/main.html.
<form action="/modular" method="POST" class="modular_form" id='NEW_METHOD_NAME'> <input type="submit" value="anything" class="login100-form-btn"> </form>
- Add new record to modular_list in DEP/views.py.
modular_list = [ {"method": "journalctl_micromdm_service", "command": "journalctl -u micromdm.service -n 100 --no-pager", "expected_result": "Logs begin at"}, {"method": "systemctl_status_micromdm_service", "command": "systemctl status micromdm.service --no-pager", "expected_result": "micromdm.service - MicroMDM MDM Server"}, {"method": "NEW_METHOD_NAME", "command": "ls -la /home/munki_admin", "expected_result": ".bashrc"}, ]
There are two levels of users. If you are superuser (set in Django admin site), you can see and do everything. If you are just regular staff user (set in Django admin site), you have limited view and actions you can do.
- If you are using Apache maybe will help if error 500 appear
$ chown -R www-data:www-data DEP_tool/
- Add & Remove Device
- Show Devices
- Apply Chnages (mdmctl apply dep-profiles -f /PATH/TO/YOUR/JSON)
- Service Status - ServerName| Active | Inactive | last restart
- First Api - Sync Dep Devices
- Dasboard (in progress)
so many parts :-(