Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Make jumphosts and knock easier without messing up your ssh config

License

Notifications You must be signed in to change notification settings

timo-reymann/ssh-knock-interceptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssh-knock-interceptor

LICENSE Renovate


Make jumphosts and knock easier without messing up your ssh config.

Features

  • Consolidate ssh knock config into dedicated config file
  • No dependency on knockd

Requirements

Installation

  1. Clone the repo in your home folder: git clone https://github.com/timo-reymann/ssh-knock-interceptor.git $HOME/.ssh-knock-interceptor

Usage

  1. Add to your ssh config:
    Host *.example.com
       ProxyCommand bash -c 'source $HOME/.ssh-knock-interceptor/init %h %p'
  2. Create the config file for the knock hosts in .ssh/knock-config:
    [app*.example.com]
    sequence = 1000 2000 3000
    host     = jumphost-apps.example.com
    
    [web*.example.com]
    sequence = 1001 2001 3001
    host     = jumphost-webservers.example.com
    
    [advanced*.example.com]
    use_udp  = true
    sequence = 1001 2001:tcp 3001
    host     = jumphost-webservers.example.com

Motivation

Maintaining knock commands in your ssh config becomes a huge mess over time.

Documentation

How it works

It consists of three parts:

  • Python script
    • parse and validate ini file
    • knock with python
  • Bash wrapper
    • to source env vars
    • execute ssh command in same tty
  • Integration into existing ssh config

Contributing

I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing the current state of the configuration
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

To get started please read the Contribution Guidelines.

Development