This component allows you to interact with remote machine via SSH. You can execute commands or run scripts located on that machine

Related tags

App th2-act-ssh
Overview

th2 act ssh (1.2.0)

Overview

Provides user with the ability to execute specified scripts or commands with the parameter he needs

Custom resources for infra-mgr

apiVersion: th2.exactpro.com/v1
kind: Th2Box
metadata:
  name: act
spec:
  type: th2-act
  pins:
    - name: server
      connection-type: grpc
    - name: output
      connection-type: mq
      attributes:
        - "publish"
        - "store"
        - "raw"
        - "first"
  custom-config:
    connection:
      endpoints:
        - alias: "Conn1"
          host: host1
          username: username1
          password: pwd
          # Or you can use path to the private key instead
          # privateKeyPath: path/to/private/key
          port: 22
          connectionTimeout: 1000
          authTimeout: 1000
        - alias: "Conn2"
          host: host2
          username: username2
          privateKeyPath: path/to/private/key
          port: 22
          connectionTimeout: 1000
          authTimeout: 1000
      stopWaitTimeout: 10000
    reporting:
      rootName: YourActSsh
      addStackStraceForErrors: true
    messagePublication:
      enabled: false
    executions:
      - type: command
        alias: YourCommand
        execution: "mkdir ${base_dir}/some_dir"
        addOutputToResponse: true
        timeout: 100
        defaultParameters:
          base_dir: dir
        messagePublication:
          enabled: true
      - type: script
        alias: YouScript
        scriptPath: ~/script.sh
        options: "${option_A}"
        addScriptToReport: true
        addOutputToResponse: true
        timeout: 1000
        defaultParameters:
          option_A: "some_value"
    

Required pins

The act-ssh should have the following pins:

  • One for gRPC server with connection-type=grpc (required pin)
  • Pins for message publication with connection-type=mq. Those pins are required only if you are using message publication. The following attributes are required for those pins: publish, raw, first

Connection

Endpoints

The list of endpoints to connect. The endpoint will be chosen according to the endpoint alias specified in the request. If the act has only one endpoint you can omit the endpoint alias in the request. The endpoint will be chosen automatically.

alias (required)

The alias for to identify the endpoint

host (required)

The remote machine's address to connect.

username (required)

The user's name that will be used to connect to the machine via SSH.

password

The password that will be used for authentication (you can set it using environment variables password: ${YOUR_ENV_VARIABLE}). NOTE: if you use this parameter the privateKeyPath should not be set.

privateKeyPath

The path to the private key that will be used for password-less authentication. NOTE: if you use this parameter the password should not be set.

port

That port will be used to connect via SSH. The default value is 22.

connectionTimeout

The timeout to wait until the connection is established.

authTimeout

The timeout to wait until the authentication is finished.

Reporting

rootName

The name of the root event in the report. This event will be used to store events that was triggered by request without parent event ID.

addStackStraceForErrors

If it is enabled the full stacktrace will be added to the event if an exception was thrown during execution. Otherwise, the error will be added to the event in a short form (only error messages)

Message publication

This block is used to configure the default behavior related to message publication (can be overridden for certain execution). By default, if this block is missing the publication is disabled. If publication is enabled the alias corresponding to the used endpoint will be taken for message publication.

The content of the published message is the execution output. The published message will have the following properties attached:

  • act.ssh.execution-alias - the information about the alias that was executed;
  • call parameters - the call parameters will be put into properties under their names without changes.

See the example of the message:

messages {
  metadata {
    id {
      connection_id {
        session_alias: "test-msg-alias"
      }
      sequence: 1637232067339937000
      direction: FIRST
    }
    properties {
      key: "act.ssh.execution-alias"
      value: "test-alias"
    }
    properties {
      key: "test-param"
      value: "value"
    }
  }
  body: "you command output"
}

enabled

Specifies if the publication is enabled or not. The default value is false

Executions

This block describes which actions are available for this act. It has two types of actions:

  • command
  • script

The main difference that the script type allows to add the content of the script to the report.

Common block

alias

The name that will be used to execute the action.

addOutputToResponse

If it is true the action output will be added to the response and to the report.

timeout

The timeout to wait until the action is finished.

interruptOnTimeout

If it is true the action will interrupt command on timeout using the SIGHUP signal otherwise action will be failed when command has not completed on timeout.

defaultParameters

The list default values of the parameters that should be used if the parameter was not specified in the execution request;

messagePublication

Configuration for message publication related to the particular execution. Overrides the parameters from the root block. Please, see the message publication block description here.

Command

execution

The command that should be executed. You can use the following syntax to specify the parameters ${parameter_name}.

Script

scriptPath

The path to the script that should be executed. NOTE: it is always better to specify the full path instead of the relative one.

options

The options that will be added to the script. As the result the following command will be executed ${scriptPath} ${options}

Release Notes

1.2.0

Added:

  • Publication of output as raw message

