Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cjdenio/slack-ssh


https://github.com/cjdenio/slack-ssh

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# slack-ssh

Minimal SSH in Slack!

## Usage

Every message you send to the channel will be interpreted as a one-off command. Super easy.

`cd` doesn't work, so run `cd dir/; my-command` to run a given command in the given directory.

Prefix any message with `# ` to _not_ execute it (e.g. `# what's up guys?`)

## Hosting

Requirements:

- Some sort of web host
- A server to SSH into, with SSH set up and configured
- An SSH key pair, with the public key installed on the server

First, create a Slack app. Subscribe to the `message.channels` bot event, then create a bot token with the `chat.write` scope.

Point your events to the `/slack/events` endpoint.

### Environment variables

```
SLACK_SIGNING_SECRET = your Slack app's signing secret
SLACK_BOT_TOKEN = the bot token
SLACK_CHANNEL = the ID of the channel you're running SSH in (the bot must be a member of this channel)

SSH_HOST = the IP of the server to SSH into, e.g. 123.456.78.90. Only port 22 is supported right now.
SSH_USER = login name of the user you're SSHing into

SSH_PRIVATE_KEY_PATH = absolute path to your SSH private key file. (NOT REQUIRED WHEN RUNNING IN DOCKER, SEE BELOW)
```

### Running in Docker

When running in Docker, pass your base64-encoded private key as a build arg named `SSH_PRIVATE_KEY`. The `SSH_PRIVATE_KEY_PATH` env variable is NOT required in this case.