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

OpenWRT - MIPS24 agent - Question #2112

Closed 1001crew closed 3 years ago

1001crew commented 3 years ago

Hi to everyone.

Thanks for the great work for Mesh Central.

Currently I'm using REMOTE.IT for our ZBT WE826-T (MIPS24) Already setup and running MESH CENTRAL on our Ubuntu 18.04 Server. Setup a client in windows 10 and another one in Armbian : both perfectly connecting to the server.

The problem arise when I tried to install in OpenWRT 19.07.4

If I select LINUX/BSD from the popup menu of mesh agent add device, the string is not suitable for MIPS24. If I select LINUX/BSD/OSX and then LINUX MIPS24KC (OpenWRT) no dowload of any agent. When I copy the string beside Command, it will download a NOT COMPATIBLE VERSION for MIPS24.

Anybody can help me with correct string to pass it to my OpenWRT router ? Thanks

Ylianst commented 3 years ago

Hi. One trick to get started. When you are logged into your MeshCentral server, change the URL to "/meshagents" and you will the list of MeshAgents available on your server with download links.

image

You will see links to the "PDB" files for the Windows agents, this is for debugging the agent and the "meshcmd" links on the right, that is the link to get meshcmd for each variation. In my case, I have an extra "MeshAgent Crash Dumps", that is only visible if you have crash dumps enabled on your server and only used for getting agent crash dumps.

In any case, the install script any not download the correct agent for your platform so you can go here and manually download and run the agent you want. Give that a try and see if you can run "meshagent --info" on your platform.

One more trick. When looking at the install script you cut & paste into the OpenWRT device you will see this:

sudo ./meshinstall.sh https://central.mesh.meshcentral.com '7b4b43cdad850135f36ab31124b52e47c167fba055ce800267a4dc89fe0e581c'

This will run the install script as root with the path to the server and the device group identifier to join. You can optionally add the agent type. So, if you change the script to this (look at the end of the line):

sudo ./meshinstall.sh https://central.mesh.meshcentral.com '7b4b43cdad850135f36ab31124b52e47c167fba055ce800267a4dc89fe0e581c' 28

This will force agent 28 to be installed. Let me know if that helps. You don't need to really use the install script. You can download the agent and .msh file and get them running yourself. Let me know if that helps.

1001crew commented 3 years ago

Hi Sorry I have still problem.... I have followed your instructions but I have this error in return from my OpenWRT router:

root@ROOter:~# ./meshinstall.sh https://108.61.***.***:60443 'I1vTX9DMbGAjXzX4KU8yHtOdhZLte6nFefbP$cRnIZ2ZNjhMT5$pkKdWndd4BzRE' 28 ps: unrecognized option: p BusyBox v1.30.1 () multi-call binary.

Usage: ps

Show list of processes

w   Wide output

Agent uninstalled. Downloading Mesh agent #28... Downloading 'https://108.61.***.***:60443/meshagents?id=28' Connecting to 108.61..:60443 Writing to '/usr/local/mesh/meshagent' /usr/local/mesh/mesh 100% |*****| 3908k 0:00:00 ETA Download completed (4002552 bytes) Mesh agent downloaded. Downloading 'https://108.61.*.:60443/meshsettings?id=I1vTX9DMbGAjXzX4KU8yHtOdhZLte6nFefbP$cRnIZ2ZNjhMT5$pkKdWndd4BzRE' Connecting to 108.61..*:60443 Writing to '/usr/local/mesh/meshagent.msh' /usr/local/mesh/mesh 100% |*****| 19916 0:00:00 ETA Download completed (19916 bytes) Unknown Service Platform Type. (ie: init, systemd, etc) Installing as Pseudo Service (Mesh Daemon) ./meshinstall.sh: line 214: /usr/local/mesh/meshagent: cannot execute binary file: Exec format error ./meshinstall.sh: line 215: /usr/local/mesh_daemons/daemon: No such file or directory To start service: /usr/local/mesh_daemons/daemon start meshagent To stop service: /usr/local/mesh_daemons/daemon stop meshagent Mesh agent started. root@ROOter:~# meshagent -ash: meshagent: not found root@ROOter:~# cd /usr/local/mesh/ root@ROOter:/usr/local/mesh# ./meshagent ./meshagent: line 13: syntax error: unexpected word (expecting ")") root@ROOter:/usr/local/mesh# ls -all drwxr-xr-x 2 root root 0 Dec 27 12:09 . drwxr-xr-x 3 root root 0 Dec 27 12:05 .. -rwxr-xr-x 1 root root 4002552 Dec 27 12:09 meshagent -rw-r--r-- 1 root root 19930 Dec 27 12:09 meshagent.msh

Can you tell me what am I doing wrong ??? I did manage to make it working on ARMBIAN

Ylianst commented 3 years ago

It does not look like this install script will work on your system. Just create a new folder and download these two files using wget or curl:

wget https://108.61.***.***:60443/meshagents?id=28
wget https://108.61.***.***:60443/meshsettings?id=I1vTX9DMbGAjXzX4KU8yHtOdhZLte6nFefbP$cRnIZ2ZNjhMT5$pkKdWndd4BzRE