1.1.0

Changed:

  • Update common version from 3.13.4 to 3.29.1
  • Correct responses on gRPC request when an error is occurred during execution
  • Add ability to send command output as a raw message

1.0.1

  • Add description from the request to the event with the result

1.0.0

  • Up major version to separate common V2 and V3 versions

0.1.0

  • Added the interruptOnTimeout option for execution block

0.0.3

  • Use pty option to send SIGHUP signal to the attached process when the channel is closed

0.0.2

  • The ability to connect using private key
  • Aliases for endpoints to connect

0.0.1

  • First version.
You might also like...
Connect UPG is an app that enables students to interact and share their thoughts, emotions, feeling as things
Connect UPG is an app that enables students to interact and share their thoughts, emotions, feeling as things

Connect UPG is an app that enables students to interact and share their thoughts, emotions, feeling as things

This project consists in the approach of a bakery business, in which the user can book one or more products (cakes), in addition to having the method of payment in cash (post-shipment) or the method of payment via mobile

This project consists in the approach of a bakery business, in which the user can book one or more products (cakes), in addition to having the method of payment in cash (post-shipment) or the method of payment via mobile

AlarmIT is a simple alarm app. The alarms can be turned off via three methods - normal turnoff, by shaking the device a number of times, by solving maths questions.
AlarmIT is a simple alarm app. The alarms can be turned off via three methods - normal turnoff, by shaking the device a number of times, by solving maths questions.

Kicking Off Hacktoberfest with ACM-VIT! AlarmIT AlarmIT is a simple alarm app. The alarms can be turned off via three methods - normal turnoff, by sha

remote technical interview Android challenge app

Android challenge We would like to learn more about how you approach a challenge as an Android Engineer. There is a simple app that isn’t made with be

The application is a PoC that helps in identifying modern bankers, potentially malicious and remote controlling applications abusing Android AccessibilityService.

Motivation Project aims to help in: identifying keyloggers and events hijacking malicious applications such as Anubis/TeaBot, identifying a "fake bank

Clean architecture dictionary app fetching remote data with local caching

ComposeDictionary Clean architecture dictionary app fetching remote data with local caching Installation Clone this repository and import into Android

ICSx⁵ is an Android app to subscribe to remote or local iCalendar files (like time tables of your school/university or event files of your sports team).

ICSx⁵ ICSx⁵ is an Android app to subscribe to remote Webcal feeds / iCalendar files (like time tables of your school/university or event files of your

Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors
Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors

Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors. Parameters includes but not limited to temperature, humidity, air quality, level of Ionizing radiation, ...

PortalController - A rudimentary TeamViewer-like remote control app for Android, using ws.

PortalController A TeamViewer-like app for Android-to-Android remote control, using node.js and websockets (ws). Some insight The reason I call it rud

Releases(v1.2.2)
Owner
th2
All components are licensed under Apache-2.0 License
th2
An application to manage SSH and GPG keys on GitHub written in Kotlin.

KeyManager An application to manage SSH and GPG keys on GitHub written in Kotlin. Thanks to FreePik for the app icon. Screenshots Building You will ne

Yash Garg 28 Dec 21, 2022
Repository contains structures and methods to execute linear algebra operations (matrix multiplication etc)

LinearAlgebra Repository contains structures and methods to execute linear algebra operations (matrix multiplication etc) Matrix class Matrix implemen

null 0 Apr 27, 2022
Linuxcnc probescripts - Collection of scripts for several touch-probe routines

linuxcnc_probescripts Collection of scripts for several touch-probe routines. Al

Multifuchs UG (haftungsbeschränkt) 0 Jan 30, 2022
LuaBox Helper for call lua scripts on Kotlin

LuaBox Helper for call lua scripts on Kotlin! Big thanks to Luaj library! 1. Create a class for working with LuaBox: class ScriptCore: LuaBox( pat

Мяучер 8 Nov 12, 2022
Andorid app which provides a bunch of useful Linux commands.

Linux Command Library for Android The app currently has 3203 manual pages, 1351 one-line scripts and a bunch of general terminal tips. It works 100% o

Simon Schubert 285 Jan 3, 2023
Program, created to make popular adb and fastboot commands easier to use

Android Tool What is it? Android Tool is a powerful and beautiful program, created to make popular adb and fastboot commands easier to use. A dark the

Rodion 245 Dec 29, 2022
Photon Framework provides cool way to Discord Slash Commands 👩‍💻 🚧

Photon Framework provides cool way to Discord Slash Commands ??‍?? ??

Codename Photon 16 Dec 20, 2022
Communicating between Wear OS and Android device using the OpWear module and a sample of displaying real-time camera on the watch and sending commands to the mobile by Wear OS.

OpWear-Cam Communicating between Wear OS and Android device using the OpWear module and a sample of displaying real-time camera on the watch and sendi

AmirHosseinAghajari 6 Nov 8, 2022