Skip to content

gradeup/ssh-manager

SSH-Manager

Manage Employee public keys centrally onto all servers

license

Prerequisites

  • Postgres (9.6+)
  • Go (1.13+)

Installation

Configuration

  • POSTGRES_HOST
    Endpoint for postgres server, defaults to 127.0.0.1
  • POSTGRES_PORT=5432
    Port used for postgres server, defaults to 5432
  • POSTGRES_USER=postgres
    Username for postgres server, defaults to postgres
  • POSTGRES_PASSWORD=postgres
    Password for postgres server, defualts to postgres
  • POSTGRES_DATABASE=sshmanager
    Database used for ssh manager in postgres, defaults to postgres
  • PRIVATE_KEY_PATH=/.ssh/id_rsa
    Path to private key which has access to all servers that will be managed by this service, defaults to /home/ubuntu/.ssh/id_rsa
  • PUBLIC_KEY_PATH=/.ssh/id_rsa.pub
    Path to public key which needs to be available on all instances to be managed by this service, defaults to /home/ubuntu/.ssh/id_rsa.pub
  • SERVICE_PORT=8000
    Port to start ssh-manager web service on, defaults to 8000

Steps for local setup

  • Start a local postgres server (via docker/native installation as a service)
  • $ cp .env.example .env
  • Modify .env variables as per configuration
  • $ go run main.go
  • Head over to http://localhost:8000

TODOs

  • Use POST requests for modifying data
  • Add Role based Users (oAuth implementaion as well)
  • Implement CSRF tokens
  • Add option to use single user instances or create seperate users on instances
  • Pick instance username from servers (if single user machine), else use user's name
  • Add Listen Address from env (0.0.0.0 or 127.0.0.1 or some private IP)
  • Support Private Key as a string from env instead of just file read
  • Validate User inputs (unique username/email, trim spaces/special chars)

Licence

Please observe the Apache 2.0 license that is listed in this repository.