Skip to main content
Question

Extension Attribute: Tenable Network Security - Nessus

  • January 26, 2016
  • 41 replies
  • 522 views

Show first post

41 replies

Forum|alt.badge.img+4

I just revisited this after using the prior method during a trial over the Summer. The process is much easier now. No need to use Composer any longer.

  1. Mount the Nessus Agent DMG from the Tenable website.

  2. Pull the hidden file ".NessusAgent.pkg" out of the DMG and place it where you'd like.

  3. Rename it as you like. (I used NessusAgent_v_8_0_2.pkg)

  4. Pull the PKG into Jamf Admin, add whatever info/details you prefer.

  5. Create a Policy installing this PKG on the target computer.

  6. Add the following script to run after the PKG install, it will link the agent to your Tenable instance and delete the Preference Pane (we prefer that users not mess with it)

#!/bin/sh

#Links Nessus agent to our specific key and sets needed cloud domain and port

/Library/NessusAgent/run/sbin/nessuscli agent link --key=YOUR_SPECIFIC_KEY_HERE  --host=cloud.tenable.com --port=443

# If desired, the --groups"Group Name" tag can be added

# This removes the Nessus Agent Preference Pane

rm -rf /Library/PreferencePanes/Nessus Agent Preferences.PrefPane

Tested and works well for deployment.


Forum|alt.badge.img+1
  • New Contributor
  • December 11, 2020

I am getting the error below for people with Catalina OS but some with the older Mojave OS it is installing no problem. Anyone any ideas why? NessusAgent-8.2.0
installer: Upgrading at base path /
installer: The upgrade failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume.)
also getting Script result: sudo: /Library/NessusAgent/run/sbin/nessuscli: command not found


Forum|alt.badge.img+31
  • Honored Contributor
  • December 11, 2020

You are trying to upgrade an existing agent @EddieF and you must remove some files that are unique first before reinstalling


Forum|alt.badge.img+1
  • New Contributor
  • December 14, 2020

When creating the package i've deleted everything except files in /Library and i've also tried deleting all files except /Library/NessusAgent it isn't making a difference


Forum|alt.badge.img+31
  • Honored Contributor
  • December 14, 2020

If you are going to uninstall you should delete all contents in /Library/Nessus, the preference pane if you deploy it (we do not), and there is a unique ID that is generated upon install called the /etc/tenable_tag which also must be deleted to reinstall the app.

The installer and the agent is sorta horrible, and health checking it is also a nightmare. Please open tickets with the vendor and let them know you would like to see improvements.


mhasman
Forum|alt.badge.img+22
  • Valued Contributor
  • February 16, 2021

Hello,

Are there any updates in deployment version 8.2.2, recommendations, please?

