Blob


1 .\" Copyright (c) 2021 Omar Polo <op@omarpolo.com>
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
6 .\"
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 .Dd $Mdocdate: November 23 2021$
15 .Dt LSTUN 1
16 .Os
17 .Sh NAME
18 .Nm lstun
19 .Nd lazy ssh tunnel
20 .Sh SYNOPSIS
21 .Nm
22 .Bk -words
23 .Op Fl dv
24 .Fl B Ar sshaddr
25 .Fl b Ar addr
26 .Op Fl t Ar timeout
27 .Ar destination
28 .Ek
29 .Sh DESCRIPTION
30 .Nm
31 binds the local
32 .Ar addr
33 and lazily spawns an
34 .Xr ssh 1
35 instance to forward the traffic to a remote end.
36 After
37 .Ar timeout
38 seconds
39 from the last client activity, the ssh tunnel is closed.
40 .Pp
41 The
42 .Xr ssh 1
43 tunnel is established by running
44 .Bk
45 .Pa ssh
46 .Fl L Ar sshaddr
47 .Fl NTq
48 .Ar destination .
49 .Ek
50 .Pp
51 The arguments are as follows:
52 .Bl -tag -width Ds
53 .It Fl B Xo
54 .Sm off
55 .Oo Ar bind_address : Oc
56 .Ar port : host : hostport
57 .Sm on
58 .Xc
59 Fed to
60 .Xr ssh 1
61 .Fl L
62 flag.
63 .It Fl b Ar addr
64 Where to bind the local socket.
65 A port number or the tuple host:port.
66 .It Fl d
67 Do not daemonize.
68 .Nm
69 will run in the foregound and log to
70 .Em stderr .
71 .It Fl t Ar timeout
72 Number of seconds after the last client shutdown to kill the ssh
73 process.
74 Set to zero to keep the tunnel open indefinitely.
75 Defaults to 120.
76 .It Fl v
77 Produce more verbose output.
78 .El
79 .Sh AUTHORS
80 .An -nosplit
81 The
82 .Nm
83 utility was written by
84 .An Omar Polo Aq Mt op@omarpolo.com .
85 .Sh CAVEATS
86 Currently it's impossible to pass flags to the
87 .Xr ssh 1
88 sub command.
89 This is especially painful when you need to use, say, a jump host.