Deploy Tenable Nessus Agent Using JSON

When you first launch the agent after installation, the agent first checks for the presence of environment variables, then checks for the config.json file. When the agent launches for the first time, the agent uses that information to link to a manager and set preferences.

To deploy Tenable Nessus Agent with the config.json file:

  1. Configure the config.json file.

    Note: config.json must be in ASCII format. Some tools, such as PowerShell, create test files in other formats by default.

    Example Tenable Nessus Agent config.json file format:

    { "link": { "name": "sensor name", "host": "hostname or IP address", "port": 443, "key": "abcdefghijklmnopqrstuvwxyz", "ms_cert": "CA certificate for linking", "retry": 1, "proxy": { "proxy": "proxyhostname", "proxy_port": 443, "proxy_username": "proxyusername", "proxy_password": "proxypassword", "user_agent": "proxyagent", "proxy_auth": "NONE" } }, "preferences": { "global.max_hosts": "500" } }

    Example Tenable Nessus Agent config.json file format (when using auto_proxy):

    { "link": { "name": "sensor name", "host": "hostname or IP address", "port": 443, "key": "abcdefghijklmnopqrstuvwxyz", "ms_cert": "CA certificate for linking", "retry": 1, "proxy": { "proxy": "proxyhostname", "proxy_port": 443, "auto_proxy": "true" } } }

    config.json Details

    The following describes the format of the different settings in each section of config.json.

    Note: All sections are optional; if you do not include a section, it is not configured when you first launch Tenable Nessus Agent. You can manually configure the settings later.

    Linking

    The link section sets preferences to link the agent to a manager.

    Tip: Specifying the link preferences in config.json and leaving the retry preference blank achieves the same result as using the --install-offline linking argument in the nessuscli. Doing so installs Tenable Nessus Agent on the specified host, even if it is offline. The agent then indefinitely tries to link to the host, given that you did not specify a retry value.

    Preferences

    The preferences section configures any advanced settings. For more information, see Advanced Settings.

  2. Download the Tenable Nessus Agent installation package for your operating system.

  3. (Windows only) Before you install the package, you must modify the package so that the agent does not start automatically after installation. This is because the agent must read the config.json file when you start the agent service for the first time.

    To modify the package, run the following command:

    msiexec /i <agent package>.msi NESSUS_SERVICE_AUTOSTART=false /qn

  4. Install Tenable Nessus Agent. For more information, see Install a Tenable Nessus Agent on Windows , Install a Tenable Nessus Agent on macOS, or Install a Tenable Nessus Agent on Linux.

  5. (macOS only) Unlike Windows, there is no way to turn off autostart before installing Tenable Nessus Agent. Therefore, you need to reset the Tenable Nessus Agent to a fresh state before adding config.json and starting the agent service.

    To return Tenable Nessus Agent to a fresh state on macOS, validate config.json, and place config.json in the correct directory, run the following command:

    /Library/NessusAgent/run/sbin/nessuscli prepare-image --json=<path to json file>

    Note: Tenable Nessus Agent autostart is disabled by default in Linux packages. Therefore, if you are using Linux, you can ignore steps 3 and 5.
  6. Place config.json in the Tenable Nessus Agent directory if it is not already there:

    • Windows — C:\ProgramData\Tenable\Nessus Agent\nessus\config.json
    • macOS — /Library/NessusAgent/run/var/nessus/config.json
    • Linux — /opt/nessus_agent/var/nessus/config.json
  7. Start the agent service.

  8. Depending on your operating system, run the following command to verify the config.json preferences:

    • Windows — "C:\Program Files\Tenable\Nessus Agent\nessuscli.exe" fix --secure --list

    • macOS — /Library/NessusAgent/run/sbin/nessuscli fix --secure --list

    • Linux — /opt/nessus_agent/sbin/nessuscli fix --secure --list

    Once you verify that the preferences were successfully applied, the linking process is complete.