Giter Club home page Giter Club logo

bb8bot's Introduction

bb8bot

Slack bot to run SSH commands.

Build

docker build -t bb8bot . 

Run

docker run --name bb8bot -v /you_host_dir/config.toml:/etc/bb8bot/config.toml bb8bot

Configuration

Bot settings

[settings]
    # Bot description
    description = "My name is *bb8bot* and i can run ssh commands on remote hosts."
    # slack token for your bot user
    token = "YOUR SLACK TOKEN"
    # long command output will be splitted by maxSymbolsPerMessage
    maxSymbolsPerMessage = 3000
    # splitted long command output messages will be truncated after maxMessages
    maxMessages = 5
    # ssh command timeout for all commands (can be overridden on command config section)
    timeout = "30s"
    # users that can use bot (if this parameter not set - all users can)
    users = ["URG2CGE2D", "URG3DGE7M"]
    # channels in what bot can be used (if this parameter not set - bot can used in any channel)
    channels = ["CRKR3KRN3"]
    # for admins users and channels restrictions will be skipped
    admins = ["URG2EGE1K"]

Host configuration

[[host]]
    # host id that could be used in command host parameter
    id = "localhost"
    # host address
    address = "localhost"
    # host ssh port
    port = 22
    
    # public key auth
    [host.auth]    
        type = "publickey"
        username = "your_user"
        privateKeyPath = "~/.ssh/your_private_key"
        passphrase = "your_passphrase"

You can also use password authentication instead of publickey:

    # password auth
    [host.auth]
        type = "password"
        username = "your_user"
        password = "your_pass"

Group commands configuration

[[group]]
    # group id (should be unique for all bot groups)
    id = "unix"
    # group description will be used in the group help
    description = "Unix useful commands"
    # hosts ids that this group can be used with
    hosts = ["localhost", "somehost"]

    [[group.command]]
        # command id (should be unique for bot this group)
        id="memory"
        # command description will be used in the command help
        description = "Display amount of free and used memory in the system"
        # real ssh command template
        cmdFmt="free -th"

    [[group.command]]
        id = "lsof"
        description = "List open connections"
        # command template with arguments
        cmdFmt = "lsof -i %s -P"
        # override bot settings
        maxSymbolsPerMessage = 2000
        # override bot settings
        maxMessages = 10
        # arguments ids
        arguments = ["protocol"]

    [[group.argument]]
        # argument id (should be unique for bot this group)
        id = "protocol"
        # argument description will be used in the command help
        description = "Supported protocols"

        [[group.argument.item]]
            # value that will be used by user
            name = "ssh"
            # value that will be used by command template
            value = ":22"

bb8bot's People

Contributors

karlovskiy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

davidcn47

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.