summaryrefslogtreecommitdiff
path: root/usr.sbin/faithd/faithd.8
blob: 25e043225c20ca909d8a14c19e472d549b3ee2d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
.\"	$OpenBSD: faithd.8,v 1.32 2007/05/31 19:20:23 jmc Exp $
.\"	$KAME: faithd.8,v 1.36 2002/05/09 13:59:16 itojun Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the project nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: May 31 2007 $
.Dt FAITHD 8
.Os
.Sh NAME
.Nm faithd
.Nd FAITH IPv6/v4 translator daemon
.Sh SYNOPSIS
.Nm
.Op Fl dp
.Op Fl f Ar configfile
.Ar service
.Op Ar serverpath Op Ar serverargs
.\".Nm ""
.Sh DESCRIPTION
.Nm
provides an IPv6-to-IPv4 TCP relay.
.Nm
must be used on an IPv4/v6 dual stack router.
.Pp
When
.Nm
receives
.Tn TCPv6
traffic,
.Nm
will relay the
.Tn TCPv6
traffic to
.Tn TCPv4 .
The destination for the relayed
.Tn TCPv4
connection is determined by the last 4 octets of the original
.Tn IPv6
destination.
For example, if
.Li 3ffe:0501:4819:ffff::
is reserved for
.Nm faithd ,
and the
.Tn TCPv6
destination address is
.Li 3ffe:0501:4819:ffff::0a01:0101 ,
the traffic is relayed to IPv4 destination
.Li 10.1.1.1 .
.Pp
To use the
.Nm
translation service,
an IPv6 address prefix must be reserved for mapping IPv4 addresses onto.
The kernel must be properly configured to route all the TCP connections
toward the reserved IPv6 address prefix into the
.Xr faith 4
pseudo interface, by using the
.Xr route 8
command.
Also,
.Xr sysctl 8
should be used to configure
.Dv net.inet6.ip6.keepfaith
to
.Dv 1 .
.Pp
The router must be configured to capture all the TCP traffic
for a given reserved
.Tn IPv6
address prefix, by using the
.Xr route 8
and
.Xr sysctl 8
commands.
.Pp
.Nm
needs a special name-to-address translation logic, so that
hostnames get resolved into a special
.Tn IPv6
address prefix.
For small-scale installation, use
.Xr hosts 5 .
For large-scale installation, it is useful to have
a DNS server with special address translation support.
An implementation called
.Nm totd
is available
at
.Pa http://www.vermicelli.pasta.cs.uit.no/ipv6/software.html .
Make sure you do not propagate translated DNS records to normal DNS cloud,
it is highly harmful.
.\".Ss Daemon mode
When
.Nm
.\"is invoked as a stand-alone program,
is invoked,
.Nm
will daemonize itself.
.Nm
will listen to
.Tn TCPv6
port
.Ar service .
If
.Tn TCPv6
traffic to port
.Ar service
is found, it relays the connection.
.Pp
Since
.Nm
listens to TCP port
.Ar service ,
it is not possible to run local TCP daemons for port
.Ar service
on the router, using
.Xr inetd 8
or other standard mechanisms.
Local daemons can be run on the router
by specifying a
.Ar serverpath
to
.Nm faithd .
.Nm
will invoke a local daemon at
.Ar serverpath
if the destination address is a local interface address,
and will perform translation to IPv4 TCP in other cases.
.Ar Serverargs
can also be specified as
arguments for the local daemon.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl d
Debugging information will be generated using
.Xr syslog 3 .
.It Fl f Ar configfile
Specify a configuration file for access control.
See below.
.It Fl p
Use the privileged TCP port number as a source port,
for an IPv4 TCP connection toward the final destination.
For relaying
.Xr ftp 1
this flag is not necessary as special program code is supplied.
.El
.Pp
.Nm
will relay both normal and out-of-band TCP data.
It is capable of emulating TCP half close as well.
.Nm
includes special support for protocols used by
.Xr ftp 1 .
When translating FTP protocol,
.Nm
translates network level addresses in
.Li PORT/LPRT/EPRT
and
.Li PASV/LPSV/EPSV
commands.
.Pp
Inactive sessions will be disconnected in 30 minutes,
to avoid stale sessions from chewing up resources.
This may be inappropriate for some of the services
.Pq should this be configurable? .
.Ss Access control
To prevent malicious access,
.Nm
implements a simple address-based access control.
With
.Pa /etc/faithd.conf
.Po
or
.Ar configfile
specified by
.Fl f
.Pc ,
.Nm
will avoid relaying unwanted traffic.
.Pa faithd.conf
contains directives with the following format:
.Bl -bullet
.It
.Xo
.Ar src/slen Li deny Ar dst/dlen
.Xc
.Pp
If the source address of a query matches
.Ar src/slen ,
and the translated destination address matches
.Ar dst/dlen ,
deny the connection.
.It
.Xo
.Ar src/slen Li permit Ar dst/dlen
.Xc
.Pp
If the source address of a query matches
.Ar src/slen ,
and the translated destination address matches
.Ar dst/dlen ,
permit the connection.
.El
.Pp
The directives are evaluated in sequence,
and the first matching entry will be effective.
If there is no match
.Pq the end of the ruleset has been reached ,
the traffic is denied.
.\".Pp
.\"With inetd mode,
.\"traffic may be filtered by using access control functionality in
.\".Xr inetd 8 .
.Sh RETURN VALUES
.Nm
exits with
.Dv EXIT_SUCCESS
.Pq 0
on success, and
.Dv EXIT_FAILURE
.Pq 1
on error.
.Sh EXAMPLES
Before invoking
.Nm faithd ,
the
.Xr faith 4
interface has to be configured properly:
.Bd -literal -offset indent
# sysctl net.inet6.ip6.accept_rtadv=0
# sysctl net.inet6.ip6.forwarding=1
# sysctl net.inet6.ip6.keepfaith=1
# ifconfig faith0 up
# route add -inet6 3ffe:501:4819:ffff:: -prefixlen 96 ::1
# route change -inet6 3ffe:501:4819:ffff:: -prefixlen 96 -ifp faith0
.Ed
.\".Ss Daemon mode samples
.Pp
To translate
.Li telnet
service, and provide no local telnet service, invoke
.Nm
as follows:
.Pp
.Dl # faithd telnet
.Pp
Pass extra arguments to the local daemon:
.Pp
.Dl # faithd ftp /usr/libexec/ftpd ftpd -l
.Ss Access control samples
The following illustrates a simple
.Pa faithd.conf
setting.
.Bd -literal -offset indent
# Permit anyone from 3ffe:501:ffff::/48 to use the translator,
# to connect to the following IPv4 destinations:
# - any location except 10.0.0.0/8 and 127.0.0.0/8.
# Permit no other connections.
#
3ffe:501:ffff::/48 deny 10.0.0.0/8
3ffe:501:ffff::/48 deny 127.0.0.0/8
3ffe:501:ffff::/48 permit 0.0.0.0/0
.Ed
.Sh SEE ALSO
.Xr faith 4 ,
.Xr route 8 ,
.Xr sysctl 8
.Rs
.%A Jun-ichiro itojun Hagino
.%A Kazu Yamamoto
.%T "An IPv6-to-IPv4 transport relay translator"
.%B RFC 3142
.%O ftp://ftp.isi.edu/in-notes/rfc3142.txt
.%D June 2001
.Re
.\"
.Sh HISTORY
The
.Nm
command first appeared in the WIDE Hydrangea IPv6 protocol stack kit.
.\"
.Sh SECURITY CONSIDERATIONS
It is very insecure to use IP-address-based authentication
for connections relayed by
.Nm .
.Pp
Administrators are advised to limit access to
.Nm
using
.Pa faithd.conf ,
or by using IPv6 packet filters,
to protect the
.Nm
service from malicious parties and avoid theft of service/bandwidth.
IPv6 destination addresses can be limited by
carefully configuring routing entries that point to
.Xr faith 4 ,
using
.Xr route 8 .
IPv6 source addresses need to be filtered using a packet filter.
The documents listed in
.Sx SEE ALSO
have more discussions on this topic.