Add some magic to SSH and .ssh/config
Project description
Enhances ssh_config file capabilities
NOTE: This program is called by ProxyCommand from lib-ssh.
It works transparently with :
ssh
scp
rsync
git
and even desktop applications depending on lib-ssh (for instance Tower, Atom.io, SSH Tunnel Manager)
The .ssh/config file is automatically generated, you need to update .ssh/config.advanced file instead; With new features and a better regex engine for the hostnames.
Note: Each time the script is called, it recreate a fresh new ``.ssh/config``, so be careful, backup your old .ssh/config file !
Commmand line features
Gateway chaining
ssh foo.com/bar.com
Connect to bar.com using ssh and create a proxy on bar.com to foo.com. Then connect to foo.com using the created proxy on bar.com.
ssh foo.com/bar.com/baz.com
Connect to foo.com using bar.com/baz.com which itself uses baz.com.
Configuration features
regex for hostnames - gw.school-..domain.net
aliases
gateways - transparent ssh connections chaining
includes files
real local command - executes a command on the local shell when connecting
intelligent proxycommand with fallbacks
inherits configuration
variable expansion
Config example
~/.ssh/config.advanced
# Simple example [foo.com] user = pacman port = 2222 [bar] hostname = 1.2.3.4 gateways = foo.com # `ssh bar` will use `foo.com` as gateway [default] ProxyCommand = advanced-ssh-config --hostname=%h --port=%p -u
# Complete example [foo] user = pacman port = 2222 hostname = foo.com [bar] hostname = 1.2.3.4 gateways = foo # By running `ssh bar`, you will ssh to `bar` through a `ssh foo` [vm-.*\.joe\.com] IdentityFile = ~/.ssh/root-joe gateways = direct joe.com joe.com/bar # Will try to ssh without proxy, then fallback to joe.com proxy, then fallback to joe.com through bar DynamicForward = 43217 LocalForward = 1723 localhost:1723 ForwardX11 = yes [default] Includes = ~/.ssh/config.advanced2 ~/.ssh/config.advanced3 Port = 22 User = root IdentityFile = ~/.ssh/id_rsa ProxyCommand = advanced-ssh-config --hostname=%h --port=%p -u Gateways = direct PubkeyAuthentication = yes VisualHostKey = yes ControlMaster = auto ControlPath = ~/.ssh/controlmaster/%h-%p-%r.sock EscapeChar = ~
Installation
From Pypi
# pip install advanced-ssh-config
Or by cloning
# git clone https://github.com/moul/advanced-ssh-config # cd advanced-ssh-config # python setup.py install
Backup your old ~/.ssh/config file
# cp ~/.ssh/config ~/.ssh/config.backup
Generate the new config file
# advanced-ssh-config -u
Or add this line manually in your ~/.ssh/config file
... ProxyCommand = advanced-ssh-config --hostname=%h --port=%p -u ...
Tests
Install test dependencies and run tests
# python setup.py test
Pep8
# pep8 advanced_ssh_config | grep -v /tests/
Docker
Build
# docker build -t moul/advanced-ssh-config .
Run
# docker run -rm -i -t moul/advanced-ssh-config or # docker run -rm -i -t -v $(pwd)/:/advanced_ssh_config moul/advanced-ssh-config or # docker run -rm -i -t -v moul/advanced-ssh-config python setup.py test
Contributors
–
© 2009-2015 Manfred Touron - MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file advanced-ssh-config-1.0.0.tar.gz
.
File metadata
- Download URL: advanced-ssh-config-1.0.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed0bdc926228362dff13c859e1310c4effa67e03ecec45ad6826674c2f4a61ae |
|
MD5 | 4e0f1ddf9e462f25e7038d819968fed8 |
|
BLAKE2b-256 | bd3ab5f397fbedbce30f2310562f5289db6507cc153d7eeb6db05db47e4c5adc |
File details
Details for the file advanced_ssh_config-1.0.0-py27-none-any.whl
.
File metadata
- Download URL: advanced_ssh_config-1.0.0-py27-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 2.7
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fce705d1f09cd07639705bcaffc69bb3254c77677d586cbe51f2c9369a01f83 |
|
MD5 | 74d55160922c7a1daf8f52768200f92e |
|
BLAKE2b-256 | 50d448aa7ea1bf33160cee9d8c7954f4f14ee4a33859bc0c3d6476340846e605 |
File details
Details for the file advanced_ssh_config-1.0.0-py26-none-any.whl
.
File metadata
- Download URL: advanced_ssh_config-1.0.0-py26-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 2.6
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55c75ab98bc05c75e524b159567e57f0e33dbf588c60442140e7e02674ec42e5 |
|
MD5 | 30e0d9ea5c636b37d4863f1f7dfbb961 |
|
BLAKE2b-256 | e4907665b4edbc8ead9421bdb15712cd879d9723444516ee0c93af70cf2982e3 |
File details
Details for the file advanced_ssh_config-1.0.0-py2.7.egg
.
File metadata
- Download URL: advanced_ssh_config-1.0.0-py2.7.egg
- Upload date:
- Size: 48.8 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df32254316e7f67cd904a02d3274e020f7f3eab447e21086088fc4dea202b4c2 |
|
MD5 | f63fa9b4494b8cbb68d3dbe51780b06c |
|
BLAKE2b-256 | 8c33b8ce8f2c0a8f7fb176783c33288ef3b6579a8fdf2bb739e2397afaeb5e74 |
File details
Details for the file advanced_ssh_config-1.0.0-py2.6.egg
.
File metadata
- Download URL: advanced_ssh_config-1.0.0-py2.6.egg
- Upload date:
- Size: 49.1 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 373405a6d708cbdbf4ce5d69743fbd6dfc2e66fff9fd4d5fc6c6b3dd890a3ad7 |
|
MD5 | 3dcecbb4cee098f0c231c65aa49dacf6 |
|
BLAKE2b-256 | 1ecaf67e97cbd2b5ca93db2943ae86897ea87e2d219015048fc5fbeac6d87308 |
File details
Details for the file advanced-ssh-config-1.0.0.macosx-10.10-intel.tar.gz
.
File metadata
- Download URL: advanced-ssh-config-1.0.0.macosx-10.10-intel.tar.gz
- Upload date:
- Size: 37.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5c8e0016e2b6484e5201ab635cd3f00e85b711e145a3f5e4e4f58cf0010d28a |
|
MD5 | e76b705d0775a45ccf72636953f55010 |
|
BLAKE2b-256 | 47480cc89f255adf72778b3d1050f37046f370840369bdc061e5680adb7977bf |