A Telegram Bot to connect to a SSH server.
- Node v18+
- Git
- Telegram Bot Token. This must be kept as a password. Do not share or publish this token.
$ npm install
Enviroment variable | Function |
---|---|
TELEGRAM_ALLOWED_USERNAMES |
Semicolon separated list of allowed Telegram usernames to interact with the bot |
TELEGRAM_TOKEN |
Telegram Bot Token. This must be kept as a password. Do not share or publish this token. |
SSH_HOST |
SSH target hostname or IP address |
SSH_USERNAME |
SSH username |
SSH_KEY |
Use this or SSH_PASSWORD Path to SSH key for given username |
SSH_PASSWORD |
Use this or SSH_KEY SSH password for given username |
$ export TELEGRAM_ALLOWED_USERNAMES="SEMICOLON_SEPARATED_USERNAMES"
$ export TELEGRAM_TOKEN="YOUR_TELEGRAM_BOT_TOKEN"
$ export SSH_HOST="SSH_TARGET_IP_OR_HOSTNAME"
$ export SSH_USERNAME="SSH_USERNAME"
$ export SSH_KEY="SSH_KEY_PATH"
$ npm start
version: "3.5"
services:
ssh-telegram-bot:
container_name: ssh-telegram-bot
image: pedromol/ssh-telegram-bot
volumes:
- "/root/.ssh:/keys"
environment:
- "TELEGRAM_ALLOWED_USERNAMES=SEMICOLON_SEPARATED_USERNAMES"
- "TELEGRAM_TOKEN=YOUR_TELEGRAM_BOT_TOKEN"
- "SSH_HOST=SSH_TARGET_IP_OR_HOSTNAME"
- "SSH_USERNAME=SSH_USERNAME"
- "SSH_KEY=SSH_KEY_PATH" #Use this or SSH_PASSWORD bellow
# - "SSH_PASSWORD=SSH_PASSWORD_FOR_USERNAME"
- "NODE_DISABLE_COLORS=1"
restart: unless-stopped