AutomoxAutomox

Worklet: Install SentinelOne Agent (Linux)

Anonymous
March 24, 2022 at 7:24 pm UTC
#community#Worklets#automox#linux#sentinelone

Hi, everybody! Since announcing our strategic alliance that pairs our two platforms, Automox has developed customized Worklets for SentinelOne that includes pre-built scripts for automatic deployment of the SentinelOne agent across Windows, Linux and macOS devices - without manual intervention or wasted IT cycles. Below you’ll find the worklet for Linux.

Big thanks to @Zac-Automox  for getting these written. 🤘

 

Worklet Details: Install SentinelOne Agent (Linux)

 

Evaluation Code

bash36 lines
#!/bin/bash

#================================================================
# HEADER
#================================================================
#  SYNOPSIS
#    Installs the SentinelOne agent on the endpoint.
#
#  DESCRIPTION
#    This worklet will check to see if the SentinelOne agent is
#    installed on the target device.
#
#  USAGE
#    ./evaluation.sh
#
#================================================================
#  IMPLEMENTATION
#    version         STRAT-1_install_sentinelone_agent (www.automox.com) 1.0
#    author          Zac Youtz
#
#================================================================
#  HISTORY
#    8/13/2021 : Zac Youtz : Script creation
# 
#================================================================
# END_OF_HEADER
#================================================================

# evaluate the device to see if the Sentinel One is installed
if sudo sentinelctl version > /dev/null; then
  echo "Software is already installed"
  exit 0
else
  echo "Software not installed - Flagging for installation"
  exit 1
fi

 

Remediation Code

bash77 lines
#!/bin/bash

#================================================================
# HEADER
#================================================================
#  SYNOPSIS
#    Installs the SentinelOne Agent on the target device
#
#  DESCRIPTION
#    This worklet checks to see if the SentinelOne Agent is installed
#    on the target device and if it isn't, installs and registers the
#    SentinelOne Agent on the device.
#
#  USAGE
#    ./remediation.sh
#
#  EXAMPLE
#    rpm_filename="SentinelAgent_linux_v21_6_3_7.rpm"
#    deb_filename="SentinelAgent_linux_v21_6_3_7.deb"
#    site_token="ABCD123"
#
#================================================================
#  IMPLEMENTATION
#    version         STRAT-1_install_sentinelone_agent (www.automox.com) 1.0
#    author          Zac Youtz
#
#================================================================
#  HISTORY
#     8/13/2021 : Zac Youtz : Script creation
#
#
#================================================================
# END_OF_HEADER
#================================================================

#########################
rpm_filename=""
deb_filename=""
site_token=""
#########################
# CONSTANTS
rpm_installer="$(pwd)/$rpm_filename"
deb_installer="$(pwd)/$deb_filename"
#########################

# Check if SentinelOne is already installed
if sudo sentinelctl version > /dev/null; then
  echo "Software is already installed"
  exit 0
fi

install_command=""
# Define install command based on system type
if [ -x "$(command -v dpkg)" ]; then
  echo "Installing $deb_installer"

  install_command="sudo dpkg -i $deb_installer"
elif [ -x "$(command -v rpm)" ]; then
  echo "Installing $rpm_installer"

  install_command="sudo rpm -i --nodigest $rpm_installer"
else
  echo "Unable to install software; either rpm or dpkg package manager must be present on system"
  exit 1
fi

if eval "$install_command"; then
  echo "Software successfully installed"

  echo "Registering SentinelOne agent"
  sudo /opt/sentinelone/bin/sentinelctl management token set "$site_token"
  sudo /opt/sentinelone/bin/sentinelctl control start
  exit 0
else
  echo "Software failed to install"
  exit 1
fi

 

This discussion is archived and closed to replies. Continue it in the Automox Community Slack.

Discuss on Slack