Compare commits

...

7 Commits
v2.4.9 ... main

Author SHA1 Message Date
Kyle Mohr
1891a4c5bb
Update binary links 2024-01-24 19:22:55 -06:00
Kyle Mohr
9d799c3bd2
Delete rmmagent-linux.sh 2023-10-19 19:51:51 -05:00
Kyle Mohr
e120d941ea finally customizing the repo for the Mac installation 2023-10-19 19:51:19 -05:00
Kyle Mohr
00c23190bb
Update README.md
Updated docs for the latest version of rmmagent
2023-10-19 19:02:29 -05:00
Kyle Mohr
041926c96a
Update README.md 2023-09-06 12:04:23 -05:00
Kyle Mohr
dc9ea6aa29
Update README.md 2023-09-06 11:53:36 -05:00
Kyle Mohr
c9ee30a9a9
Update README.md 2023-07-26 16:45:02 -05:00
3 changed files with 58 additions and 376 deletions

126
README.md
View File

@ -1,100 +1,62 @@
# rmmagent-script
Script for one-line installing and update of tacticalRMM agent
Instructions for installing the RMM agent on Mac computers without paying for codesigning.
> Now x64, x86, arm64 and armv6 scripts are available but only x64 and i386 tested on Debian 11 and Debian 10 on baremetal, VM (Proxmox) and VPS(OVH)
> Tested on raspberry 2B+ with armv7l (chose armv6 on install)
<details>
<summary>Compile the agent yourself</summary>
<br>
Script for other platform will be available futher as I adapt script on other platform.
Feel free to adapt script and submit me !
# Usage
Download the script that match your configuration
### Tips
Download script with this url: `https://raw.githubusercontent.com/netvolt/LinuxRMM-Script/main/rmmagent-linux.sh`
## Install
To install agent launch the script with this arguement:
```bash
./rmmagent-linux.sh install 'System type' 'Mesh agent' 'API URL' 'Client ID' 'Site ID' 'Auth Key' 'Agent Type'
```
The compiling can be quite long, don't panic and wait few minutes... USE THE 'SINGLE QUOTES' IN ALL FIELDS!
brew install golang
The argument are:
git clone https://github.com/amidaware/rmmagent.git
2. System type
Type of system. Can be 'amd64' 'x86' 'arm64' 'armv6'
3. Mesh agent
The url given by mesh for installing new agent.
Go to mesh.fqdn.com > Add agent > Installation Executable Linux / BSD / macOS > **Select the good system type**
Copy **ONLY** the URL with the quote.
4. API URL
Your api URL for agent communication usually https://api.fqdn.com.
5. Client ID
The ID of the client in wich agent will be added.
Can be view by hovering the name of the client in the dashboard.
6. Site ID
The ID of the site in wich agent will be added.
Can be view by hovering the name of the site in the dashboard.
7. Auth Key
Authentification key given by dashboard by going to dashboard > Agents > Install agent (Windows) > Select manual and show
Copy **ONLY** the key after *--auth*.
8. Agent Type
Can be *server* or *workstation* and define the type of agent.
### Example
```bash
./rmmagent-linux.sh install amd64 "https://mesh.fqdn.com/meshagents?id=XXXXX&installflags=X&meshinstall=X" "https://api.fqdn.com" 3 1 "XXXXX" server
cd rmmagent
```
## Update
Then, if using Intel Mac:
Simply launch the script that match your system with *update* as argument.
`env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w"`
```bash
./rmmagent-linux.sh update
```
If using silicon Mac
## Uninstall
To uninstall agent launch the script with this arguement:
`env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w"`
</details>
```bash
./rmmagent-linux.sh uninstall 'Mesh FQDN' 'Mesh ID'
```
Note: Single quotes must be around the Mesh ID for it to uninstall the mesh agent properly
**OR**
The argument are:
<details>
<summary>Download the agent from here:</summary>
<br>
2. Mesh FQDN
Intel Mac:
Example of FQDN: mesh.fqdn.com
https://github.com/kylefmohr/MacOSRMM-Script/releases/download/v2.6.1/rmmagent-amd64-v2.6.1
3. Mesh ID
Silicon Mac:
The ID given by mesh for installing new agent.
Go to mesh.fqdn.com > Add agent > Linux / BSD (Uninstall) > Copy **ONLY** the last value with the single quotes.
You are looking for a 64 charaters long value of random letter case, numbers, and special characters.
https://github.com/kylefmohr/MacOSRMM-Script/releases/download/v2.6.1/rmmagent-arm64-v2.6.1
</details>
---
Because we're not paying for codesigning, we'll get a scary warning the first time we run it. To workaround this, before installing the agent, open the file once by itself *while holding down the `Option` key*. Then click "Open" on the scary warning. Once you've done this, you can proceed to the installation.
## Installation Instructions:
- Go to the web portal for your TacticalRMM instance, and click `Agent` > `Install Agent`
- Select all the options you'd like, *but change macOS to Windows*, and select *manual* for installation method. The Arch section can be ignored.
<img width="625" alt="image" src="https://github.com/kylefmohr/MacOSRMM-Script/assets/6644803/9ce36c59-85ad-4816-8a61-0a069f26ec51">
- Then click "Show Manual Instructions", and copy beginning at `-m install` until the end. You should have something like: `-m install --api https://api.yourdomain.com --client-id 1 --site-id 1 --agent-type workstation --auth <RandomString> --rdp --ping --power`
- Open the terminal and run the following command:
`chmod +x rmmagent-amd64-v2.5.0`
- Then, type `sudo ./rmmagent-amd64-v2.5.0 ` and then *paste* the string you copied in the previous step, the full command should look something like:
`sudo ./rmmagent-amd64-v2.5.0 -m install --api https://api.yourdomain.com --client-id 1 --site-id 1 --agent-type workstation --auth <RandomString> --rdp --ping --power`
You should be good to go!
### Example
```bash
./rmmagent-linux.sh uninstall mesh.fqdn.com 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
```
### WARNING
- You should **only** attempt this if the agent removal feaure on TacticalRMM is not working.
- Running uninstall will **not** remove the connections from the TacticalRMM and MeshCentral Dashboard. You will need to manually remove them. It only forcefully removes the agents from your linux box.

