Blame


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