# Linux Agent instructions

This page includes instructions on deploying the BAS Agent for the Linux platform.

# Requirements

The BAS agent is supported on Red Hat Enterprise Linux versions 8 and 9.

# Downloading the BAS Agent

You can download as many instances of the Agent as you'd like for your environment. To download the Agent, log into the NetSPI Platform's BAS module and take the following steps.

  1. Navigate to BAS -> Agents in the NetSPI Platform's left navigation.

    Agent Navigation

    This displays the Agents page.

    Agent Page

  2. Select the Download Agent drop-down list and then Download Linux Agent.

# Set up the BAS Agent

This section provides instructions on setting up the downloaded BAS Agent.

  1. Navigate to the directory that contains the Agent executable. In the example below, the Agent file is located in the "Downloads" directory. By default, the file will not be executable.

  2. To enable the Agent file's execution, enter the following command at the command line:

    chmod +x ./NetSPI-BAS-Agent

    Enable Execute Bit

  3. Enter the following command to start the Agent.

    ./NetSPI-BAS-Agent

    The BAS agent will prompt you to log into the NetSPI Platform:

    Logging in to the NetSPI BAS Platform servers...
    Requesting device code
    Refreshing discovery document
    To complete the login process visit https://platform.netspi.ai/auth/realms/netspi/device in a web browser and
    enter the code DEMO-CODE
    Waiting for response... /
  4. Copy and paste the indicated URL in a new browser window and enter the provided code.

    Platform login with agent code

  5. Select Yes to grant the agent privileges to access the NetSPI Platform.

    Grant agent access

    After entering the code select Yes to grant the agent privileges to access the NetSPI Platform. A message similar to the one below should display.

    Logging in to the NetSPI BAS Platform servers...
    Requesting device code
    Refreshing discovery document
    To complete the login process visit https://platform.netspi.ai/auth/realms/netspi/device in a web browser and
    enter the code DEMO-CODE
    Saving configuration profile in ~/.netspi/bas/bas_agent.json
    Started gRPC server, socket file is: ~/.netspi/bas/.NetSPI_BAS-jlinay.sock
    Received empty execution plan, nothing to do
    Received empty execution plan, nothing to do
    Received empty execution plan, nothing to do
  6. Once successfully logged in, you can close your browser window.

# Linux BAS agent help

To access the BAS agent help for Linux, enter the following command:

$ ./NetSPI-BAS-Agent --help

Usage of ./NetSPI-BAS-Agent:
    NetSPI-BAS-Agent [--log] [--logdir PATH]
    NetSPI-BAS-Agent [--logout]
    NetSPI-BAS-Agent [--version]

Options:
    -l, --log             Log output to a log file.  Logs will be written to the directory specified by --logdir
    --logdir PATH         Directory where the log output will be written to. (default /home/user/.netspi/bas/logs)
    --logout              Logout and clear stored authentication information
    --version             Show the version number and quit

# Removing the BAS Agent

The Breach and Attack Simulation agent is not a persistent installation.

To remove the Agent, first log out of the agent and then remove the agent.

./NetSPI-BAS-Agent --logout
rm ./NetSPI-BAS-Agent