ssh-bot

0

Описание

Telegram бот, который позволяет запускать заданные команды на выбранном хосте в домашней сети и возвращать результат их выполнения. Бот не устанавливает постоянное соединение с удаленным хостом, что позволяет выполнять команды асинхронно.

Языки

  • Go98,4%
  • Dockerfile1,6%
9 месяцев назад
9 месяцев назад
5 месяцев назад
9 месяцев назад
8 месяцев назад
README.md

SSH Bot

English (🇺🇸) | Русский (🇷🇺)

Telegram bot that allows you to run specified commands on a selected host in your home network and return the result of their execution. The bot does not establish a permanent connection with the remote host, which allows you to execute commands asynchronously.

The bot provides the ability to not waste time setting up a

VPN
server and money on an external IP address or
VPS
server to access the local network, and also eliminates the need to use third-party applications (
VPN
and
ssh
clients) on a remote device and does not require a stable Internet connection.

example

Roadmap

  • Executing commands on the local (the one where the bot is running) or remote host (via
    ssh
    ) in the specified interpreter.
  • Support for parallel (asynchronous) command execution.
  • ssh
    connection manager with host availability check.
  • Support for directory navigation.
  • Combined access to remote hosts by key and/or password.
  • Error handling when using commands that require user input.
  • Support for storing and reusing passed variables and functions (the
    exit
    command clears the history).

Launch

You can download the pre-compiled executable from the releases page and run the bot locally or in a Docker container using the image from Docker Hub.

Note

Before launching, you need to create your Telegram bot using @BotFather and get its

API Token
, which must be specified in the configuration file.

  • Create a working directory:
  • Create and fill the
    .env
    file file inside the working directory:

Note

Access to the bot is limited by user ID. You can find out the Telegram

id
using @getmyid_bot or in the bot logs when sending a message to it.

  • Run the bot in a container:

Note

The bot environment is not stored in an image, but uses a mounting mechanism. To access remote hosts using a key, you need to forward the private key file from the host system to the container (as in the example above) and leave the contents of the

SSH_PRIVATE_KEY_PATH
variable empty.

Build