Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
3.66k stars 510 forks source link

Customized macOS Agents? #6151

Open PetieM opened 4 weeks ago

PetieM commented 4 weeks ago

Describe the bug It seems that at some point quite recently, the agent customization settings have started applying to Mac agents which would be great except they also seem to be causing the install to fail. A few months back, I installed my customized agent on my freshly reinstalled Mac and it worked perfectly and installed with the usual meshagent_etc name as it always has (so no customization but it did work). Just today, I tried to install on a different Mac (not freshly installed but it had never had any MeshCentral software on it before) and while the installer confirms that it completed successfully and the path under /usr/local/mesh_serves was created correctly and with my customized company name, it did not create the agent executable or any of the supporting files (.msh, .db, etc.).

I suspect, but can't confirm, that this has something to do with there being spaces in my company's name as when I ran the uninstaller, it failed on a bunch of lines due to unescaped spaces being present. If I had to guess, the initial path is being set correctly with escaped spaces but somewhere else during the install, the spaces are being left in the open and the commands are failing.

Not sure what specific details are needed but I'll say that the server is running the latest version (1.1.24) on Debian 11 and the client machine was an older Intel-based Mac running macOS 12.4. I'm happy to provide any additional details needed - just let me know. Thanks!

To Reproduce Steps to reproduce the behavior:

  1. Download the Mac installer for a customized agent.
  2. Run installer and check contents of mesh_services folder.

Expected behavior Installer would finish, mesh_services folder would be populated with custom path and agent software, .msh, .db, etc files.

Screenshots N/A

Server Software (please complete the following information):

Client Device (please complete the following information):

Remote Device (please complete the following information):

Additional context N/A

Your config.json file

Attached in reply below
si458 commented 4 weeks ago

!!! please in the future follow the bug template report, otherwise your issue will be closed as not planned/fixed !!!

can you share your config.json?

did you use the mpkg install method of the binary line with-install method?

i did do a LOAD of mac installer changes a month or so ago to help fix the customisation, it might be ive missed a few things.

PetieM commented 4 weeks ago

Sorry, I typically would have done the full template but I was on mobile and just trying to get everything out while it was fresh in my mind. config.json is attached and I used the mpkg installer. I was actually having trouble downloading the binary file at all, receiving just a text file with Unauthorized in it though I don't think I have anything locked down (though I did try enabling the lockAgentDownload option and setting it to false as well) so I'm not sure why that would be.

config.json

si458 commented 4 weeks ago

yes enabling lockAgentDownload will stop scripts from working When enabled, MeshCentral will block all downloads of MeshAgent including install scripts

PetieM commented 4 weeks ago

Is it on by default then? It didn’t work when manually disabling it either but I did just see that it’s in two locations so maybe I disabled the wrong one.

Also, just to be clear about the uninstaller part of the report, I ran the uninstaller file found when right clicking and choosing show package contents. That’s where I saw the errors that showed the rm commands were failing because of the spaces in the path.

si458 commented 4 weeks ago

No defo turned off? Will double check it tomorrow incase a bug has appeared

Also yes DO NOT USE SPACES IN NAMES when customising It is best to use underscore or dashes

I have a feeling the is a bug with the install/uninstall when u use spaces, so I will double check again 2moz for u

Thank u for reporting tho!

PetieM commented 4 weeks ago

Finally in a position to properly format this - OP has been updated using the correct template.

si458 commented 4 weeks ago

@PetieM legend thank u! I will have a look tomorrow when in office n stationery. Chances are the mpkg isn't working correctly with spaces in names! But I will fix it, it's why the community donated money for me to buy a macbook hehe

si458 commented 2 weeks ago

@PetieM can you share if its intel mac or arm mac? also what OS versions you are using?

PetieM commented 1 week ago

It's an Intel Mac running macOS 12.4. The install worked fine on my newer Intel Mac running 14.5 prior to the installer changes if that helps at all.

si458 commented 1 week ago

plz can you try the latest push/commit? you will need to re-download the zip from the web ui npm install Ylianst/MeshCentral ghcr.io/ylianst/meshcentral:master

PetieM commented 1 week ago

Unfortunately, the computer I discovered this on is not mine (I was trying to help a friend with some issues on it) so I don't have easy access to it. I'll test and get back to you if the opportunity arises but at the moment, I can't.