Make SSH apps, just like that! 💫

Related tags

Command Line wish
Overview

Wish

A nice rendering of a star, anthropomorphized somewhat by means of a smile, with the words ‘Charm Wish’ next to it
Latest Release GoDoc Build Status

Make SSH apps, just like that! 💫

SSH is an excellent platform to build remotely accessible applications on. It offers secure communication without the hassle of HTTPS certificates, it has user identification with SSH keys and it's accessible from anywhere with a terminal. Powerful protocols like Git work over SSH and you can even render TUIs directly over an SSH connection.

Wish is an SSH server with sensible defaults and a collection of middleware that makes building SSH apps easy. Wish is built on gliderlabs/ssh and should be easy to integrate into any existing projects.

Middleware

Bubble Tea

The bubbletea middleware makes it easy to serve any Bubble Tea application over SSH. Each SSH session will get their own tea.Program with the SSH pty input and output connected. Client window dimension and resize messages are also natively handled by the tea.Program.

You can see a demo of the Wish middleware in action at: ssh git.charm.sh

Git

The git middleware adds git server functionality to any ssh server. It supports repo creation on initial push and custom public key based auth.

This middleware requires that git is installed on the server.

Logging

The logging middleware provides basic connection logging. Connects are logged with the remote address, invoked command, TERM setting, window dimensions and if the auth was public key based. Disconnect will log the remote address and connection duration.

Access Control

Not all applications will support general SSH connections. To restrict access to supported methods, you can use the activeterm middleware to only allow connections with active terminals connected and the accesscontrol middleware that lets you specify allowed commands.

Default Server

Wish includes the ability to easily create an always authenticating default SSH server with automatic server key generation.

Examples

There are examples for a standalone Bubble Tea application and Git server in the examples folder. To see a more real-world application that combines Bubble Tea and Git, you can take a look at Soft Serve which uses Git as a CMS and provides a TUI over SSH for interacting with pushed repos.

Pro Tip

When building various Wish applications locally you can add the following to your ~/.ssh/config to avoid having to clear out localhost entries in your ~/.ssh/known_hosts file:

Host localhost
    UserKnownHostsFile /dev/null

License

MIT


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source

Issues
  • Directory Traversal

    Directory Traversal

    Repo paths are not properly sanitized so users can access repos outside the designated repo dir.

    Users with read access will be able to access repos outside the directory, and users with write permissions have the ability to write outside that directory as well.

    A quick example that sort of demonstrates whats happening is just to run

    git clone 'ssh://git.charm.sh/soft-serve/../glow'
    

    That example doesnt demonstrate reading outside the repo directory (because I dont know where there may be repos on that server) but it does show that it walks the directory path just fine including the ... An attacker could implement some scanning logic to find other repos they arent supposed to have access to.

    opened by zachhanson94 2
  • terminal not restored properly

    terminal not restored properly

    When the connection gets closed by the remote host, the terminal gets not restored properly. e.g. the cursor is missing

    opened by jon4hz 2
  • Add git hooks and auth

    Add git hooks and auth

    This PR adds a GitHooks interface that allows for custom auth and push/fetch callbacks. This allows implementors to have fine grained control over repo access according to their application needs.

    opened by toby 1
  • feat: ttl middleware

    feat: ttl middleware

    users can use ttl.Middleware(10*time.Minute), for example, to set a 10m max life for a SSH session.

    opened by caarlos0 1
  • docs: examples using graceful shutdown

    docs: examples using graceful shutdown

    change the examples to use graceful shutdown, as its usually a good thing.

    opened by caarlos0 0
  • test: add tests for git middleware

    test: add tests for git middleware

    added tests for the git middleware

    extracted from #28

    enhancement 
    opened by caarlos0 0
  • refactor: fix all linter issues

    refactor: fix all linter issues

    fixes/ignores everything golangci-lint is complaining about.

    enhancement 
    opened by caarlos0 0
  • refactor: rename BubbleTeaHandler to Handler

    refactor: rename BubbleTeaHandler to Handler

    this fixes a lint issue and also makes usage a bit nicer, instead of

    bubbletea.BubbleTeaHandler()
    

    you can use

    bubbletea.Handler()
    

    directly, which reads a bit less repetitive.

    This change is backwards-compatible with previous versions. 🙏

    enhancement 
    opened by caarlos0 0
  • feat: authorized_keys

    feat: authorized_keys

    Added an Option to pass a path to an authorized_keys file, which can then be used to authenticate users.

    User may still provide their own implementations using wish.WithPublicKeyAuth(ssh.PublicKeyHandler).

    enhancement 
    opened by caarlos0 0
  • Sanitize repo file path

    Sanitize repo file path

    • filepath.Clean repo path
    • Only use base element
    • Return invalid repo error if not found

    Fixes #23

    opened by toby 0
  • feat: use go-git to receive and upload pack

    feat: use go-git to receive and upload pack

    closes #7

    enhancement 
    opened by caarlos0 0
  • Use go-git

    Use go-git

    We could use go-git to implement our git middleware instead of using git-upload-pack and git-receive-pack cli. This would also handle all the necessary security a git server would have.

    Implement https://pkg.go.dev/github.com/go-git/go-git/[email protected]/plumbing/transport#Session and https://pkg.go.dev/github.com/go-git/go-git/[email protected]/plumbing/protocol/packp protocols

    opened by aymanbagabas 0
