Coder Social home page Coder Social logo

trendingtechnology / lazyssh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stephank/lazyssh

0.0 0.0 0.0 80 KB

A jump-host SSH server that starts machines on-demand

License: GNU Affero General Public License v3.0

Go 82.68% Shell 8.84% Nix 8.49%

lazyssh's Introduction

LazySSH

LazySSH is an SSH server that acts as a jump host only, and dynamically starts temporary virtual machines.

If you find yourself briefly starting a virtual machine just to SSH into it and try something out, LazySSH is an attempt to automate that flow via just the ssh command. LazySSH starts the machine for you when you connect, and shuts it down (some time after) you disconnect.

Another possible use is to have LazySSH sit in front of a build server to start specific types of machines for your build. (Think different CPU architectures or operating systems.)

Important: LazySSH is a young piece of code. If you're going to use it to create resources that cost money (like AWS EC2 instances), keep a close eye on usage. If, for example, you put your laptop to sleep at the wrong time, or LazySSH crashes for whatever reason, it may leave resources running.

Important: The security of LazySSH has not been tested in any way, so it's probably best to run it in a closed setting. (Not facing the public internet or otherwise firewalled.) The SSH server implementation is based on golang.org/x/crypto.

License: AGPL v3

Usage

There are several ways to get LazySSH:

  • Grab a binary from the releases page.

  • Docker images are available on Docker Hub as stephank/lazyssh.

  • Nix users, whether you use flakes or not, see the documentation in flake.nix.

  • If you instead want to build LazySSH yourself, you need at least Go 1.13, then just go build.

You need to generate an SSH host key and client key. The host key is what the server uses to identify itself, while the client key is what you connect with.

# Both of these also generate a .pub file with the public half of the key pair.
ssh-keygen -t ed25519 -f lazyssh_host_key
ssh-keygen -t ed25519 -f lazyssh_client_key

Now create a config.hcl file that looks like:

server {
  # Set this to the contents of lazyssh_host_key generated above.
  host_key = <<-EOF
    -----BEGIN OPENSSH PRIVATE KEY-----
    [...]
    -----END OPENSSH PRIVATE KEY-----
  EOF

  # Set this to the contents of lazyssh_client_key.pub generated above.
  authorized_key = <<-EOF
    ssh-ed25519 [...]
  EOF
}

The server block is followed by one or more target blocks. Here are the types of targets currently supported, and links to the documentation:

Once your config is ready, you can start the server:

./lazyssh -config ./config.hcl

Using Docker? You can start the container with, for example:

docker run \
  -p 7922:7922 \
  -v /path/to/config.hcl:/config.hcl:ro \
  stephank/lazyssh

You usually need an entry for LazySSH in your ~/.ssh/config, because the ssh command otherwise doesn't make all options available for jump-hosts. Here is a sample config:

Host lazyssh
  Hostname localhost
  Port 7922
  User jump
  PreferredAuthentications publickey
  IdentityFile ~/path/to/lazyssh_client_key
  IdentitiesOnly yes

Now you should be ready to go:

ssh -J lazyssh user@mytarget

For more details, see the included documentation.

lazyssh's People

Contributors

arnarg avatar marcopolo avatar stephank avatar tasdomas avatar

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.