Usable Examples configurations » History » Version 3
Noel Kuntze, 03.10.2016 18:51
complete a sentence.
1 | 1 | Noel Kuntze | h1. Sane Example configurations |
---|---|---|---|
2 | 1 | Noel Kuntze | |
3 | 1 | Noel Kuntze | Preliminary obligatory notes: |
4 | 1 | Noel Kuntze | * These examples follow the [[SecurityRecommendations|Security Recommendations]]. Follow them. They are there |
5 | 1 | Noel Kuntze | for a reason. |
6 | 1 | Noel Kuntze | * You can have several conn sections in your @ipsec.conf@ file |
7 | 2 | Noel Kuntze | * In scenarios where the remote peer authenticates itself with a client certificate, |
8 | 2 | Noel Kuntze | charon requires all certificates to be present, readable and valid for authentication |
9 | 2 | Noel Kuntze | to be successful. charon implicitely trusts all CA certificates that it loads |
10 | 2 | Noel Kuntze | via local files or that are loaded via the VICI API. |
11 | 1 | Noel Kuntze | * Your responder (the proper word for "server" in ipsec talk) needs to identify |
12 | 1 | Noel Kuntze | and authenticate itself to the initiator (the proper word for "client" in ipsec talk) |
13 | 1 | Noel Kuntze | with the apropriate identity. If your initiator wants to talk to "foo.bar.com", |
14 | 1 | Noel Kuntze | your responder needs to identify and authenticate itself as _foo.bar.com_. |
15 | 1 | Noel Kuntze | * Credentials are bound to identities. You can not successfully authenticate yourself |
16 | 1 | Noel Kuntze | as the identitiy _foo.bar.com_ with a certificate if that certificate is not issued for that |
17 | 1 | Noel Kuntze | identity. The identities that a certificate provide are its complete DN and the SAN fields. |
18 | 1 | Noel Kuntze | * The used cipher suite must be supported by both sides. Some implementations |
19 | 3 | Noel Kuntze | only support weak crypto. Do not make concessions, unless necessary for interoperability. |
20 | 1 | Noel Kuntze | * XAUTH credentials are handled internally as EAP credentials. Both are valid for |
21 | 1 | Noel Kuntze | XAUTH, EAP-GTC, EAP-MSCHAPv2 and whatever other cleartext or digest based |
22 | 1 | Noel Kuntze | authentication might be implemented in the future. |
23 | 1 | Noel Kuntze | * The cipher settings are deliberately ordered by performance. |
24 | 1 | Noel Kuntze | appears in front. That should make charon choose faster, but secure ones first. |
25 | 1 | Noel Kuntze | * Do not use MD5, DES or 3DES. They are broken. |
26 | 1 | Noel Kuntze | * The algorithm your certificate uses and they algorithm the key exchange uses |
27 | 1 | Noel Kuntze | do not have anything to do with each other. |
28 | 1 | Noel Kuntze | * strongSwan does not implement L2TP. |
29 | 1 | Noel Kuntze | * Read the documentation and use "the search function":https://wiki.strongswan.org/projects/strongswan/search. |
30 | 1 | Noel Kuntze | |
31 | 1 | Noel Kuntze | h2. Roadwarrior scenario |
32 | 1 | Noel Kuntze | |
33 | 1 | Noel Kuntze | This is an example configuration that provides support for several clients |
34 | 1 | Noel Kuntze | with several authentication styles. |
35 | 1 | Noel Kuntze | |
36 | 1 | Noel Kuntze | {{collapse(ipsec.conf) |
37 | 1 | Noel Kuntze | <pre> |
38 | 1 | Noel Kuntze | conn rw-base |
39 | 1 | Noel Kuntze | # enables IKE fragmentation |
40 | 1 | Noel Kuntze | fragmentation=yes |
41 | 1 | Noel Kuntze | dpdaction=clear |
42 | 1 | Noel Kuntze | # dpdtimeout is not honored for ikev2. For IKEv2, every message is used |
43 | 1 | Noel Kuntze | # to determine the timeout, so the generic timeout value for IKEv2 messages |
44 | 1 | Noel Kuntze | # is used. |
45 | 1 | Noel Kuntze | dpdtimeout=90s |
46 | 1 | Noel Kuntze | dpddelay=30s |
47 | 1 | Noel Kuntze | |
48 | 1 | Noel Kuntze | # this is used in every conn in which the client is assigned a "virtual" IP or |
49 | 1 | Noel Kuntze | # one or several DNS servers |
50 | 1 | Noel Kuntze | # the cipher suits require the openssl plugin. |
51 | 1 | Noel Kuntze | conn rw-config |
52 | 1 | Noel Kuntze | also=rw-base |
53 | 1 | Noel Kuntze | rightsourceip=172.16.252.0/24 |
54 | 1 | Noel Kuntze | # set this to a local DNS server that the clients can reach with their assigned IPs. |
55 | 1 | Noel Kuntze | # Think about routing. |
56 | 1 | Noel Kuntze | rightdns= |
57 | 1 | Noel Kuntze | leftsubnet=0.0.0.0/0 |
58 | 1 | Noel Kuntze | leftid=whatevertheclientusestoconnect |
59 | 1 | Noel Kuntze | leftcert=mycertificate.pem |
60 | 1 | Noel Kuntze | # not possible with asymmetric authentication |
61 | 1 | Noel Kuntze | reauth=no |
62 | 1 | Noel Kuntze | rekey=no |
63 | 1 | Noel Kuntze | # sane cipher suits |
64 | 1 | Noel Kuntze | ike=aes192gcm16-aes128gcm16-aes192-prfsha256-ecp256-ecp521,aes192-sha256-modp3072 |
65 | 1 | Noel Kuntze | esp=aes192gcm16-aes128gcm16-aes192-ecp256,aes192-sha256-modp3072# |
66 | 1 | Noel Kuntze | leftsendcert=always |
67 | 1 | Noel Kuntze | rightca="C=This, O=Is, OU=My, CN=CA" |
68 | 1 | Noel Kuntze | |
69 | 1 | Noel Kuntze | # this conn is set up for l2tp support where the user authentication is happening |
70 | 1 | Noel Kuntze | # in the l2tp control connection. With L2TP, clients are usually not assigned |
71 | 1 | Noel Kuntze | # a virtual IP in IKE. |
72 | 1 | Noel Kuntze | # Charon is not an l2tp server. You need to install xl2tp for that and configure it correctly. |
73 | 1 | Noel Kuntze | # mark=%unique requires the connmark plugin. |
74 | 1 | Noel Kuntze | conn ikev1-l2tp-chap-auth-in-xl2tpd |
75 | 1 | Noel Kuntze | also=rw-base |
76 | 1 | Noel Kuntze | # reduce to the most secure combination the client can support, if absolutely required. |
77 | 1 | Noel Kuntze | ike=aes128-sha1-modp3072 |
78 | 1 | Noel Kuntze | esp=aes128-sha1-modp3073 |
79 | 1 | Noel Kuntze | leftsubnet=%dynamic[/1701] |
80 | 1 | Noel Kuntze | rightsubnet=%dynamic[/1701] |
81 | 1 | Noel Kuntze | mark=%unique |
82 | 1 | Noel Kuntze | leftauth=psk |
83 | 1 | Noel Kuntze | rightauth=psk |
84 | 1 | Noel Kuntze | type=transport |
85 | 1 | Noel Kuntze | auto=add |
86 | 1 | Noel Kuntze | |
87 | 1 | Noel Kuntze | # this conn is set up for l2tp support where the user authentication is happening |
88 | 1 | Noel Kuntze | # during the IKEv1 authentication. With L2TP, clients are usually not assigned |
89 | 1 | Noel Kuntze | # a virtual IP in IKE. |
90 | 1 | Noel Kuntze | # mark=%unique requires the connmark plugin. |
91 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
92 | 1 | Noel Kuntze | conn ikev1-l2tp-xauth-in-ike |
93 | 1 | Noel Kuntze | also=rw-base |
94 | 1 | Noel Kuntze | # reduce to the most secure combination the client can support, if absolutely required. |
95 | 1 | Noel Kuntze | ike=aes128-sha1-modp3072 |
96 | 1 | Noel Kuntze | esp=aes128-sha1-modp3073 |
97 | 1 | Noel Kuntze | leftsubnet=%dynamic[/1701] |
98 | 1 | Noel Kuntze | rightsubnet=%dynamic[/1701] |
99 | 1 | Noel Kuntze | mark=%unique |
100 | 1 | Noel Kuntze | leftauth=psk |
101 | 1 | Noel Kuntze | rightauth=psk |
102 | 1 | Noel Kuntze | rightauth2=xauth-generic |
103 | 1 | Noel Kuntze | # not possible with asymmetric authentication |
104 | 1 | Noel Kuntze | reauth=no |
105 | 1 | Noel Kuntze | rekey=no |
106 | 1 | Noel Kuntze | type=transport |
107 | 1 | Noel Kuntze | auto=add |
108 | 1 | Noel Kuntze | |
109 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
110 | 1 | Noel Kuntze | conn ikev1-psk-xauth |
111 | 1 | Noel Kuntze | also=rw-config |
112 | 1 | Noel Kuntze | leftauth=psk |
113 | 1 | Noel Kuntze | rightauth=psk |
114 | 1 | Noel Kuntze | rightauth2=xauth-generic |
115 | 1 | Noel Kuntze | auto=add |
116 | 1 | Noel Kuntze | |
117 | 1 | Noel Kuntze | # leftauth and rightauth default to "pubkey", so no change necessary. |
118 | 1 | Noel Kuntze | conn ikev1-pubkey |
119 | 1 | Noel Kuntze | also=rw-config |
120 | 1 | Noel Kuntze | auto=add |
121 | 1 | Noel Kuntze | |
122 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
123 | 1 | Noel Kuntze | conn ikev1-pubkey-xauth |
124 | 1 | Noel Kuntze | also=rw-config |
125 | 1 | Noel Kuntze | rightauth2=xauth-generic |
126 | 1 | Noel Kuntze | auto=add |
127 | 1 | Noel Kuntze | |
128 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
129 | 1 | Noel Kuntze | conn ikev1-hybrid |
130 | 1 | Noel Kuntze | also=rw-config |
131 | 1 | Noel Kuntze | rightauth=xauth-generic |
132 | 1 | Noel Kuntze | |
133 | 1 | Noel Kuntze | conn ikev2-pubkey |
134 | 1 | Noel Kuntze | also=rw-config |
135 | 1 | Noel Kuntze | auto=add |
136 | 1 | Noel Kuntze | |
137 | 1 | Noel Kuntze | # this requires the eap-tls plugin. |
138 | 1 | Noel Kuntze | conn ikev2-eap-tls |
139 | 1 | Noel Kuntze | also=rw-base |
140 | 1 | Noel Kuntze | rightauth=eap-tls |
141 | 1 | Noel Kuntze | eap_identity=%identity |
142 | 1 | Noel Kuntze | auto=add |
143 | 1 | Noel Kuntze | |
144 | 1 | Noel Kuntze | # this requires the eap-mschapv2 plugin. |
145 | 1 | Noel Kuntze | conn ikev2-eap-mschapv2 |
146 | 1 | Noel Kuntze | also=rw-config |
147 | 1 | Noel Kuntze | rightauth=eap-mschapv2 |
148 | 1 | Noel Kuntze | eap_identity=%identity |
149 | 1 | Noel Kuntze | auto=add |
150 | 1 | Noel Kuntze | </pre> |
151 | 1 | Noel Kuntze | }} |
152 | 1 | Noel Kuntze | |
153 | 1 | Noel Kuntze | {{collapse(ipsec.secrets) |
154 | 1 | Noel Kuntze | <pre> |
155 | 1 | Noel Kuntze | : PSK "foobarblah" |
156 | 1 | Noel Kuntze | : RSA myprivatekey.pem |
157 | 1 | Noel Kuntze | carol : EAP "carolspassword" |
158 | 1 | Noel Kuntze | </pre> |
159 | 1 | Noel Kuntze | }} |
160 | 1 | Noel Kuntze | |
161 | 1 | Noel Kuntze | h2. Site-To-Site-Scenario |
162 | 1 | Noel Kuntze | |
163 | 1 | Noel Kuntze | {{collapse(ipsec.conf) |
164 | 1 | Noel Kuntze | <pre> |
165 | 1 | Noel Kuntze | conn sts-base |
166 | 1 | Noel Kuntze | fragmentation=yes |
167 | 1 | Noel Kuntze | dpdaction=restart |
168 | 1 | Noel Kuntze | ike=aes192gcm16-aes128gcm16-aes192-prfsha256-ecp256-ecp521,aes192-sha256-modp3072 |
169 | 1 | Noel Kuntze | esp=aes192gcm16-aes128gcm16-aes192-ecp256,aes192-sha256-modp3072# |
170 | 1 | Noel Kuntze | keyingtries=%forever |
171 | 1 | Noel Kuntze | leftcert=foobar.pem |
172 | 1 | Noel Kuntze | |
173 | 1 | Noel Kuntze | # this conn is set up for a host with a static IP |
174 | 1 | Noel Kuntze | conn site-1-static-ip |
175 | 1 | Noel Kuntze | also=sts-base |
176 | 1 | Noel Kuntze | keyexchange=ikev2 |
177 | 1 | Noel Kuntze | leftsubnet=10.1.2.0/24,10.1.1.0/24 |
178 | 1 | Noel Kuntze | rightsubnet=10.1.3.0/24 |
179 | 1 | Noel Kuntze | right=1.2.3.4 |
180 | 1 | Noel Kuntze | rightcert=1.2.3.4.pem |
181 | 1 | Noel Kuntze | auto=route |
182 | 1 | Noel Kuntze | |
183 | 1 | Noel Kuntze | # this conn is set up for a host with a dynamic IP |
184 | 1 | Noel Kuntze | conn site-2-dynamic-ip |
185 | 1 | Noel Kuntze | also=sts-base |
186 | 1 | Noel Kuntze | keyexchange=ikev2 |
187 | 1 | Noel Kuntze | leftsubnet=10.1.2.0/24,10.1.1.0/24 |
188 | 1 | Noel Kuntze | rightsubnet=10.1.4.0/24 |
189 | 1 | Noel Kuntze | # for this to work, DNS must be usable and working. |
190 | 1 | Noel Kuntze | right=%example.com |
191 | 1 | Noel Kuntze | rightcert=example.com.pem |
192 | 1 | Noel Kuntze | auto=route |
193 | 1 | Noel Kuntze | |
194 | 1 | Noel Kuntze | # this conn is set up for IKEv1 compatibility. It shows how to define several subnets |
195 | 1 | Noel Kuntze | # with IKEv1. site-3-legacy-1 and site-3-legacy-2 keep the data for the CHILD_SA. |
196 | 1 | Noel Kuntze | # The same can be accomplished with implicit merging by specifying the same IKE_SA |
197 | 1 | Noel Kuntze | # configuration in two different conns. This set up is cleaner, though. |
198 | 1 | Noel Kuntze | # If you put "auto=route" into the "site-3-legacy-base conn", charon will route the |
199 | 1 | Noel Kuntze | # conn with the ts being the local IP that is used to communicate with the remote |
200 | 1 | Noel Kuntze | # peer and the remote's peer. If such a CHILD_SA is not configured on the peer, ICMP |
201 | 1 | Noel Kuntze | # error messages from the remote peer to the local peer will not be able to be transmitted. |
202 | 1 | Noel Kuntze | # So don't do that, unless your remote peer is configured for that. |
203 | 1 | Noel Kuntze | # This is an IKEv1 connection with PSK authentication. That means, that you need to know |
204 | 1 | Noel Kuntze | # the other side's IP. |
205 | 1 | Noel Kuntze | conn site-3-legacy-base |
206 | 1 | Noel Kuntze | also=sts-base |
207 | 1 | Noel Kuntze | keyexchange=ikev1 |
208 | 1 | Noel Kuntze | # IKE and ESP cipher settings are reconfigured, because in IKEv1 every |
209 | 1 | Noel Kuntze | # single cipher suite needs to be enumerated. |
210 | 1 | Noel Kuntze | # It is not possible to define all supported ciphers in one suite. |
211 | 1 | Noel Kuntze | # select apropriate and strong ciphers for your scenario. |
212 | 1 | Noel Kuntze | ike=aes192gcm16-prfsha256-ecp256,aes128gcm16-prfsha256-ecp256,aes128gcm16-prfsha256-ecp521,aes192-sha256-modp3072 |
213 | 1 | Noel Kuntze | esp=aes192gcm16-ecp256,aes192-sha256-modp3072 |
214 | 1 | Noel Kuntze | rightsubnet=10.1.5.0/24 |
215 | 1 | Noel Kuntze | # for this to work, DNS must be usable and working. |
216 | 1 | Noel Kuntze | right=example.com |
217 | 1 | Noel Kuntze | leftauth=psk |
218 | 1 | Noel Kuntze | rightauth=psk |
219 | 1 | Noel Kuntze | |
220 | 1 | Noel Kuntze | conn site-3-legacy-1 |
221 | 1 | Noel Kuntze | leftsubnet=10.1.1.0/24 |
222 | 1 | Noel Kuntze | also=site-3-legacy-base |
223 | 1 | Noel Kuntze | auto=route |
224 | 1 | Noel Kuntze | |
225 | 1 | Noel Kuntze | conn site-3-legacy-2 |
226 | 1 | Noel Kuntze | leftsubnet=10.1.2.0/24 |
227 | 1 | Noel Kuntze | also=site-3-legacy-base |
228 | 1 | Noel Kuntze | auto=route |
229 | 1 | Noel Kuntze | </pre> |
230 | 1 | Noel Kuntze | }} |
231 | 1 | Noel Kuntze | |
232 | 1 | Noel Kuntze | {{collapse(ipsec.secrets) |
233 | 1 | Noel Kuntze | <pre> |
234 | 1 | Noel Kuntze | : RSA foobar.key |
235 | 1 | Noel Kuntze | remote.com : EAP "example" |
236 | 1 | Noel Kuntze | </pre> |
237 | 1 | Noel Kuntze | }} |