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 20 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 .Fl B Ar port:host:hostport
24 .Fl b Ar addr
25 .Op Fl t Ar timeout
26 .Ar destination
27 .Ek
28 .Sh DESCRIPTION
29 .Nm
30 binds the local
31 .Ar addr
32 and lazily spawns an
33 .Xr ssh 1
34 instance to forward the traffic to a remote end.
35 After
36 .Ar timeout
37 seconds
38 from the last client activity, the ssh tunnel is closed.
39 .Pp
40 The
41 .Xr ssh 1
42 tunnel is established by running
43 .Bk
44 .Pa /usr/bin/ssh
45 .Fl L Ar port:host:hostport
46 .Fl NTq
47 .Ar destination .
48 .Ek
49 .Pp
50 The arguments are as follows:
51 .Bl -tag -width Ds
52 .It Fl B Ar port:host:hostport
53 Fed to
54 .Xr ssh 1
55 .Fl L
56 flag.
57 .It Fl b Ar addr
58 Where to bind the local socket.
59 A port number or the tuple host:port.
60 .It Fl t Ar timeout
61 Number of seconds after after the last client shutdown to kill the ssh
62 process.
63 Defaults to 120.
64 .El
65 .Sh AUTHORS
66 .An -nosplit
67 The
68 .Nm
69 utility was written by
70 .An Omar Polo Aq Mt op@omarpolo.com .
71 .Sh CAVEATS
72 There's a 5 second timeout after spawning
73 .Xr ssh 1
74 to wait for the tunnel to be established.
75 It should really sleep for a little less
76 .Pq say one second
77 and then retry to connect multiple times until it succeed.
78 .Pp
79 Currently it's impossible to pass flags to the
80 .Xr ssh 1
81 subcommand.
82 This is especially painful when you need to use, say, a jump host.