Skip to main content

a zc.buildout recipe to make on-demand ssh tunnel

Project description


a zc.buildout recipe to make on-demand ssh tunnels i.e. ssh -L, using systemd socket activation.


Local side Remote side
systemd sshd
ssh nc

Usage example


This package is in its planning stage. Everything can be changed at any time.

In your buildout.cfg, define a zc.recipe.deployment section:

parts =

recipe = zc.recipe.deployment
prefix = FOO-DIR
etc-user = MY-USERNAME

Then define a tunnel socket in the deployment:

recipe = mete0r.recipe.sshtunnel
deployment = foo = mysql.sock
ssh.process.user = MY-USERNAME
ssh.hostname =
remote.bind =

On buildout run, two systemd unit files will be created:

$ ls -l ~/.config/systemd/user/

Then you can start the listening socket:

$ systemctl --user start foo-db.socket
$ systemctl --user list-sockets --all
LISTEN                         UNIT          ACTIVATES
FOO-DIR/var/run/foo/mysql.sock foo-db.socket foo-db@0.service

Test it:

$ mysql --socket=FOO-DIR/var/run/foo/mysql.sock

Enable it to persist:

$ systemctl --user enable foo-db.socket

Development environment

To setup development environment:

python virtualenv


0.0.1 (2016-11-10)

  • Fix service unit ‘User=’ configuration for non-root users.

0.0.0 (2016-11-10)

  • Initial release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mete0r.recipe.sshtunnel, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size mete0r.recipe.sshtunnel-0.0.1.tar.gz (75.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page