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
|
.\" $OpenBSD: vpn.8,v 1.5 1998/06/29 05:58:50 angelos Exp $
.\" Copyright 1998 Niels Provos <provos@physnet.uni-hamburg.de>
.\" 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. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Niels Provos.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
.\"
.\" Manual page, using -mandoc macros
.\"
.Dd May 23, 1998
.Dt VPN 8
.Os
.Sh NAME
.Nm vpn
.Nd configuring the system for virtual private networks
.Sh DESCRIPTION
A virtual private network is used to securely connect two or more subnets
over the internet. For each subnet there is a security gateway which is
linked via a cryptographically secured tunnel to the security gateway of
the other subnet.
.Xr ipsec 4
is used to provide the necessary network-layer cryptographic services.
This document describes the configuration process for setting up a
.Nm VPN .
.Pp
Both subnets need to configure
.Xr ipsec 4
routes with the
.Xr ipsecadm 1
tool:
.Pp
On the security gateway of subnet A:
.Bd -literal
ipsecadm flow -dst gatewB -spi 1 -addr netA netAmask netB netBmask -local
.Ed
.Pp
and on the security gateway of subnet B:
.Bd -literal
ipsecadm flow -dst gatewA -spi 1 -addr netB netBmask netA netAmask -local
.Ed
.Pp
Furthermore, both security gateways need to start the
.Xr photurisd 8
key management daemon with the
.Fl v
flag and need to make sure that it is configured properly on both sides to
provide the required security services (typically, encryption and
authentication).
.Pp
.Xr ipf 1
needs to be configured such that all packets from the outside are blocked.
Only packets from the security gatewaysm either on the
.Pa enc0
interface (successfully IPsec-processed packets) or
.Tn UDP
packets with source and remote ports of 468 (Photuris) should be allowed in.
.Pp
The
.Xr ipf 5
rules for a tunnel which only uses encryption (the ESP IPsec protocol)
on security gateway A might look like this:
.Bd -literal
# ed0 is the only interface going to the outside.
block in log on ed0 from any to any
block out log on ed0 from any to any
block in log on enc0 from any to any
# Passing in encrypted traffic from security gateways
pass in proto sipp-esp from gatewB to gatewA
pass out proto sipp-esp from gatewA to gatewB
# Passing in traffic from the designated subnets.
pass in on enc0 from netB/netBmask to netA/netAmask
# Passing in Photuris traffic from the security gateways
pass in on ed0 proto udp from gatewB/32 port = 468 to gatewA/32 port = 468
pass out on ed0 proto udp from gatewA/32 port = 468 to gatewB/32 port = 468
.Ed
.Pp
If there are no other
.Xr ipf 5
rules, the "quick" clause can be added to the last three rules.
.Sh SEE ALSO
.Xr ipf 1 ,
.Xr ipf 5 ,
.Xr ipsecadm 1 ,
.Xr ipsec 4 ,
.Xr options 4 ,
.Xr photurisd 8 .
|