Then, try running the mesh agent like this:

./meshagent --info

If that works, start the MeshAgent:

./meshagent

Let me know what you see.

1001crew commented 3 years ago

Hi thanks.

First command success: wget https://108.61.***.***:60443/meshagents?id=28

Second commands problem with certificate but manage to download it

root@OpenWrt:~/meshagent# chmod 755 meshagent root@OpenWrt:~/meshagent# ls -all -rwxr-xr-x 1 root root 4002552 Dec 29 20:17 meshagent -rw-r--r-- 1 root root 19916 Dec 29 20:15 meshagent.msh root@OpenWrt:~/meshagent# ./meshagent --info ./meshagent: line 13: syntax error: unexpected word (expecting ")")

I tried the same file with other 3 OpenWrt 19.07.4 boxes with same result.

1001crew commented 3 years ago

I tried all LINUX version, one by one and all not working on any of the 3 OpenWRT router I have. I also tried to use BASH instead of default ASH but without any result.

Here are the specs: Linux OpenWrt 4.14.209 #0 Sun Dec 6 07:31:03 2020 mips GNU/Linux Chipset MT7620 - MIPS24K Router ZBT WE826-T

Tomorrow I will try on a GLinet AR750 : we don't use these router but I wanna try

krayon007 commented 3 years ago

that should only have one dash, not two: ./meshagent -info

1001crew commented 3 years ago

same result

root@OpenWrt:~/meshagent# ls -all drwxr-xr-x 2 root root 0 Dec 30 16:00 . drwxr-xr-x 1 root root 0 Dec 29 20:46 .. -rwxr-xr-x 1 root root 4002552 Dec 30 16:00 meshagent -rw-r--r-- 1 root root 19916 Dec 29 20:15 meshagent.msh root@OpenWrt:~/meshagent# ./meshagent -info ./meshagent: line 13: syntax error: unexpected word (expecting ")") root@OpenWrt:~/meshagent#

1001crew commented 3 years ago

UPDATE if it may help... I believe OPENWRT is missing something....

I'm testing MESH CENTRAL agent in a box with Armbian Linux with H3 cpu (ARM v7) (FriendlyArm NanoPI ZERO) It successful run without any fail.

I have another board with same CPU H3 (ARM v7) with OpenWRT installed and running. I then copy 'meshagent' and 'meshagent.msh' files from the 1st box to this router. Guess what ? When I run './meshagent -info' I get the following error: root@FriendlyWrt:~/mesh# ./meshagent -info bash: ./meshagent: No such file or directory whether I run in bash or in ash shell, it give me the same error.

I then tried one last thing... I power on a 3rd box also with H3 but running DietPi Linux. Copied the same files and.... bang ! it run perfectly !

I'm not a programmer and I have no clue why the same files in a box doesn't run in another box with same CPU etc. If I run a linux distro, it run but if I run an openwrt it won't. If someone can come and rescue me, I would appreciate. Thanks a lot

Platypuschan commented 2 years ago

I´m running Model | AVM FRITZ!Box 3370 Rev. 2 (Hynix NAND) Architecture | xRX200 rev 1.1 Target Platform | lantiq/xrx200 Firmware Version | OpenWrt 21.02.1 r16325-88151b8303 / LuCI openwrt-21.02 branch git-22.119.37126-a993714 Kernel Version | 5.4.154

When i try to install the meshagent for MIPS24KC i get:

./meshagent --install sh: getent: not found The graphical version of this installer cannot run on this system. Try installing/updating Zenity, and run again. You can run the text version from the command line with the following command(s): ./meshagent -install ./meshagent -install --installPath="/alternate/path"

pierrejoye commented 5 months ago

Hello :)

thanks a lot for the amazing meshcentral, astonishingly well done while easy to setup!

I use quite a few tp link ax-23, mipssel cpu current openwrt (23.05)

The main issue here is the lack of bash support. It uses sh. 2nd issue, not sure why, the /settings call fails with 401 (seems something is wrong on my server setup). wget or browser while being authenticated. Maybe it is something that could be downloaded from a group's action?

The work around is to manually copy the binary over (as described above). I then copy over the meshagent.msh from a windows (or linux) installation, without the translation. Use /tmp/meshcentral on that model, or the actual partition with some space.

for completeness, the (simple) init.d script, to be in /etc/init.d/meshagent (then service meshagent stop|start|status):

`#!/bin/sh /etc/rc.common

START=99 STOP=1 USE_PROCD=1 PROG=/tmp/meshcentral/meshagent

start_service() { procd_open_instance procd_set_param command "$PROG" procd_set_param respawn procd_set_param pwd /tmp/meshcentral procd_close_instance }

stop_service() { killall meshagent }

service_status() { if pgrep -x "meshagent" > /dev/null then echo "MeshAgent is running" else echo "MeshAgent is not running" fi }`

long story short, tplink ax-23 openwrt 23.05 works very well :)