UPD. Nessus Version EA returns: Agent) 8.2.2 [build


Forum|alt.badge.img+4
  • Contributor
  • July 27, 2022

Also the Version EA needs a little work, the newer versions of Nessus are outputting alot of data with the -v. I'm trying to figure it out now, ill post back if I get it working better


Sorry to revive a two year dead thread but how did you get Jamf to acknowledge you are running the Nessus Agent in the console? I can see it running in the Tenable side but nothing on the Jamf side.


dvasquez
Forum|alt.badge.img+16
  • Valued Contributor
  • July 27, 2022

@tharr00 and @Kyuubi

Thank you so much for the kind words. I am glad the workflow has found value to someone else.

One of my SecOps guys made a change. He modified the following:

ORIGINAL CODE

# Link the Nessus Agent to cloud.tenable.com
 echo "########## CONFIGURING THE NESSUS AGENT ##########" | logger
 sudo /Library/NessusAgent/run/sbin/nessuscli agent link --key=<your key goes here> --name=$Fullname --host=cloud.tenable.com --port=443 | logger

UPDATED CODE

# Link the Nessus Agent to cloud.tenable.com
 echo "########## CONFIGURING THE NESSUS AGENT ##########" | logger
sudo /Library/NessusAgent/run/sbin/nessuscli agent link ----key=<your key goes here>  --name=$Fullname --host=cloud.tenable.com --port=443 --groups="<your group info goes here>" | logger

Just in case y'all were curious!


This is so all-inclusive and so awesome. Thank you for taking the time to share with the community. We use this product and your info really helped me understand more I will be shamelessly using your scripts and configurations. 


dvasquez
Forum|alt.badge.img+16
  • Valued Contributor
  • July 27, 2022

I have to deal with Nessus, unfortunately, but vuln scan data is valuable. here is how I approach the deployment.

Nessus actually deploys a dummy package in their DMG that has a hidden package nested inside the DMG. Why they do this, I have literally zero clue. Security through obscurity? So you can mount the DMG and use terminal to find the hidden package that is named with a . in front of it hiding it. The downside is there are some chmod scripts that seem to apply permissions after the install, again no idea why they designed it that way. Of course if Jamf just supported native DMG installs this wouldn't be much of an issue, but it is what it is.

Also, there is a unique agent ID located in /etc/tenable_tag you must, and I will stress this, you must remove this tag if you reinstall the agent at all. This is what they use to a unique identifier on their server side tools, so I have baked in a bunch of checks into an install/remediation script

#!/bin/zsh

# use poisiotnal parameters to pass the agent link ID to the tenable agent post install
# jamf reserves 1-3 so we are startign with 4
# your nessus agent ID to register with your cloud tenant
NSAGENT="${4}"

# test to see if tenable installed correctly, if not force non zero exit status to track errors in jamf

if /Library/NessusAgent/run/sbin/nessuscli help
  then echo "binary is installed proceeding"
  else echo "Not installed, lets install now"
  jamf policy -event install_nessus
  exit 0

fi

# yeet the Nessus Pref pane because it is useless
# then yeet the tenable agent ID beacuse it is unique

if [[ -e /Library/PreferencePanes/Nessus Agent Preferences.prefPane ]]
    echo "removing pref pane..."
    then rm -rf /Library/PreferencePanes/Nessus Agent Preferences.prefPane
fi

if [[ -e /etc/tenable_tag ]]
    echo "removing tenable UUID"
    then rm -f /etc/tenable_tag
fi

# just in case it is registered with a bad/wrong scan we are gonna force it to unlink
echo "forcing an unlink..."
/Library/NessusAgent/run/sbin/nessuscli agent unlink --force

# remove the files and unload the daemons
echo "removing the daemons..."
launchctl unload /Library/LaunchDaemons/com.tenablesecurity.nessusagent.plist
rm -f /Library/LaunchDaemons/com.tenablesecurity.nessusagent.plist
echo "removing the files"
rm -rf /Library/NessusAgent

# install the new agent
echo "reinstalling the agent clean..."
jamf policy -event install_nessus

# apparently nessus deemed it necessary to deploy binaries that are not executable, because why not?
echo "setting the agent permissions..."
chmod -R +x /Library/NessusAgent/run

# now relink it
/Library/NessusAgent/run/sbin/nessuscli agent link --key="${NSAGENT}" --cloud --groups="your-scan-group-here"

We are seeing agents that auto upgrade and then not check into Nessus and I have open support tickets on this, so if anyone has insight into this I would be happy to hear about it. I am on Slack more often than here though.


truth!

 


dvasquez
Forum|alt.badge.img+16
  • Valued Contributor
  • July 27, 2022

Good stuff, thanks @cainehorr

So.. at least as of the 7.x+ Nessus, if you show hidden files there is a second PKG inside the DMG. Thats the actualy installer and it works fine outside of the DMG. I just pull that out, unhide it (take off the leading ".") and deploy it with Jamf. Following it up with the command to add it to out nessus enviorment.

Any reason this is wrong? I guess Im missing all the logic to check it, but i have other Polcies and EA for that.


So awesome to know this! Thanks for sharing.


Forum|alt.badge.img+1
  • New Contributor
  • October 4, 2022

So I am having a bit of a problem getting this Linked.   I've done the following:

  1. Mounted the Nessus Agent DMG from the Tenable website.

  2. Pulled the hidden file ".NessusAgent.pkg" out of the DMG and place it where you'd like.

  3. Renamed it (NessusAgent_v_10_3_0.pkg)

  4. Uploaded PKG my console. 

I added the installed Script: 

#This Works it installs and then it launches a webpage)
installer -pkg ./NessusAgent_v_10_3_0.pkg -target /

#Post-Install script:  

/Library/Nessus/run/sbin/nessuscli agent link --key=(I removed key for post purposes) --groups=MACs --cloud --host=cloud.tenable.com

#I tried running this via a terminal and I get an errors:

Could not open /Library/Nessus/run/var/nessus/master.key - Permission denied

Error: Command '--key=Remove key for purposes of this post' not found

 

I am not sure what I am doing wrong here, any help would be very appreciated.

 


Forum|alt.badge.img+4
  • Contributor
  • October 4, 2022

So I am having a bit of a problem getting this Linked.   I've done the following:

  1. Mounted the Nessus Agent DMG from the Tenable website.

  2. Pulled the hidden file ".NessusAgent.pkg" out of the DMG and place it where you'd like.

  3. Renamed it (NessusAgent_v_10_3_0.pkg)

  4. Uploaded PKG my console. 

I added the installed Script: 

#This Works it installs and then it launches a webpage)
installer -pkg ./NessusAgent_v_10_3_0.pkg -target /

#Post-Install script:  

/Library/Nessus/run/sbin/nessuscli agent link --key=(I removed key for post purposes) --groups=MACs --cloud --host=cloud.tenable.com

#I tried running this via a terminal and I get an errors:

Could not open /Library/Nessus/run/var/nessus/master.key - Permission denied

Error: Command '--key=Remove key for purposes of this post' not found

 

I am not sure what I am doing wrong here, any help would be very appreciated.

 


Have you tried using Sudo if your attempting via the terminal?

I'd switch user if you aren't attempting this through the admin side of things on the machine itself (you can do this via terminal as well).


Forum|alt.badge.img+1
  • New Contributor
  • October 4, 2022

Have you tried using Sudo if your attempting via the terminal?

I'd switch user if you aren't attempting this through the admin side of things on the machine itself (you can do this via terminal as well).


Thank you in advance for you help, it's my first time installing this.   I tried sudo, the first error went away which is great.   But I still have this error:

Error: Command '--key=Removed Key for this post' not found

Also,

In my postinstall script is this correct:

*I noticed that the path, rather than being /library/NessusAgent it's /library/Nessus 

*doesn't seem to be a NessusAgent folder in that location, but there is a Nessus folder.

 

/Library/Nessus/run/sbin/nessuscli agent link --key=(I removed key for post purposes) --groups=MACs --cloud --host=cloud.tenable.com --port=443

or

/Library/Nessus/run/sbin/nessuscli agent link --key=(I removed key for post purposes) --groups=MACs --cloud

 


Forum|alt.badge.img+1
  • New Contributor
  • October 10, 2022

It was an issue between the chair and the Keyboard.  I was installing the "Manager" thinking it was the "Client".  Problem solved lol.   Thank you.


Forum|alt.badge.img+3
  • New Contributor
  • July 26, 2024

I have to deal with Nessus, unfortunately, but vuln scan data is valuable. here is how I approach the deployment.

Nessus actually deploys a dummy package in their DMG that has a hidden package nested inside the DMG. Why they do this, I have literally zero clue. Security through obscurity? So you can mount the DMG and use terminal to find the hidden package that is named with a . in front of it hiding it. The downside is there are some chmod scripts that seem to apply permissions after the install, again no idea why they designed it that way. Of course if Jamf just supported native DMG installs this wouldn't be much of an issue, but it is what it is.

Also, there is a unique agent ID located in /etc/tenable_tag you must, and I will stress this, you must remove this tag if you reinstall the agent at all. This is what they use to a unique identifier on their server side tools, so I have baked in a bunch of checks into an install/remediation script

#!/bin/zsh

# use poisiotnal parameters to pass the agent link ID to the tenable agent post install
# jamf reserves 1-3 so we are startign with 4
# your nessus agent ID to register with your cloud tenant
NSAGENT="${4}"

# test to see if tenable installed correctly, if not force non zero exit status to track errors in jamf

if /Library/NessusAgent/run/sbin/nessuscli help
  then echo "binary is installed proceeding"
  else echo "Not installed, lets install now"
  jamf policy -event install_nessus
  exit 0

fi

# yeet the Nessus Pref pane because it is useless
# then yeet the tenable agent ID beacuse it is unique

if [[ -e /Library/PreferencePanes/Nessus Agent Preferences.prefPane ]]
    echo "removing pref pane..."
    then rm -rf /Library/PreferencePanes/Nessus Agent Preferences.prefPane
fi

if [[ -e /etc/tenable_tag ]]
    echo "removing tenable UUID"
    then rm -f /etc/tenable_tag
fi

# just in case it is registered with a bad/wrong scan we are gonna force it to unlink
echo "forcing an unlink..."
/Library/NessusAgent/run/sbin/nessuscli agent unlink --force

# remove the files and unload the daemons
echo "removing the daemons..."
launchctl unload /Library/LaunchDaemons/com.tenablesecurity.nessusagent.plist
rm -f /Library/LaunchDaemons/com.tenablesecurity.nessusagent.plist
echo "removing the files"
rm -rf /Library/NessusAgent

# install the new agent
echo "reinstalling the agent clean..."
jamf policy -event install_nessus

# apparently nessus deemed it necessary to deploy binaries that are not executable, because why not?
echo "setting the agent permissions..."
chmod -R +x /Library/NessusAgent/run

# now relink it
/Library/NessusAgent/run/sbin/nessuscli agent link --key="${NSAGENT}" --cloud --groups="your-scan-group-here"

We are seeing agents that auto upgrade and then not check into Nessus and I have open support tickets on this, so if anyone has insight into this I would be happy to hear about it. I am on Slack more often than here though.


Hey @tlarkin - have tried the above and got to a point I'm testing installing through self service (let me know if there is a better option) and it just spins. Assuming something I've done is incorrect and but so far I have.

put the dmg into composer > saw that the 2 .pkg files were there > set up a post install script with what you had suggested > then uploaded that as a package to jamf and pushed to self service.

Not sure if this isnt what it was intended for but I'm struggling to find a solution that works for me > tried a lot of the above and hoping it isnt just because it may be outdated.

 

I have verified that just manually installing tenable and then running the script for linking an agent in terminal works I just cannot get it to work remotely and don't want to manually do it on everyones machine :D


Forum|alt.badge.img+31
  • Honored Contributor
  • July 26, 2024

Hey @tlarkin - have tried the above and got to a point I'm testing installing through self service (let me know if there is a better option) and it just spins. Assuming something I've done is incorrect and but so far I have.

put the dmg into composer > saw that the 2 .pkg files were there > set up a post install script with what you had suggested > then uploaded that as a package to jamf and pushed to self service.

Not sure if this isnt what it was intended for but I'm struggling to find a solution that works for me > tried a lot of the above and hoping it isnt just because it may be outdated.

 

I have verified that just manually installing tenable and then running the script for linking an agent in terminal works I just cannot get it to work remotely and don't want to manually do it on everyones machine :D


@keenan710 it also needs CLI arguments to register the agent to the proper scan group and server. If you look at the output of that `nessuscli --help` it should give you the args to complete that task. The package by itself only installs the components but does not configure them. So you will need some sort of script to do so. 

 

also my script could very well be outdated as it is pretty old. Alternatively Nessus does offer some APIs to programmatically download the installer as well, which we only use in our Linux VDI deployment currently but I am sure that could be adapted to macOS. Just gotta put API creds in a script which is not a great security practice 

i would look at the CLI args from the nessus binaries and see if you are properly registering the agent