Manage persistent ssh tunnels and port forwards.
Project description
Manage persistent ssh tunnels and port forwards.
Latest release 20221228: get_ssh_options: be quiet.
Portfwd runs a collection of ssh tunnel commands persistently,
each in its own cs.app.svcd <https://pypi.org/project/cs.app.svcd>_ instance
with all the visibility and process control that SvcD brings.
It reads tunnel preconditions from special comments within the ssh config file.
It uses the configuration options from the config file
as the SvcD signature function
thus restarting particular ssh tunnels when their specific configuration changes.
It has an "automatic" mode (the -A option)
which monitors the desired list of tunnels
from statuses expressed via cs.app.flag <https://pypi.org/project/cs.app.flag>_
which allows live addition or removal of tunnels as needed.
Function Condition(portfwd, op, invert, *args)
Factory to construct a condition from a specification.
Class FlagCondition(_PortfwdCondition)
A flag based condition.
Function main(argv=None, environ=None)
Command line main programme.
Class PingCondition(_PortfwdCondition)
A ping based condition.
Class Portfwd(cs.app.flag.FlaggedMixin)
An ssh tunnel built on a SvcD.
Method Portfwd.__init__(self, target, ssh_config=None, conditions=(), test_shcmd=None, trace=False, verbose=False, flags=None):
Initialise the Portfwd.
Parameters:
target: the tunnel name, and also the name of the ssh configuration usedssh_config: ssh configuration file if not the defaultconditions: an iterable ofConditions which must hold before the tunnel is set up; the tunnel also aborts if these cease to holdtest_shcmd: a shell command which must succeed before the tunnel is set up; the tunnel also aborts if this command subsequently failstrace: issue tracing messages; defaultFalseverbose: be verbose; defaultFalseflags: optional preexistingFlagsinstance
Class Portfwds
A collection of Portfwd instances and associated control methods.
Method Portfwds.__init__(self, ssh_config=None, environ=None, target_list=None, auto_mode=None, trace=False, verbose=False, flags=None):
Initialise the Portfwds instance.
Parameters:
ssh_config: the ssh configuration file if not the defaultenviron: the environment mapping to use; default:os.environtarget_list: an iterable ofPortfwdtarget namesauto_mode: also derive target names from the set of truePORTFWD_name_AUTOflagstrace: trace mode, defaultFalseverbose: verbose mode, defaultFalseflags: thecs.app.flags.Flagsinstance to use, default is to construct a new one
Release Log
Release 20221228: get_ssh_options: be quiet.
Release 20210316:
- Portfwds: accept any iterable for target_list.
- Portability fix.
Release 20190602:
- Support alert groups.
- ssh_argv no longer a property in order to support
bareparam. - New method
ssh_optionsto wrap ssh_argv. - Drop sig_func, use ssh_options instead.
- Remove local UNIX domain socket forward endpoints before starting ssh tunnel.
- Improve option parse.
Release 20170906: Initial PyPI release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cs.app.portfwd-20221228.tar.gz.
File metadata
- Download URL: cs.app.portfwd-20221228.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32eb8ea3619d333ef59aa85a190e4523eeca728f9eed66d13730dd31d2a2ddb2
|
|
| MD5 |
94119fca1d705e460ecd2ecc31f80b9c
|
|
| BLAKE2b-256 |
0cfe5ee50de690e15fb44c709688e78879f6fc42f4a518a442277654d37d7524
|
File details
Details for the file cs.app.portfwd-20221228-py3-none-any.whl.
File metadata
- Download URL: cs.app.portfwd-20221228-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
611d5885593e05e98484957fffeaca43f962b8ec91bd25d445d562dce7ad0dfc
|
|
| MD5 |
0106a0b0af9f2a17baa65eb8813011c3
|
|
| BLAKE2b-256 |
9a3913b0922efa68c44826d4d27de521704f32e0f84beeae51a188cb5b96b477
|