MeshCentral icon indicating copy to clipboard operation
MeshCentral copied to clipboard

Group Actions: sending files doesn't work as expected

Open elpibedeoro opened this issue 2 years ago • 13 comments

Hi Ylian,

Sending files through group actions doesn't work as expected and I can't even check anyway (is there a progression bar ? ) On the client side I can find the folder created but the file uploaded inside is about 1 KB. Tested this with a .msi (about 40MB) and a .exe (about 2MB) on a Windows 10 21H1.

If you send a file through the Files tab of each computer, then it works.

Thank you in advance for you help.

-- MC2 v.1.0.26 on Debian 10 No ReverseProxy

elpibedeoro avatar Jun 03 '22 13:06 elpibedeoro

@elpibedeoro Its very strange, in my case its works fine, i tried more than 1k devices at a time and succeded 90%

VINISHVV avatar Jun 03 '22 18:06 VINISHVV

If you see what you started, but it didn't finish I'd be looking at av/in network data interruptions/proxy filtering etc

silversword411 avatar Jun 06 '22 23:06 silversword411

Thank you guys for your reply. @silversword411 I'm checking about the AV (F-Secure), it might be the cause as you suggest. What I find weird is copying through the Files tab it works... so in that case the AV doesn't consider this action as a menace. I'll keep looking about this.

elpibedeoro avatar Jun 07 '22 07:06 elpibedeoro

Just tested on a MacOS v.10.13 and I have the same problem, the file transferred is about 12B instead of 4MB. On the Windows client still have the same problem after uninstalling AV. Meshagent's traffic is allowed on the firewall.

If this works for you then I might have a problem on my MC2 server. If you have any ideas about this issue, it would be really cool.

elpibedeoro avatar Jun 08 '22 14:06 elpibedeoro

I also faced a similar problem several times, but I didn't attach much importance to it. I thought there was a problem with my MC2 server. It turns out that I'm not the only one who faced this. I join the issue.

openncomp avatar Jun 08 '22 15:06 openncomp

Just tested on a MacOS v.10.13 and I have the same problem, the file transferred is about 12B instead of 4MB.

Check this: https://ylianst.github.io/MeshCentral/meshcentral/debugging/

Use ?trace=1 and browser dev console. Are you seeing the websocket connection drop? Anything that jumps out at you?

silversword411 avatar Jun 08 '22 20:06 silversword411

Hi,

Had a look at debugging and I couldn't find anything that gives me an idea. The websocket gets alive, I think that's ok with it. I join some screenshots if it can help:

2022-06-09 16_15_58-Window

222022-06-09 16_47_24-Window

elpibedeoro avatar Jun 09 '22 14:06 elpibedeoro

Hi,

Still have this problem on MC 1.1.11 on Debian 11 and I was just wondering if anyone have a new idea since last time ?

Thank you !

elpibedeoro avatar Sep 21 '23 12:09 elpibedeoro

Just to add a news: I tried to send a .bat file to a linux computer. When I open it, the content was marked as "Unauthorized"

send-file

elpibedeoro avatar Oct 10 '23 07:10 elpibedeoro

im not seeing this problem uploading a 1mb exe to 3 remote windows machines (server 2022, win 10, win 11) ? is it only certain files that dont get uploaded correctly?

si458 avatar Oct 10 '23 08:10 si458

unfortunately this happens with all kind of files, I've always had this "problem" and I cannot figure out how to solve this. If it works for you, this means the problem is local for me... do you have any idea where to look for ? It seems like a permissions problem. Thanks

elpibedeoro avatar Oct 10 '23 09:10 elpibedeoro

Hitting this issue myself, and I have a few details that will hopefully help track this down.

I'm not sure if @elpibedeoro has userAllowedIP configured, but I do. I'm running nginx in front, which lets me see the access logs. MC is 1.1.22.

Uploading a bat file to an agent: It reaches the MC server OK:

10.20.52.99 - - [08/May/2024:10:29:53 -0400] "POST /uploadfilebatch.ashx HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0" "-"

[root@RM-MC-1 mc]# ls meshcentral-files/tmp/ -l
total 12
-rw-r--r--. 1 mc mc 12229 May  8 10:29 [email protected]

But the next line in the access log from the agent results in a 401:

216.208.150.196 - - [08/May/2024:10:29:53 -0400] "GET /agentdownload.ashx?c=L7GiXwpd5dYWlzSZ7t@g1adXY2ly(snip)PfsxIwU2rA== HTTP/1.1" 401 12 "-" "-" "-"

Commented out userAllowedIP, restarted mc, tried the same thing, and it worked this time. HTTP 200 from the agent:

10.20.52.99 - - [08/May/2024:10:43:19 -0400] "POST /uploadfilebatch.ashx HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0" "-"
216.208.150.196 - - [08/May/2024:10:43:19 -0400] "GET /agentdownload.ashx?c=bQi9Xel$xdyAqpzXCg(snip)VEZw== HTTP/1.1" 200 12229 "-" "-" "-"

So I'm pretty sure this is caused by userAllowedIP, at least in my case.

nafai avatar May 08 '24 14:05 nafai

https://github.com/Ylianst/MeshCentral/blob/33c0e8228618c028c672e7fc0f4b5e1ddcdcf498/webserver.js#L3751

Should handleAgentDownloadFile use checkAgentIpAddress instead of checkUserIpAddress here?

nafai avatar May 08 '24 15:05 nafai

thank you @nafai as your fix does indeed fix this issue! have merged it and will be available in about 15mins for the docker master image or npm install Ylianst/MeshCentral development versions!

si458 avatar Jun 28 '24 13:06 si458

https://github.com/Ylianst/MeshCentral/blob/33c0e8228618c028c672e7fc0f4b5e1ddcdcf498/webserver.js#L3751

Should handleAgentDownloadFile use checkAgentIpAddress instead of checkUserIpAddress here?

Yes, I can confirm this fix the issue ! Thanks !

elpibedeoro avatar Jul 01 '24 08:07 elpibedeoro

@elpibedeoro such a simple fix and only took 2 years to spot/fix haha

si458 avatar Jul 01 '24 09:07 si458