mobile device management (MDM)

Sito di riferimento: https://h-mdm.com/

Installazione server

ubuntu@h-mdm:~$ sudo apt update ubuntu@h-mdm:~$ sudo apt install openjdk-8-jdk aapt tomcat8 postgresql ubuntu@h-mdm:~$ sudo apt install unzip ubuntu@h-mdm:~$ wget https://h-mdm.com/files/hmdm-3.30-install-ubuntu.zip ubuntu@h-mdm:~$ unzip hmdm-3.30-install-ubuntu.zip

Preparazione database

# su - postgres
$ psql
postgres=# CREATE USER hmdm WITH PASSWORD 'password';
postgres=# CREATE DATABASE hmdm WITH OWNER=hmdm;
postgres=# \q

check database

# Bisogna specificare -h localhost, altrimenti effettua
# una peer authentication, che fallisce perché non esiste
# hmdm negli utenti di sistema
psql -U hmdm -W -h localhost

Installazione

ubuntu@h-mdm:~/hmdm-install$ sudo ./hmdm_install.sh
Please choose the installation language (en/ru) [en]: en
PostgreSQL database setup
=========================
Make sure you've installed PostgreSQL and created the database:
# CREATE USER hmdm WITH PASSWORD 'topsecret';
# CREATE DATABASE hmdm WITH OWNER=hmdm;
PostgreSQL host [localhost]: localhost
PostgreSQL port [5432]: 5432
PostgreSQL database [hmdm]: hmdm
PostgreSQL user [hmdm]: hmdm
PostgreSQL password: password
File storage setup
==================
Please choose where the files uploaded to Headwind MDM will be stored
If the directory doesn't exist, it will be created
##### FOR TOMCAT 9, USE SANDBOXED DIR: /var/lib/tomcat9/work #####
Headwind MDM directory [/opt/hmdm]: /opt/hmdm
Web application setup
=====================
Headwind MDM requires access from Internet
Please assign a public domain name to this server
Protocol (http|https) [http]: http
Domain name or public IP (e.g. example.com): mdm.csgalileo.org
Port (leave empty for default ports 80 or 443): 8080
Project path on server or ROOT [/hmdm]: /hmdm
Tomcat virtual host [localhost]: localhost
Ready to install!
Location on server: /opt/hmdm
URL: http://mdm.csgalileo.org:8080/hmdm
Is this information correct [Y/n]? Y
Tomcat config file created: /var/lib/tomcat8/conf/Catalina/localhost//hmdm.xml
Deploying hmdm-3.30.1-os.war to Tomcat: /var/lib/tomcat8/webapps//hmdm.war
............................
Deployment successful, initializing the database...
======================================
Headwind MDM has been installed!
To continue, open in your web browser:
http://mdm.csgalileo.org:8080/hmdm
Login: admin:admin

Entrato ho cambiato la password di admin in Euro…

Il pushing dei messaggi (se si seleziona MQTT) ha bisogno della porta 31000 (TCP) aperta. Inoltre, dietro NAT, modificare /etc/hosts

IP_PRIVATO mdm.csgalileo.org

Per verifica, controllare i log dopo il riavvio di tomcat: se non compare qualcosa come

2020-12-03 09:27:02 [ERROR] com.hmdm.notification.guice.module.NotificationMqttTaskModule : Failed to create MQTT broker service
java.io.IOException: Failed to bind to server socket: mqtt://94.230.76.87:31000 due to: java.net.BindException: Cannot assign requested address (Bind failed)

l'MQTT è impostato correttamente. Ad ogni modo la configurazione di questo bind è in /var/lib/tomcat8/conf/Catalina/localhost/hmdm.xml

<!-- MQTT notification service parameters --> <Parameter name="mqtt.server.uri" value="mdm.csgalileo.org:31000"/>

Client

Entrato nel telefono senza registrarsi a google o altro account. Aperto chrome e andato su https://h-mdm.com/download/

Scaricato l'apk Android application (launcher)

seguito istruzioni in https://h-mdm.com/quick-start/

Come server Url ho dato http://94.230.76.87:8080/hmdm

Quando ho finito ho cliccato du home (O) e mi ha chiesto se volevo confermare mdm come launche.

Dopo di che il pallino verde è apparso