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.07k stars 545 forks source link

Fix for multiple device file upload 1k file causes new agent installs not to register correctly #6418

Open inzi opened 3 hours ago

inzi commented 3 hours ago

Describe the bug The temporary fix for mutiple file upload behind proxy prevents new agents from being added correctly. This is the temporary fix I'm referencing: https://github.com/Ylianst/MeshCentral/issues/3282#issuecomment-2321019771

Background Multiple file upload does not function as expected, especially when behind a proxy, and results in a 1k file that is the output of a 404 error. A temporary fix was identified and implemented here:  https://github.com/Ylianst/MeshCentral/issues/3282#issuecomment-2339255988

Result After implementing this fix, if you add a new agent, it successfully connects, but doesn't seem to download the configuration correctly. In the UI, it shows it as connected, but Desktop, File, and Agent commands all fail.

To resolve the issue, if you

To Reproduce Steps to reproduce the behavior:

Specifically, set _AgentAliasPort to AgentAliasPort, map your ports, configure your proxy. Once you do this, the agents will function normally. But if you try and add a new agent, it connects, but desktop, terminal, files, and console are all unavailable.

Expected behavior The expected behavior is the newly installed agent should connect and be fully functional.

Server Software (please complete the following information):

Client Device (please complete the following information):

Remote Device (please complete the following information):

Additional context Add any other context about the problem here.

Your config.json file

{
   "settings": {
      "cert": "mymeshserver.mydomain.com", 
      "wanonly": false, 
      "_minify": true, 
      "port": 480, 
      "aliasport": 443, 
      "redirport": 88, 
      "rediraliasport": 80, 
      "agentporttls": true, 
      "agentport": 481,
      "_AgentAliasPort": 481,
      "tlsoffload": "127.0.0.1,10.10.10.10,10.10.10.97,10.10.10.1,::1", 
      "trustedproxy": "127.0.0.1,10.10.10.10,10.10.10.97,10.10.10.1,::1", 
      "cookieipcheck": false, 
      "cookieencoding": "hex", 
      "authlog": "C:\\Program Files\\Open Source\\MeshCentral\\meshcentral-logs\\auth.log", 
      "log": [
            "cookie",
            "dispatch",
            "main",
            "peer",
            "web",
            "webrequest",
            "relay",
            "webrelaydata",
            "webrelay",
            "mps",
            "mpscmd",
            "swarm",
            "swarmcmd",
            "agentupdate",
            "agent",
            "cert",
            "db",
            "email",
            "amt",
            "httpheaders",
            "websocket"
        ],
      "agentlogdump": true, 
      "compression": false, 
      "wscompression": false, 
      "agentWsCompression": false, 
      "noagentupdate": false, 
      "selfUpdate": true,
      "plugins": {
         "enabled": true
      }, 
      "allowlogintoken": true, 
      "allowframing": true, 
      "webrtc": false, 
      "ignoreagenthashcheck": false
   }, 
   "domains": {
       "": {
        "Title": "My Mesh",
        "Title2": "My Mesh",
        "_TitlePicture": "title-sample.png",
        "_loginPicture": "logintitle-sample.png",
        "_welcomeText": "This is sample text",
        "_welcomePicture": "mainwelcome-04.jpg",
        "_welcomePictureFullScreen": true,
        "_siteStyle": "1",
        "_nightMode": "1",
        "certUrl": "https://mymeshserver.mydomain.com",
        "meshMessengerTitle": "My Mesh Chat",
        "_meshMessengerPicture": "chatimage.png",
        "_footer": "This is a HTML string displayed at the bottom of the web page when a user is logged in.",
        "_loginfooter": "This is a HTML string displayed at the bottom of the web page when a user is not logged in."
      },
      "agentFileInfo": {
         "title": "My Mesh", 
         "agentconfig": ["coreDumpEnabled=1"]
      }
   }, 
   "smtp": {
      "host": "emailhost", 
      "port": 587, 
      "from": "email", 
      "user": "email", 
      "pass": "email_password", 
      "tls": false
   }
}
inzi commented 3 hours ago

@catalinchertes - Are you experiencing this same issue?

@si458 I think the issue revolves around the agentdownload functioning not only for downloading uploaded file, but updates to the agent.

si458 commented 3 hours ago

@inzi the post you are tagging into this issue shows that the fix was only merged and released in 1.1.29 but you say in the issue you are running 1.1.27

have you tried updating your server to the latest version as we are on 1.1.32 at the moment

edit: have you also made sure you are downloading the latest meshagent EXE from the meshcentral ui whenever u change your config.json?