https://github.com/timo-reymann/ssh-knock-interceptor
Make jumphosts and knock easier without messing up your ssh config
https://github.com/timo-reymann/ssh-knock-interceptor
bash knock ssh
Last synced: about 1 year ago
JSON representation
Make jumphosts and knock easier without messing up your ssh config
- Host: GitHub
- URL: https://github.com/timo-reymann/ssh-knock-interceptor
- Owner: timo-reymann
- License: mit
- Created: 2021-11-19T17:12:10.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T17:30:27.000Z (about 2 years ago)
- Last Synced: 2024-05-01T16:50:13.532Z (about 2 years ago)
- Topics: bash, knock, ssh
- Language: Python
- Homepage:
- Size: 81.1 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
ssh-knock-interceptor
===
[](https://github.com/timo-reymann/ssh-knock-interceptor/blob/main/LICENSE)
[](https://renovatebot.com)
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
- [Python 3.6+](https://python.org)
- [bash](https://www.gnu.org/software/bash/)
## 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:
```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`:
```ini
[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](./CONTRIBUTING.md).
## Development
- [Python 3](https://python.org)