Releases(v0.1.2)
  • v0.1.2(Jan 12, 2022)

    What's Changed

    • docs: Add tip about UserKnownHostsFile setting in local dev by @meowgorithm in https://github.com/charmbracelet/wish/pull/17
    • test: refactor testing code a bit by @caarlos0 in https://github.com/charmbracelet/wish/pull/20
    • feat: WithIdleTimeout and WithMaxTimeout by @caarlos0 in https://github.com/charmbracelet/wish/pull/19
    • fix: improve accesscontrol and activeterm middlewares by @caarlos0 in https://github.com/charmbracelet/wish/pull/21
    • fix: examples showing how to properly shutdown the server by @caarlos0 in https://github.com/charmbracelet/wish/pull/22
    • fix: sanitize repo file path by @toby in https://github.com/charmbracelet/wish/pull/24

    The Charm logo

    Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Dec 6, 2021)

  • v0.1.0(Dec 6, 2021)

Owner
Charm
We build tools to make the command line glamorous
Charm
Get Brew Packages to update, just like you've experienced from Ubuntu

Get the number of Brew Packages to update, just like you've experienced from Ubuntu BrewUpdate is a simple utility written in Go, notify you how many

YeonGyu-Kim 13 Nov 6, 2021
I like reading news but I also like the terminal. I am leaning and practicing my go.

I made an api and didn't know how to use it. Screenshots The initial screen when you first run the app. The screen after you specify an id. This app u

Daniel M. Matongo 1 Jan 12, 2022
Argparse for golang. Just because `flag` sucks

Golang argparse Let's be honest -- Go's standard command line arguments parser flag terribly sucks. It cannot come anywhere close to the Python's argp

Alexey Kamenskiy 392 Jan 6, 2022
An implementation of sed in Go. Just because!

Sed-Go An implementation of sed in Go. Just because! Status Command-Line processing: Done. It accepts '-e', '-f', '-n' and long versions of the same.

rwtodd 108 Jan 13, 2022
Just a simple CLI tool to group dependabot PRs by dependency and merge them.

Dependabotbot Have you been the victim of a lodash update? Has your notification page in Github been assaulted by needing to update a patch version of

Chris Griffing 18 Sep 24, 2021
It is an easy and fast tool to install your packages with just one command.

Trouxa It is an easy and fast tool to install your packages with just one command. What means "Trouxa"? In portuguese, Trouxa means something like a "

Baianoware 6 Dec 29, 2021
react, fiber, api just for saying hello

say-hello Introduction Sometimes we need to have a frontend besides the backend. This repository uses React to show how we can server a React build an

Cloud Native Go by Example 5 Dec 21, 2021
Golisp-wtf - A lisp interpreter (still just a parser) implementation in golang. You may yell "What the fuck!?.." when you see the shitty code.

R6RS Scheme Lisp dialect interpreter This is an implementation of a subset of R6RS Scheme Lisp dialect in golang. The work is still in progress. At th

Vladimir Novikov 0 Jan 7, 2022
A simple, fast, and fun package for building command line apps in Go

cli cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable comm

null 17.2k Jan 22, 2022
A collection of terminal-based widgets for richer Golang CLI apps.

Flinch A collection of terminal-based widgets for richer Golang CLI apps. Ships with a library to build your own widgets/TUIs too. Warning: This modul

Liam Galvin 31 Dec 10, 2021
A tiny markup language for terminal output. Makes formatting output in CLI apps easier!

tml - Terminal Markup Language A Go module (and standalone binary) to make the output of coloured/formatted text in the terminal easier and more reada

Liam Galvin 669 Jan 16, 2022
Viper: a complete configuration solution for Go applications including 12-Factor apps

Viper v2 feedback Viper is heading towards v2 and we would love to hear what you would like to see in it. Share your thoughts here: https://forms.gle/

艹尼玛 不会用 0 Dec 6, 2021
Start Go command line apps with ease

Start Start Go command line apps with ease Executive Summary The start package for Go provides two basic features for command line applications: Read

Christoph Berger 15 Oct 29, 2021
This repository contains example apps created using GoCondor framework

Examples This repository contains example apps created using GoCondor framework what are the examples? 1- Todo API A todo api with the below routes:

Go Condor 0 May 7, 2021
cli is a simple, fast, and fun package for building command line apps in Go.

cli cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable comm

凹语言 1 Jan 8, 2022
This project is used to get familiar with GoLang cli apps, along with cobra generator.

SecretCTL SecretCTL About the project Status Getting started Layout Notes About the project This project is used to get familiar with GoLang cli apps,

Milos Folic 0 Jan 11, 2022
A simple library to build golang command line (cli / cmd)apps

A simple library to build golang command line (cli / cmd)apps

seastart dev team 0 Jan 11, 2022
📡 ssh into browser tab.

tabssh idk Uses TabFS and gilderlabs/ssh. Set your TabFS mount path in tabssh.go. $ go run tabssh.go and $ ssh -o StrictHostKeyChecking=no localhost

Omar Rizwan 59 Oct 7, 2021
Go Library to Execute Commands Over SSH at Scale

Go library to handle tens of thousands SSH connections and execute the command(s) with higher-level API for building network device / server automation.

Yahoo 764 Jan 12, 2022