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
4.17k stars 559 forks source link

Mac clients identified as `localhost` and not their real hostnames #5379

Open pierrecorsini opened 1 year ago

pierrecorsini commented 1 year ago

Describe the bug

Mac identified as localhost:

image

To Reproduce

  1. Setup group

image

  1. Add mac clients

  2. Set the mac hostnames using sudo scutil --set HostName xxxxx and double checking with mac os GUI (Sharing options).

  3. The hostname is set to localhost (same result if unchecking the "OS Name" option on the client list view.

Expected behavior The host name on MC should be the newly set hostname.

Server Software (please complete the following information):

Remote Device

pierrecorsini commented 1 year ago

This seems that setting HostName is not enough. Find below a script that renames "everything", and then MC displays the right hostname.

sudo scutil --set HostName <new host name>
sudo scutil --set LocalHostName <new host name>
sudo scutil --set ComputerName <new name>
dscacheutil -flushcache

Probably not a bug, closing.

pierrecorsini commented 11 months ago

This seems that setting HostName is not enough. Find below a script that renames "everything", and then MC displays the right hostname.

sudo scutil --set HostName <new host name>
sudo scutil --set LocalHostName <new host name>
sudo scutil --set ComputerName <new name>
dscacheutil -flushcache

Probably not a bug, closing.

Multiple cases found where scutil --get xxxxName returns a value but meshcentral displays Localhost.

Re opening. Could you please advice.

image

si458 commented 10 months ago

i have noticed this, IF you change a computer device name AFTER you have installed the meshagent, sometimes it wont sync the name correctly, so a simple way to fix it in the web ui is to just rename it in the web ui! go to the devices general tab, then click the pencil next to the name in the title, then change it to say the SAME THING thats listed as the OS NAME thats underneath it this is because it thinks you have given it a NICKNAME in the web ui so it doesnt sync correctly image

pierrecorsini commented 10 months ago

Thanks @si458 for your answer. Assigning names manually on MC is a way avoid the localhost renamining.

But the issue is that you do not rely on the real hostname naming anymore; this is actually a nice feature for me to have the real hostname sync in MC; it allows me to check if an unwanted rename was done.

si458 commented 7 months ago

is this still an issue @pierrecorsini? ive just got an M1 mac mini and im not having this issue created group with hostname sync, added mac mini, changed device name, restarted mac, name changed in web ui ?

pierrecorsini commented 7 months ago

Hi

I did the test again :

  1. The host is in a group without sync, is named 016-xxxxx; re install the agent on that machine.
  2. Created group with hostname sync
  3. Move the host in the group
  4. Restart host
  5. The host is now named localhost in MC while bash seems to display the right name 016-xxxxx. TEST NOK
> versions{   "openssl": "1.1.1q",   "duktape": "v2.6.0",   "commitDate": "2022-08-23T02:57:39.000Z",   "commitHash": "de512f8ae10a4086f54dc32d827777366836a94f",   "compileTime": "20:05:37, Aug 22 2022" }
> coreinfo{   "action": "coreinfo",   "caps": 15,   "osdesc": "Mac OS X 10.10.5",   "root": true,   "users": [],   "value": "Aug 22 2022, 961309034" }
bash-3.2# sudo scutil --get HostName
016-xxxxx
bash-3.2# sudo scutil --get LocalHostName
016-xxxxx
bash-3.2# sudo scutil --get ComputerName
016-xxxxx
bash-3.2# hostname 
016-xxxxx

MC Version : 1.1.20

Note: this is osx 10.10.5, but we have the same issue on 10.11 and as far as I remember also 10.13.

dinger1986 commented 7 months ago

I saw this in Yosemite, but once the OS was upgraded to a certain version (I can't remember what) it synced fine. Yosemite is a 10 year old OS now.

si458 commented 7 months ago

OK I will have a look again on my old macbook which used 11 now (patched it) but will try to emulate 10 again

si458 commented 7 months ago

@pierrecorsini just tried 10.13 (high sierra) and still not getting this issue? im wondering if its maybe because you are MOVING the device between groups? can u just add the device directly to the 'hostsync' group ? also is the name correctly in the web ui BEFORE you move the device or rename the device and restart it?

pierrecorsini commented 7 months ago

@si458 I did the test again with a new host that has the same OS version.

  1. The agent is installed with the installer manually.
  2. The client is well added on the group (with automatic naming) on MC, and with the right name (not localhost) ✅.
  3. I do reboot the client's system.
  4. The client now appears with "localhost" as name ❌.

This seems that the "client registering process" only is able to get the right name... then it fails to name it correctly.

si458 commented 7 months ago

@pierrecorsini hmmm can u upgrade ur mac os? I can't test 10.11 sadly, the best I can test is 10.13, and I'm just not having the issue at all...

pierrecorsini commented 7 months ago

@si458 Unfortunately we cannot upgrade (multiple reasons). Assuming the concerned hardware will EOL in 1-2 years, I'll just put them in a Group without automatic naming. Thanks.

si458 commented 7 months ago

@pierrecorsini random one, have you tried installing with the binary files rather than the mpkg?