Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Please use your CyberCNS Domain/Tenant name in the CyberCNS Agent download link mentioned in the script as shown below:

e.g. cybercnstenant should be learn in case CyberCNS Domain/Tenant is learn. Please use your allocated CyberCNS Domain/Tenant name here.

The script used for CyberCNS V3:

View file
namemacos.sh

Note: The script for new infrastructure: ( this script has changed agent download URL which is suitable for new infrastructure)

Old Script The script used for CyberCNS V2:

Code Block
#!/bin/bash


# checking wether the user is root or normal user
function check_root {
    if [[ "x$(id -u)" != 'x0' ]]; then
        echo 'Error: this script can only be executed by root'
        exit 1
    fi
}

# checking wether the agent already exists if not will install the agent
function install_lightweight {

   if [ -z "$cybercnscompanyid" ]
   then
         echo "\$cybercnscompanyid  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsclientid" ]
   then
         echo "\$cybercnsclientid  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsclientsecret" ]
   then
         echo "\$cybercnsclientsecret  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsdomain" ]
   then
         echo "\$cybercnsdomain  is NULL"
         exit 1
   fi

   pgrep cybercnsagentv2_darwin
   exitcode=$?
   if [ $exitcode -eq 0 ]; then
      echo "lightweight agent already running in the machine"
   else
      echo "Downloading https://domain.mycybercns.com/agents/ccnsagent/cybercnsagent_darwin"
      exitcode=$(curl --write-out %{http_code} -L -g "https://domain.mycybercns.com/agents/ccnsagent/cybercnsagent_darwin" -s -o cybercnsagent_darwin)
      if [ $exitcode -ne 200 ]; then
              if [ "$exitcode" == "000" ]; then
                 exitcode=-1
              fi
              
              echo "Was not able to fetch the lightweight cybercnsagent agent for mac os"
              exit $exitcode
      fi
      chmod +x cybercnsagent_darwin;
      sudo ./cybercnsagent_darwin -c $cybercnscompanyid -a $cybercnsclientid  -s $cybercnsclientsecret -b $cybercnsdomain -i LightWeight
   fi
}


function install {
    check_root
    install_lightweight
}

install

...

Note: The script for new infrastructure: ( this script has changed agent download URL which is suitable for new infrastructure)

The script used for CyberCNS V3:

View file
namemacos_probe.sh

Old Script The script used for CyberCNS V2:

Code Block
#!/bin/bash


# checking wether the user is root or normal user
function check_root {
    if [[ "x$(id -u)" != 'x0' ]]; then
        echo 'Error: this script can only be executed by root'
        exit 1
    fi
}

# checking wether the agent already exists if not will install the agent
function install_probe {

   if [ -z "$cybercnscompanyid" ]
   then
         echo "\$cybercnscompanyid  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsclientid" ]
   then
         echo "\$cybercnsclientid  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsclientsecret" ]
   then
         echo "\$cybercnsclientsecret  is NULL"
         exit 1
   fi

   if [ -z "$cybercnsdomain" ]
   then
         echo "\$cybercnsdomain  is NULL"
         exit 1
   fi

   pgrep cybercnsagentv2_darwin
   exitcode=$?
   if [ $exitcode -eq 0 ]; then
      echo "Probe agent already running in the machine"
   else
      echo "Downloading https://domain.mycybercns.com/agents/ccnsagent/cybercnsagent_darwin"
      exitcode=$(curl --write-out %{http_code} -L -g "https://domain.mycybercns.com/agents/ccnsagent/cybercnsagent_darwin" -s -o cybercnsagent_darwin)
      if [ $exitcode -ne 200 ]; then
              if [ "$exitcode" == "000" ]; then
                 exitcode=-1
              fi
              
              echo "Was not able to fetch the Probe cybercnsagent agent for mac os"
              exit $exitcode
      fi
      chmod +x cybercnsagent_darwin;
      sudo ./cybercnsagent_darwin -c $cybercnscompanyid -a $cybercnsclientid  -s $cybercnsclientsecret -b $cybercnsdomain -i Probe
   fi
}


function install {
    check_root
    install_probe
}

install

...