Skip to content
/ portal Public

Quickly connect to and manage SSH favorite connections from CLI

License

Notifications You must be signed in to change notification settings

alexejk/portal

Repository files navigation

Portal

GitHub Workflow Status Go Report Card

GitHub GitHub release (latest SemVer)

Simple tool to quickly connect to favorite servers, including creation of SSH tunnels.

Status

This project is very much in it's initial, experimental phase. Use at your own risk.

Features

Portal provides following set of features that one could find useful:

  • Bookmark-like feature for SSH connections - simply run portal connect <name>
  • Support for complex connections such as multi-hop SSH tunnels
  • Support for connections with AWS EC2 Instance Connect by temporarily pushing SSH key to the instance
  • Provides (potentially )useful hints upon established connection, e.g what ports are being forwarded

Usage

Configuration

Configuration file is looked for at ~/.portal/config.yaml.

---
debug: false

default-public-key: ~/.ssh/id_rsa.pub
default-private-key: ~/.ssh/id_rsa

# List of all known destinations
portals:

  # Tunnel
  - name: server1.tunnel
    hint: Port 3000
    raw:
      command: ssh -L 3000:localhost:8080 [email protected]

  # Direct connection
  - name: server.prod.bastion
    raw:
      command: ssh -A [email protected]
  
  # Double tunnel
  - name: server.prod.tunnel
    hint: Local 33333 -> 12345 @ backend.dot.ip via bastion.dot.ip
    raw:
      command: ssh -L 33333:localhost:33333 -A [email protected] ssh -L 33333:localhost:12345 -A [email protected]
  
  # AWS EC2 Instance Connect
  - name: aws.host
    aws:
      instance-id: i-1234abcd
      region: us-west-1
      user: ec2-user

Supported Commands

  • Get all available connections:
    portal list
  • Connect to a server:
    portal connect <name> where <name> is the favorite name

TODOs

See separate TODO document for what is planned.

Building

Simply run make all or make build-in-docker if you have Docker installed

License

MIT license, as described in the LICENSE file.