Admin.Client.Upgrade.RedHat

Remotely push new client updates to Red Hat hosts.

NOTE: This artifact requires that you supply a client Red Hat package using the tools interface or using the “rpm client” command. Simply click on the tool in the GUI and upload a package.


name: Admin.Client.Upgrade.RedHat
description: |
  Remotely push new client updates to Red Hat hosts.

  NOTE: This artifact requires that you supply a client Red Hat package using the
  tools interface or using the "rpm client" command. Simply click on the tool
  in the GUI and upload a package.

tools:
  - name: VelociraptorRedHat

parameters:
  - name: SleepDuration
    default: "600"
    type: int
    description: |
      The package is typically large and we do not want to
      overwhelm the server so we stagger the download over this many
      seconds.

  - name: ServiceName
    default: "velociraptor_client"
    type: str
    description: |
      The name of the service to restart after the upgrade.

sources:
  - precondition:
      SELECT OS From info() where OS =~ 'linux'

    query:  |
      // FetchBinary downloads to /tmp on linux
      LET bin <= SELECT OSPath AS Dest
      FROM Artifact.Generic.Utils.FetchBinary(
         ToolName="VelociraptorRedHat", IsExecutable=FALSE,
         SleepDuration=SleepDuration)

      // Call the binary and return all its output in a single row.
      // If we fail to download the binary we do not run the command.
      SELECT * FROM foreach(row=bin,
      query={
        SELECT * FROM chain(
          // Install the new client (Disabled preun because older versions
          // had a bug where preun would shut down the service - see #3122).

          b={SELECT * FROM execve(argv=["rpm", "--nopreun", "-U", str(str=Dest)])},
          c={SELECT * FROM execve(argv=["systemctl", "restart", ServiceName])}
        )
      })