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