View File

@ -1,294 +0,0 @@
#!/bin/bash
check_zip=$(which unzip 2> /dev/null)
if [[ $check_zip == "" || $check_zip =~ .*"no unzip".* ]]; then
echo "unzip could not be found. Please install unzip."
exit 0
fi
if [[ $1 == "" ]]; then
echo "First argument is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "help" ]]; then
echo "There is help but more information is available at github.com/ZoLuSs/rmmagent-script"
echo ""
echo "List of INSTALL argument (no argument name):"
echo "Arg 1: 'install'"
echo "Arg 2: System type 'amd64' 'x86' 'arm64' 'armv6'"
echo "Arg 3: Mesh agent URL"
echo "Arg 4: API URL"
echo "Arg 5: Client ID"
echo "Arg 6: Site ID"
echo "Arg 7: Auth Key"
echo "Arg 8: Agent Type 'server' or 'workstation'"
echo ""
echo "List of UPDATE argument (no argument name)"
echo "Arg 1: 'update'"
echo "Arg 2: System type 'amd64' 'x86' 'arm64' 'armv6'"
echo ""
echo "List of UNINSTALL argument (no argument name):"
echo "Arg 1: 'uninstall'"
echo "Arg 2: Mesh agent FQDN (i.e. mesh.domain.com)"
echo "Arg 3: Mesh agent id (The id needs to have single quotes around it)"
echo ""
exit 0
fi
if [[ $1 != "install" && $1 != "update" && $1 != "uninstall" ]]; then
echo "First argument can only be 'install' or 'update' or 'uninstall' !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $2 == "" ]]; then
echo "Argument 2 (System type) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "update" && $2 == "" ]]; then
echo "Argument 2 (System type) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $2 != "amd64" && $2 != "x86" && $2 != "arm64" && $2 != "armv6" ]]; then
echo "This argument can only be 'amd64' 'x86' 'arm64' 'armv6' !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $3 == "" ]]; then
echo "Argument 3 (Mesh agent URL) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $4 == "" ]]; then
echo "Argument 4 (API URL) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $5 == "" ]]; then
echo "Argument 5 (Client ID) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $6 == "" ]]; then
echo "Argument 6 (Site ID) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $7 == "" ]]; then
echo "Argument 7 (Auth Key) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $8 == "" ]]; then
echo "Argument 8 (Agent Type) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "install" && $8 != "server" && $8 != "workstation" ]]; then
echo "First argument can only be 'server' or 'workstation' !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "uninstall" && $2 == "" ]]; then
echo "Argument 2 (Mesh agent FQDN) is empty !"
echo "Type help for more information"
exit 1
fi
if [[ $1 == "uninstall" && $3 == "" ]]; then
echo "Argument 3 (Mesh agent id) is empty !"
echo "Type help for more information"
exit 1
fi
## Setting var for easy scription
system=$2
mesh_url=$3
rmm_url=$4
rmm_client_id=$5
rmm_site_id=$6
rmm_auth=$7
rmm_agent_type=$8
## Uninstall var for easy scription
mesh_fqdn=$2
mesh_id=$3
go_url_amd64="https://go.dev/dl/go1.18.3.linux-amd64.tar.gz"
go_url_x86="https://go.dev/dl/go1.18.3.linux-386.tar.gz"
go_url_arm64="https://go.dev/dl/go1.18.3.linux-arm64.tar.gz"
go_url_armv6="https://go.dev/dl/go1.18.3.linux-armv6l.tar.gz"
function go_install() {
if ! command -v go &> /dev/null; then
## Installing golang
case $system in
amd64)
wget -O /tmp/golang.tar.gz $go_url_amd64
;;
x86)
wget -O /tmp/golang.tar.gz $go_url_x86
;;
arm64)
wget -O /tmp/golang.tar.gz $go_url_arm64
;;
armv6)
wget -O /tmp/golang.tar.gz $go_url_armv6
;;
esac
tar -xvzf /tmp/golang.tar.gz -C /usr/local/
rm /tmp/golang.tar.gz
export GOPATH=/usr/local/go
export GOCACHE=/root/.cache/go-build
echo "Golang Install Done !"
else
echo "Go is already installed"
fi
}
function agent_compile() {
## Compiling and installing tactical agent from github
echo "Agent Compile begin"
wget -O /tmp/rmmagent.zip "https://github.com/amidaware/rmmagent/archive/refs/heads/master.zip"
unzip /tmp/rmmagent -d /tmp/
rm /tmp/rmmagent.zip
cd /tmp/rmmagent-master
case $system in
amd64)
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o /tmp/temp_rmmagent
;;
x86)
env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w" -o /tmp/temp_rmmagent
;;
arm64)
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o /tmp/temp_rmmagent
;;
armv6)
env CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags "-s -w" -o /tmp/temp_rmmagent
;;
esac
cd /tmp
rm -R /tmp/rmmagent-master
}
function update_agent() {
systemctl stop tacticalagent
cp /tmp/temp_rmmagent /usr/local/bin/rmmagent
rm /tmp/temp_rmmagent
systemctl start tacticalagent
}
function install_agent() {
cp /tmp/temp_rmmagent /usr/local/bin/rmmagent
/tmp/temp_rmmagent -m install -api $rmm_url -client-id $rmm_client_id -site-id $rmm_site_id -agent-type $rmm_agent_type -auth $rmm_auth
rm /tmp/temp_rmmagent
cat << "EOF" > /etc/systemd/system/tacticalagent.service
[Unit]
Description=Tactical RMM Linux Agent
[Service]
Type=simple
ExecStart=/usr/local/bin/rmmagent -m svc
User=root
Group=root
Restart=always
RestartSec=5s
LimitNOFILE=1000000
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now tacticalagent
systemctl start tacticalagent
}
function install_mesh() {
## Installing mesh agent
wget -O /tmp/meshagent $mesh_url
chmod +x /tmp/meshagent
mkdir /opt/tacticalmesh
/tmp/meshagent -install --installPath="/opt/tacticalmesh"
rm /tmp/meshagent
rm /tmp/meshagent.msh
}
function check_profile () {
source /etc/environment
profile_file="/root/.profile"
path_count=$(cat $profile_file | grep -o "export PATH=/usr/local/go/bin" | wc -l)
if [[ $path_count -ne 0 ]]; then
echo "Removing incorrect \$PATH variable\(s\)"
sed -i "/export\ PATH\=\/usr\/local\/go\/bin/d" $profile_file
fi
path_count=$(cat $profile_file | grep -o "export PATH=\$PATH:/usr/local/go/bin" | wc -l)
if [[ $path_count -ne 1 ]]; then
echo "Fixing \$PATH Variable"
sed -i "/export\ PATH\=\$PATH\:\/usr\/local\/go\/bin/d" $profile_file
echo "export PATH=\$PATH:/usr/local/go/bin" >> $profile_file
fi
source $profile_file
}
function uninstall_agent() {
systemctl stop tacticalagent
systemctl disable tacticalagent
rm /etc/systemd/system/tacticalagent.service
systemctl daemon-reload
rm /usr/local/bin/rmmagent
rm /etc/tacticalagent
sed -i "/export\ PATH\=\$PATH\:\/usr\/local\/go\/bin/d" /root/.profile
}
function uninstall_mesh() {
(wget "https://$mesh_fqdn/meshagents?script=1" -O /tmp/meshinstall.sh || wget "https://$mesh_fqdn/meshagents?script=1" --no-proxy -O /tmp/meshinstall.sh)
chmod 755 /tmp/meshinstall.sh
(/tmp/meshinstall.sh uninstall https://$mesh_fqdn $mesh_id || /tmp/meshinstall.sh uninstall uninstall uninstall https://$mesh_fqdn $mesh_id)
rm /tmp/meshinstall.sh
rm meshagent
rm meshagent.msh
}
case $1 in
install)
check_profile
go_install
install_mesh
agent_compile
install_agent
echo "Tactical Agent Install is done"
exit 0;;
update)
check_profile
go_install
agent_compile
update_agent
echo "Tactical Agent Update is done"
exit 0;;
uninstall)
check_profile
uninstall_agent
uninstall_mesh
echo "Tactical Agent Uninstall is done"
echo "You may need to manually remove the agents orphaned connections on TacticalRMM and MeshCentral"
exit 0;;
esac

14
rmmagent-macos.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/zsh
if [ "which brew" == "" ]; then
echo "Installing Homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew install golang
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o ./rmmagent-macos-amd64
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o ./rmmagent-macos-arm64
chmod +x ./rmmagent-macos-amd64
chmod +x ./rmmagent-macos-arm64
echo "Done! Make sure to read the installation instructions: https://github.com/kylefmohr/MacOSRMM-Script/tree/test-ci#installation-instructions"