Blame


1 7b682af0 2021-11-21 op # lstun -- lazy ssh tunnel
2 7b682af0 2021-11-21 op
3 7b682af0 2021-11-21 op lstun is a simple utility to lazily (on demand) spawn a ssh tunnel to
4 814d74c9 2022-07-30 op a remote machine and optionally kill it after some time of inactivity.
5 7b682af0 2021-11-21 op
6 814d74c9 2022-07-30 op The only dependency is libevent. It expects ssh to be `/usr/bin/ssh`,
7 814d74c9 2022-07-30 op compile with `-DSSH_PATH=...` to alter the path eventually.
8 2cb54b16 2022-02-26 op
9 7b682af0 2021-11-21 op To compile it just run
10 7b682af0 2021-11-21 op
11 814d74c9 2022-07-30 op $ ./configure
12 56be64f8 2021-11-25 op $ make
13 814d74c9 2022-07-30 op # make install # eventually
14 7b682af0 2021-11-21 op
15 814d74c9 2022-07-30 op The build can be customized by passing arguments to the configure
16 814d74c9 2022-07-30 op script or by using a `configure.local` file; see `./configure -h` and
17 814d74c9 2022-07-30 op [`configure.local.example`](configure.local.example) for more
18 814d74c9 2022-07-30 op information.
19 7b682af0 2021-11-21 op
20 814d74c9 2022-07-30 op The `configure` script can use pkg-config if available to find the
21 814d74c9 2022-07-30 op flags for libevent. To disable the usage of it, pass
22 814d74c9 2022-07-30 op `PKG_CONFIG=false` to the configure script.
23 355ad914 2021-12-01 op
24 814d74c9 2022-07-30 op For Linux users with libbsd installed, the configure script can be
25 814d74c9 2022-07-30 op instructed to use libbsd instead of the bundled compats as follows:
26 814d74c9 2022-07-30 op
27 814d74c9 2022-07-30 op CFLAGS="$(pkg-config --cflags libbsd-overlay)" \
28 814d74c9 2022-07-30 op ./configure LDFLAGS="$(pkg-config --libs libbsd-overlay)"
29 814d74c9 2022-07-30 op
30 814d74c9 2022-07-30 op
31 355ad914 2021-12-01 op ### Usage
32 355ad914 2021-12-01 op
33 355ad914 2021-12-01 op ```
34 355ad914 2021-12-01 op usage: lstun [-dv] -B sshaddr -b addr [-t timeout] destination
35 355ad914 2021-12-01 op ```
36 355ad914 2021-12-01 op
37 814d74c9 2022-07-30 op Check out the [manpage](lstun.1) for the usage.
38 355ad914 2021-12-01 op
39 355ad914 2021-12-01 op
40 355ad914 2021-12-01 op ### Motivation
41 355ad914 2021-12-01 op
42 355ad914 2021-12-01 op It was written to forward lazily all the traffic on the local port
43 355ad914 2021-12-01 op 2525 to a remote port 25, thus using ssh as some sort of
44 355ad914 2021-12-01 op authentication.
45 355ad914 2021-12-01 op
46 355ad914 2021-12-01 op The need for the "lazy" opening and closing of the tunnel is to avoid
47 355ad914 2021-12-01 op wasting resources when not needed.