Team: Huntress EDR
Product:NinjaRMM(Script)
Environment: MacOS
Summary:Huntress agent deployment via NinjaRMM (Script) RMM
UPDATE 10/24/2022: Ninja introduced a new variable called $NINJA_ORGANIZATION_NAME that eliminates the need to set manually or pass via parameter. The Huntress deployment script has been updated to take advantage of this new feature.
NinjaRMM provides the ability to create Scheduled Scripts to deploy third-party software. This document provides the instructions to add a Scheduled Script to your Policies to deploy the Huntress Agent to your customer's computers. We are not able to offer comprehensive support for NinjaRMM, please refer to the NinjaRMM documentation for full details regarding the usage of NinjaRMM policies and scheduled scripts.
The Organization Name and Organization key will match the site name from NinjaRMM (the names shown in Dashboard -> Organizations).
- Retrieve Your Huntress Account Key
- Download, Edit, and Import the Huntress Deployment Script for NinjaRMM
- Add a Scheduled Script to Your Policy
- Troubleshooting
Retrieve Your Huntress Account Key
- Login to the Huntress Web Interface.
- Hover over the Huntress options menu in the upper-right corner of the dashboard.
- Select the "Download Agent" option from the menu.
- On the Installer page click the clipboard icon to copy your secret account key to your clipboard.
Download, Edit, and Import Huntress Deployment Script
- Download our ShellScript Deployment Script by right-clicking the page, and selecting "Save As" (wording may vary by browser or OS). Make sure the file extension is
.sh
- In your NinjaRMM dashboard, click on "Configuration" in the left-hand menu.
- Click on "Scripting"
- Click on "Import New Script" in the upper right-hand area.
- Select the file that you saved in Step 3 for import:
- After clicking "Open" the scripting UI will appear with the imported shell script. Scroll down to around line 52 and paste your Huntress account secret key over the __ACCOUNT KEY__ text in the script. Replace the __ORGANIZATION_KEY__ text with the customer organization you wish to deploy the agents to. Be sure to leave the customer name in quotes as shown in the second screenshot:
Before:
After:
Note: It is important that your script matches. - Fill out the form on the right-hand pane with a name, description, category, scripting language, operating system, and architecture as shown below. You may set custom values for name, description, and category, but the language must be ShellScript, Operating System must be set to Mac and Architecture must be set to All.
- Click the "save" button in the upper-right corner of the script editor.
Add a Scheduled Script to Your Policy
NOTE: This section is provided as a general guideline. You may wish to add the Huntress script to one or more custom policies in your deployment. We are not able to offer comprehensive support for NinjaRMM, please refer to the NinjaRMM documentation for full details regarding the usage of NinjaRMM policies and scheduled scripts.
- Log in to NinjaRMM.
- Navigate to the policy you want to use to install the Huntress Agent by clicking configuration, policies, and the policy name. Alternatively, you can create a new policy. In this example, we're using the "Mac" policy.
- Click on the Scheduled Scripts menu on the left and then Add a scheduled Script on the right.
- In the Scheduled Script window choose an appropriate name and description for the script. Set the Schedule and Notification preferences to your preferred settings. Click the "Add Script" button.
- Navigate to the category you set for your script in Step 6 of the previous section and click on the script to import it into the schedule.
- Confirm "Run As" is set to "System", and click Apply.
- This will close the parameter window. Now click "Add" to add the script to the schedule.
- Click "Save" in the upper right hand corner. You are now ready to deploy the Huntress Agent via NinjaRMM!
Troubleshooting
From your Ninja dashboard click on Activities, then click on All
Find the Completed action and click on More
The resulting pop up should describe what the issue is. In the example below the organization key was not set in the script parameters (step 5 from "Download, Edit, and Import Huntress Deployment Script" above). Another common issue is incorrect/missing AcctKey (also in script parameters).
Below is an example of an error caused by an improperly imported script. If you copied and pasted the script from Github in Step 1 of "Download, Edit, and Import Huntress Deployment Script" above, your computer may have added extraneous characters. Delete the script from Ninja, and follow the steps in that section exactly as shown in order to prevent this.
If you see a successfully installed message like the example below, and you still don't see the agent in your portal make sure you're searching from your Account-level dashboard, not your Org-level dashboard.
If you're still stuck; email your Huntress log files from the affected machine's /tmp/
and /Library/Application Support/Huntress/HuntressAgent/
directories to support@huntress.io
Comments
1 comment
Great article!
The link above to download the script looks to have recently broken as the file was renamed.
https://github.com/huntresslabs/deployment-scripts/blob/main/Ninja-RMM/InstallHuntress-macOS-NinjaRMM.sh
Please sign in to leave a comment.