micromdm / nanomdm

NanoMDM is a minimalist Apple MDM server and library heavily inspired by MicroMDM
MIT License
232 stars 47 forks source link

Issue when configuring storage option MySQL for NanoMDM #82

Closed WolfsParadise5 closed 1 year ago

WolfsParadise5 commented 1 year ago

Following is an error occured on Ubuntu Server 22.04LTS and also on MacOS Ventura 13.2.1 with their respective os-specific versions of NanoMDM(both on amd64 platforms) while configuring runtime with an external SQL Server.

Command output: -bash: syntax error near unexpected token('`

Normal workarounds to this leads to the following error as follows:

Command output: flag provided but not defined: -storage-dsn

korylprince commented 1 year ago

Enclosing in single quotes should work:

./nanomdm-linux-amd64 -ca ../../CertificateChain/ca.pem -api api_key -storage mysql -storage-dsn 'user:password@tcp(db.ip.address:port)/mdm'

Using single quotes passes the argument as-is.

WolfsParadise5 commented 1 year ago

The utilisation of single quotes has resulted to the same error as before

Command Output : flag provided but not defined: -storage-dsn

I have also tested another way of input and the same issue arises

Command test Input : ./nanomdm-linux-amd64-v0.5.0/nanomdm-linux-amd64 -ca ../../CertificateChain/ca.pem -api api_key -storage mysql -storage-dsn='user:password@tcp(db.ip.address:port)/mdm'

Command Output : flag provided but not defined: -storage-dsn

korylprince commented 1 year ago

Eh, sorry, I misread the original error. The current tagged release (v0.5.0) still uses -dsn, not -storage-dsn. The flag was changed to -storage-dsn after v0.5.0.

jessepeterson commented 1 year ago

Ah, good catch Kory. Yes, the flag name changed.

fwiw this is documented in the ops guide. perhaps we can make that more visible.

or I just need to get on top of a newer release. :)

WolfsParadise5 commented 1 year ago

My apologies for the late reply but thanks for the clarification. Command works now on v0.5 with -dsn

To be frank would be preferable to make it clear in the example explaining the usage of mysql if a newer version is not out yet since it may get a little confusing :)