Usable Examples configurations » History » Version 13
Noel Kuntze, 28.10.2016 20:57
no opportunistic
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 | 4 | Noel Kuntze | charon requires all certificates that are in the trust path of the client's certificate |
9 | 4 | Noel Kuntze | to be present, readable and valid for authentication |
10 | 2 | Noel Kuntze | to be successful. charon implicitely trusts all CA certificates that it loads |
11 | 1 | Noel Kuntze | via local files or that are loaded via the VICI API. |
12 | 4 | Noel Kuntze | * In scenarios where charon authenticates itself with a certificate, it needs to have |
13 | 4 | Noel Kuntze | all certificates in the trust path. |
14 | 4 | Noel Kuntze | * charon only reads the first certificate in a file. |
15 | 1 | Noel Kuntze | * Your responder (the proper word for "server" in ipsec talk) needs to identify |
16 | 1 | Noel Kuntze | and authenticate itself to the initiator (the proper word for "client" in ipsec talk) |
17 | 1 | Noel Kuntze | with the apropriate identity. If your initiator wants to talk to "foo.bar.com", |
18 | 1 | Noel Kuntze | your responder needs to identify and authenticate itself as _foo.bar.com_. |
19 | 1 | Noel Kuntze | * Credentials are bound to identities. You can not successfully authenticate yourself |
20 | 1 | Noel Kuntze | as the identitiy _foo.bar.com_ with a certificate if that certificate is not issued for that |
21 | 1 | Noel Kuntze | identity. The identities that a certificate provide are its complete DN and the SAN fields. |
22 | 1 | Noel Kuntze | * The used cipher suite must be supported by both sides. Some implementations |
23 | 3 | Noel Kuntze | only support weak crypto. Do not make concessions, unless necessary for interoperability. |
24 | 1 | Noel Kuntze | * XAUTH credentials are handled internally as EAP credentials. Both are valid for |
25 | 1 | Noel Kuntze | XAUTH, EAP-GTC, EAP-MSCHAPv2 and whatever other cleartext or digest based |
26 | 1 | Noel Kuntze | authentication might be implemented in the future. |
27 | 1 | Noel Kuntze | * The cipher settings are deliberately ordered by performance. |
28 | 6 | Noel Kuntze | Faster, but secure ciphers appear in the beginning of the cipher list. |
29 | 6 | Noel Kuntze | That should make charon choose faster, but secure ones first. |
30 | 1 | Noel Kuntze | * Do not use MD5, DES or 3DES. They are broken. |
31 | 1 | Noel Kuntze | * The algorithm your certificate uses and they algorithm the key exchange uses |
32 | 1 | Noel Kuntze | do not have anything to do with each other. |
33 | 1 | Noel Kuntze | * strongSwan does not implement L2TP. |
34 | 1 | Noel Kuntze | * Read the documentation and use "the search function":https://wiki.strongswan.org/projects/strongswan/search. |
35 | 1 | Noel Kuntze | |
36 | 10 | Noel Kuntze | |
37 | 1 | Noel Kuntze | h2. Roadwarrior scenario |
38 | 10 | Noel Kuntze | |
39 | 10 | Noel Kuntze | h3. Responder |
40 | 9 | Noel Kuntze | |
41 | 1 | Noel Kuntze | This is an example configuration that provides support for several clients |
42 | 1 | Noel Kuntze | with several authentication styles. |
43 | 1 | Noel Kuntze | |
44 | 1 | Noel Kuntze | {{collapse(ipsec.conf) |
45 | 1 | Noel Kuntze | <pre> |
46 | 1 | Noel Kuntze | conn rw-base |
47 | 1 | Noel Kuntze | # enables IKE fragmentation |
48 | 1 | Noel Kuntze | fragmentation=yes |
49 | 1 | Noel Kuntze | dpdaction=clear |
50 | 1 | Noel Kuntze | # dpdtimeout is not honored for ikev2. For IKEv2, every message is used |
51 | 1 | Noel Kuntze | # to determine the timeout, so the generic timeout value for IKEv2 messages |
52 | 1 | Noel Kuntze | # is used. |
53 | 1 | Noel Kuntze | dpdtimeout=90s |
54 | 1 | Noel Kuntze | dpddelay=30s |
55 | 1 | Noel Kuntze | |
56 | 1 | Noel Kuntze | # this is used in every conn in which the client is assigned a "virtual" IP or |
57 | 1 | Noel Kuntze | # one or several DNS servers |
58 | 1 | Noel Kuntze | # the cipher suits require the openssl plugin. |
59 | 1 | Noel Kuntze | conn rw-config |
60 | 1 | Noel Kuntze | also=rw-base |
61 | 1 | Noel Kuntze | rightsourceip=172.16.252.0/24 |
62 | 1 | Noel Kuntze | # set this to a local DNS server that the clients can reach with their assigned IPs. |
63 | 1 | Noel Kuntze | # Think about routing. |
64 | 1 | Noel Kuntze | rightdns= |
65 | 1 | Noel Kuntze | leftsubnet=0.0.0.0/0 |
66 | 1 | Noel Kuntze | leftid=whatevertheclientusestoconnect |
67 | 1 | Noel Kuntze | leftcert=mycertificate.pem |
68 | 1 | Noel Kuntze | # not possible with asymmetric authentication |
69 | 1 | Noel Kuntze | reauth=no |
70 | 1 | Noel Kuntze | rekey=no |
71 | 1 | Noel Kuntze | # sane cipher suits |
72 | 1 | Noel Kuntze | ike=aes192gcm16-aes128gcm16-aes192-prfsha256-ecp256-ecp521,aes192-sha256-modp3072 |
73 | 1 | Noel Kuntze | esp=aes192gcm16-aes128gcm16-aes192-ecp256,aes192-sha256-modp3072# |
74 | 1 | Noel Kuntze | leftsendcert=always |
75 | 1 | Noel Kuntze | rightca="C=This, O=Is, OU=My, CN=CA" |
76 | 1 | Noel Kuntze | |
77 | 1 | Noel Kuntze | # this conn is set up for l2tp support where the user authentication is happening |
78 | 1 | Noel Kuntze | # in the l2tp control connection. With L2TP, clients are usually not assigned |
79 | 1 | Noel Kuntze | # a virtual IP in IKE. |
80 | 1 | Noel Kuntze | # Charon is not an l2tp server. You need to install xl2tp for that and configure it correctly. |
81 | 1 | Noel Kuntze | # mark=%unique requires the connmark plugin. |
82 | 1 | Noel Kuntze | conn ikev1-l2tp-chap-auth-in-xl2tpd |
83 | 1 | Noel Kuntze | also=rw-base |
84 | 1 | Noel Kuntze | # reduce to the most secure combination the client can support, if absolutely required. |
85 | 1 | Noel Kuntze | ike=aes128-sha1-modp3072 |
86 | 1 | Noel Kuntze | esp=aes128-sha1-modp3073 |
87 | 1 | Noel Kuntze | leftsubnet=%dynamic[/1701] |
88 | 11 | Noel Kuntze | rightsubnet=%dynamic |
89 | 1 | Noel Kuntze | mark=%unique |
90 | 1 | Noel Kuntze | leftauth=psk |
91 | 1 | Noel Kuntze | rightauth=psk |
92 | 1 | Noel Kuntze | type=transport |
93 | 1 | Noel Kuntze | auto=add |
94 | 1 | Noel Kuntze | |
95 | 1 | Noel Kuntze | # this conn is set up for l2tp support where the user authentication is happening |
96 | 1 | Noel Kuntze | # during the IKEv1 authentication. With L2TP, clients are usually not assigned |
97 | 1 | Noel Kuntze | # a virtual IP in IKE. |
98 | 1 | Noel Kuntze | # mark=%unique requires the connmark plugin. |
99 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
100 | 1 | Noel Kuntze | conn ikev1-l2tp-xauth-in-ike |
101 | 1 | Noel Kuntze | also=rw-base |
102 | 1 | Noel Kuntze | # reduce to the most secure combination the client can support, if absolutely required. |
103 | 1 | Noel Kuntze | ike=aes128-sha1-modp3072 |
104 | 1 | Noel Kuntze | esp=aes128-sha1-modp3073 |
105 | 1 | Noel Kuntze | leftsubnet=%dynamic[/1701] |
106 | 11 | Noel Kuntze | rightsubnet=%dynamic |
107 | 1 | Noel Kuntze | mark=%unique |
108 | 1 | Noel Kuntze | leftauth=psk |
109 | 1 | Noel Kuntze | rightauth=psk |
110 | 1 | Noel Kuntze | rightauth2=xauth-generic |
111 | 9 | Noel Kuntze | xauth=server |
112 | 1 | Noel Kuntze | # not possible with asymmetric authentication |
113 | 1 | Noel Kuntze | reauth=no |
114 | 1 | Noel Kuntze | rekey=no |
115 | 1 | Noel Kuntze | type=transport |
116 | 1 | Noel Kuntze | auto=add |
117 | 1 | Noel Kuntze | |
118 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
119 | 1 | Noel Kuntze | conn ikev1-psk-xauth |
120 | 1 | Noel Kuntze | also=rw-config |
121 | 1 | Noel Kuntze | leftauth=psk |
122 | 1 | Noel Kuntze | rightauth=psk |
123 | 1 | Noel Kuntze | rightauth2=xauth-generic |
124 | 9 | Noel Kuntze | xauth=server |
125 | 1 | Noel Kuntze | auto=add |
126 | 1 | Noel Kuntze | |
127 | 1 | Noel Kuntze | # leftauth and rightauth default to "pubkey", so no change necessary. |
128 | 1 | Noel Kuntze | conn ikev1-pubkey |
129 | 1 | Noel Kuntze | also=rw-config |
130 | 1 | Noel Kuntze | auto=add |
131 | 1 | Noel Kuntze | |
132 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
133 | 1 | Noel Kuntze | conn ikev1-pubkey-xauth |
134 | 1 | Noel Kuntze | also=rw-config |
135 | 1 | Noel Kuntze | rightauth2=xauth-generic |
136 | 9 | Noel Kuntze | xauth=server |
137 | 1 | Noel Kuntze | auto=add |
138 | 1 | Noel Kuntze | |
139 | 1 | Noel Kuntze | # this requires the xauth-generic plugin. |
140 | 1 | Noel Kuntze | conn ikev1-hybrid |
141 | 1 | Noel Kuntze | also=rw-config |
142 | 1 | Noel Kuntze | rightauth=xauth-generic |
143 | 9 | Noel Kuntze | xauth=server |
144 | 1 | Noel Kuntze | |
145 | 1 | Noel Kuntze | conn ikev2-pubkey |
146 | 1 | Noel Kuntze | also=rw-config |
147 | 1 | Noel Kuntze | auto=add |
148 | 1 | Noel Kuntze | |
149 | 1 | Noel Kuntze | # this requires the eap-tls plugin. |
150 | 1 | Noel Kuntze | conn ikev2-eap-tls |
151 | 1 | Noel Kuntze | also=rw-base |
152 | 1 | Noel Kuntze | rightauth=eap-tls |
153 | 1 | Noel Kuntze | eap_identity=%identity |
154 | 1 | Noel Kuntze | auto=add |
155 | 1 | Noel Kuntze | |
156 | 1 | Noel Kuntze | # this requires the eap-mschapv2 plugin. |
157 | 1 | Noel Kuntze | conn ikev2-eap-mschapv2 |
158 | 1 | Noel Kuntze | also=rw-config |
159 | 1 | Noel Kuntze | rightauth=eap-mschapv2 |
160 | 1 | Noel Kuntze | eap_identity=%identity |
161 | 1 | Noel Kuntze | auto=add |
162 | 1 | Noel Kuntze | </pre> |
163 | 1 | Noel Kuntze | }} |
164 | 1 | Noel Kuntze | |
165 | 1 | Noel Kuntze | {{collapse(ipsec.secrets) |
166 | 1 | Noel Kuntze | <pre> |
167 | 1 | Noel Kuntze | : PSK "foobarblah" |
168 | 1 | Noel Kuntze | : RSA myprivatekey.pem |
169 | 1 | Noel Kuntze | carol : EAP "carolspassword" |
170 | 1 | Noel Kuntze | </pre> |
171 | 1 | Noel Kuntze | }} |
172 | 9 | Noel Kuntze | |
173 | 10 | Noel Kuntze | h3. Initiator |
174 | 1 | Noel Kuntze | |
175 | 10 | Noel Kuntze | These configuration files provide valid and usable configurations as use |
176 | 10 | Noel Kuntze | as a roadwarrior client against arbitrary IKE responders that are configured correctly. |
177 | 10 | Noel Kuntze | *You need to replace the marked values with the correct values* |
178 | 10 | Noel Kuntze | Remove conns that you do not require for your scenario. Some values |
179 | 10 | Noel Kuntze | might need to be changed, depending on the brokeness of the responder. |
180 | 10 | Noel Kuntze | *Read the comments in the files and read _ipsec.conf_ as well as _ipsec.secrets_.* |
181 | 10 | Noel Kuntze | |
182 | 10 | Noel Kuntze | The configurations shown here are not exclusive. There are a lot more possible. |
183 | 10 | Noel Kuntze | Check out the [[PluginList|plugin list]] and the "test scenarios":https://strongswan.org/uml/testresults5/ |
184 | 10 | Noel Kuntze | to see how they can be configured, but beware, those are just test scenarios |
185 | 10 | Noel Kuntze | and the configurations there are not usable in production as a whole. They need |
186 | 10 | Noel Kuntze | to be combined with the examples here to produce usable scenarios. |
187 | 10 | Noel Kuntze | |
188 | 10 | Noel Kuntze | {{collapse(ipsec.conf) |
189 | 10 | Noel Kuntze | <pre> |
190 | 10 | Noel Kuntze | |
191 | 10 | Noel Kuntze | conn rw-base |
192 | 10 | Noel Kuntze | dpdaction=restart |
193 | 10 | Noel Kuntze | dpddelay=30 |
194 | 10 | Noel Kuntze | dpdtimeout=90 |
195 | 10 | Noel Kuntze | fragmentation=yes |
196 | 10 | Noel Kuntze | |
197 | 10 | Noel Kuntze | conn vip-base |
198 | 10 | Noel Kuntze | also=rw-base |
199 | 10 | Noel Kuntze | leftsourceip=%config |
200 | 10 | Noel Kuntze | |
201 | 10 | Noel Kuntze | conn ikev1-psk-xauth |
202 | 10 | Noel Kuntze | # uncomment if the responder only supports crappy crypto. But seriously, |
203 | 10 | Noel Kuntze | # every single one of those algorithms is broken. Better spend some $$$ |
204 | 10 | Noel Kuntze | # on a better solution. |
205 | 10 | Noel Kuntze | # |
206 | 10 | Noel Kuntze | # ike=3des-md5-modp1024! |
207 | 10 | Noel Kuntze | # esp=3des-md5! |
208 | 10 | Noel Kuntze | # Use this, if you want PFS with DH group 2. |
209 | 10 | Noel Kuntze | # esp=3des-md5-modp1024! |
210 | 10 | Noel Kuntze | also=vip-base |
211 | 10 | Noel Kuntze | keyexchange=ikev1 |
212 | 10 | Noel Kuntze | leftauth=psk |
213 | 10 | Noel Kuntze | leftauth2=xauth |
214 | 10 | Noel Kuntze | right=RespondersIPorFQDNGoesHere |
215 | 10 | Noel Kuntze | # You might have to set this to the correct value, if the responder isn't configure correctly. |
216 | 10 | Noel Kuntze | # rightid=foobar |
217 | 10 | Noel Kuntze | rightauth=psk |
218 | 10 | Noel Kuntze | # this tunnels all the traffic. You might maybe want to also define a passthrough policy |
219 | 10 | Noel Kuntze | # for the local LAN traffic (or use the bypass-lan plugin when it's gone into the master branch) |
220 | 10 | Noel Kuntze | # Choose a smaller subnet, if required. |
221 | 10 | Noel Kuntze | # this config supports CISCO UNITY. |
222 | 10 | Noel Kuntze | # Remove the ::/0, if you don't require IPv6. |
223 | 10 | Noel Kuntze | rightsubnet=0.0.0.0/0,::/0 |
224 | 10 | Noel Kuntze | auto=add |
225 | 10 | Noel Kuntze | |
226 | 12 | Noel Kuntze | # aggressive mode is incredibly insecure. |
227 | 12 | Noel Kuntze | conn ikev1-psk-xauth-aggressive |
228 | 12 | Noel Kuntze | aggressive=yes |
229 | 10 | Noel Kuntze | also=ikev1-psk-xauth |
230 | 10 | Noel Kuntze | auto=add |
231 | 10 | Noel Kuntze | |
232 | 10 | Noel Kuntze | conn ikev1-rsa-xauth |
233 | 10 | Noel Kuntze | also=vip-base |
234 | 10 | Noel Kuntze | keyexchange=ikev1 |
235 | 10 | Noel Kuntze | leftauth=pubkey |
236 | 10 | Noel Kuntze | leftauth2=xauth-generic |
237 | 10 | Noel Kuntze | leftcert=thisithepathtomycertificate.pem |
238 | 10 | Noel Kuntze | xauth_identity=thisismyusername |
239 | 10 | Noel Kuntze | right=RespondersIPorFQDNGoesHere |
240 | 10 | Noel Kuntze | # You might require this if the responder sends a wrong ID. |
241 | 10 | Noel Kuntze | # rightid=somethingsomething |
242 | 10 | Noel Kuntze | rightauth=pubkey |
243 | 10 | Noel Kuntze | # The following settings depend on if you've got the CA that issued the |
244 | 10 | Noel Kuntze | # responder's certificate or just the certificate. |
245 | 10 | Noel Kuntze | # if you've got the CA certificate, put it into /etc/ipsec.d/cacerts/. Also |
246 | 10 | Noel Kuntze | # read the notes in the beginning of the page about certificates. |
247 | 10 | Noel Kuntze | # rightca="This is the DN of the CA's certificate" |
248 | 10 | Noel Kuntze | # if you've only got the responder's certificate |
249 | 10 | Noel Kuntze | # rightcert=thisisthepathtothecertificate |
250 | 10 | Noel Kuntze | auto=add |
251 | 10 | Noel Kuntze | |
252 | 10 | Noel Kuntze | |
253 | 10 | Noel Kuntze | conn ikev1-l2tp |
254 | 10 | Noel Kuntze | also=rw-base |
255 | 10 | Noel Kuntze | keyexchange=ikev1 |
256 | 1 | Noel Kuntze | type=transport |
257 | 10 | Noel Kuntze | right=RespondersIPorFQDNGoesHere |
258 | 11 | Noel Kuntze | rightsubnet=%dynamic[/1701] |
259 | 10 | Noel Kuntze | leftauth=psk |
260 | 10 | Noel Kuntze | rightauth=psk |
261 | 10 | Noel Kuntze | |
262 | 10 | Noel Kuntze | |
263 | 12 | Noel Kuntze | # if your responder uses aggressive mode, add |
264 | 12 | Noel Kuntze | # aggressive=yes in the conn |
265 | 10 | Noel Kuntze | # user authentication happens in IKE using xauth |
266 | 10 | Noel Kuntze | conn ikev1-l2tp-ipsec-userauth-in-ike |
267 | 10 | Noel Kuntze | also=ikev1-l2tp |
268 | 10 | Noel Kuntze | leftauth2=xauth-generic |
269 | 10 | Noel Kuntze | auto=add |
270 | 10 | Noel Kuntze | |
271 | 12 | Noel Kuntze | # if your responder uses aggressive mode, add |
272 | 12 | Noel Kuntze | # aggressive=yes in the conn |
273 | 10 | Noel Kuntze | # user authentication happens in L2TP |
274 | 10 | Noel Kuntze | conn ikev1-l2tp-ipsec-userauth-in-l2tp |
275 | 10 | Noel Kuntze | also=ikev1-l2tp |
276 | 10 | Noel Kuntze | auto=add |
277 | 10 | Noel Kuntze | |
278 | 10 | Noel Kuntze | |
279 | 10 | Noel Kuntze | # Authentication with EAP-MSCHAPv2 is asymmetric. The responder |
280 | 10 | Noel Kuntze | # has to authenticate itself against the initiator with an X.509 certificate. |
281 | 10 | Noel Kuntze | conn ikev2-eap-mschapv2 |
282 | 10 | Noel Kuntze | also=vip-base |
283 | 10 | Noel Kuntze | keyexchange=ikev2 |
284 | 10 | Noel Kuntze | leftauth=eap-mschapv2 |
285 | 10 | Noel Kuntze | rightauth=pubkey |
286 | 10 | Noel Kuntze | right=RespondersIPorFQDNGoesHere |
287 | 10 | Noel Kuntze | # The following settings depend on if you've got the CA that issued the |
288 | 10 | Noel Kuntze | # responder's certificate or just the certificate. |
289 | 10 | Noel Kuntze | # if you've got the CA certificate, put it into /etc/ipsec.d/cacerts/. Also |
290 | 10 | Noel Kuntze | # read the notes in the beginning of the page about certificates. |
291 | 10 | Noel Kuntze | # rightca="This is the DN of the CA's certificate" |
292 | 10 | Noel Kuntze | # if you've only got the responder's certificate |
293 | 10 | Noel Kuntze | # rightcert=thisisthepathtothecertificate |
294 | 10 | Noel Kuntze | |
295 | 10 | Noel Kuntze | # You might have to set this to the correct value, if the responder isn't configure correctly. |
296 | 10 | Noel Kuntze | # rightid=foobar |
297 | 10 | Noel Kuntze | # Remove the ::/0, if you don't require IPv6. |
298 | 10 | Noel Kuntze | rightsubnet=0.0.0.0/0,::/0 |
299 | 10 | Noel Kuntze | auto=add |
300 | 10 | Noel Kuntze | |
301 | 10 | Noel Kuntze | # asymmetric authentication using eap-tls and pubkey auth |
302 | 10 | Noel Kuntze | conn ikev2-eap-tls-asymmetric |
303 | 10 | Noel Kuntze | also=vip-base |
304 | 10 | Noel Kuntze | keyexchange=ikev2 |
305 | 10 | Noel Kuntze | leftcert=mycert |
306 | 10 | Noel Kuntze | leftauth=eap-tls |
307 | 10 | Noel Kuntze | rightauth=pubkey |
308 | 10 | Noel Kuntze | # The following settings depend on if you've got the CA that issued the |
309 | 10 | Noel Kuntze | # responder's certificate or just the certificate. |
310 | 10 | Noel Kuntze | # if you've got the CA certificate, put it into /etc/ipsec.d/cacerts/. Also |
311 | 10 | Noel Kuntze | # read the notes in the beginning of the page about certificates. |
312 | 10 | Noel Kuntze | # rightca="This is the DN of the CA's certificate" |
313 | 10 | Noel Kuntze | # if you've only got the responder's certificate |
314 | 10 | Noel Kuntze | # rightcert=thisisthepathtothecertificate |
315 | 10 | Noel Kuntze | |
316 | 10 | Noel Kuntze | right=RespondersIPorFQDNGoesHere |
317 | 10 | Noel Kuntze | # You might have to set this to the correct value, if the responder isn't configure correctly. |
318 | 10 | Noel Kuntze | # rightid=foobar |
319 | 10 | Noel Kuntze | # Remove the ::/0, if you don't require IPv6. |
320 | 10 | Noel Kuntze | rightsubnet=0.0.0.0/0,::/0 |
321 | 10 | Noel Kuntze | auto=add |
322 | 10 | Noel Kuntze | |
323 | 10 | Noel Kuntze | |
324 | 10 | Noel Kuntze | # symmetric authentication using just eap-tls |
325 | 10 | Noel Kuntze | conn ikev2-eap-tls-symmetric |
326 | 10 | Noel Kuntze | also=vip-base |
327 | 10 | Noel Kuntze | keyexchange=ikev2 |
328 | 10 | Noel Kuntze | leftcert=mycert |
329 | 10 | Noel Kuntze | leftauth=eap-tls |
330 | 10 | Noel Kuntze | rightauth=eap-tls |
331 | 10 | Noel Kuntze | # The following settings depend on if you've got the CA that issued the |
332 | 10 | Noel Kuntze | # responder's certificate or just the certificate. |
333 | 10 | Noel Kuntze | # if you've got the CA certificate, put it into /etc/ipsec.d/cacerts/. Also |
334 | 10 | Noel Kuntze | # read the notes in the beginning of the page about certificates. |
335 | 10 | Noel Kuntze | # rightca="This is the DN of the CA's certificate" |
336 | 10 | Noel Kuntze | # if you've only got the responder's certificate |
337 | 10 | Noel Kuntze | # rightcert=thisisthepathtothecertificate |
338 | 10 | Noel Kuntze | |
339 | 10 | Noel Kuntze | right=RespondersIPorFQDNGoesHere |
340 | 10 | Noel Kuntze | # You might have to set this to the correct value, if the responder isn't configure correctly. |
341 | 10 | Noel Kuntze | # rightid=foobar |
342 | 10 | Noel Kuntze | # Remove the ::/0, if you don't require IPv6. |
343 | 10 | Noel Kuntze | rightsubnet=0.0.0.0/0,::/0 |
344 | 10 | Noel Kuntze | auto=add |
345 | 10 | Noel Kuntze | |
346 | 10 | Noel Kuntze | </pre> |
347 | 10 | Noel Kuntze | }} |
348 | 10 | Noel Kuntze | |
349 | 10 | Noel Kuntze | {{collapse(ipsec.secrets) |
350 | 10 | Noel Kuntze | <pre> |
351 | 10 | Noel Kuntze | RespondersIPorFQDNGoesHere : PSK "thisisthesharedpassword" |
352 | 10 | Noel Kuntze | thisismyusername : EAP "thisismypassword" |
353 | 10 | Noel Kuntze | : RSA myprivatekey |
354 | 10 | Noel Kuntze | </pre> |
355 | 10 | Noel Kuntze | }} |
356 | 10 | Noel Kuntze | |
357 | 10 | Noel Kuntze | |
358 | 10 | Noel Kuntze | |
359 | 1 | Noel Kuntze | h2. Site-To-Site-Scenario |
360 | 1 | Noel Kuntze | |
361 | 1 | Noel Kuntze | {{collapse(ipsec.conf) |
362 | 1 | Noel Kuntze | <pre> |
363 | 1 | Noel Kuntze | conn sts-base |
364 | 1 | Noel Kuntze | fragmentation=yes |
365 | 1 | Noel Kuntze | dpdaction=restart |
366 | 1 | Noel Kuntze | ike=aes192gcm16-aes128gcm16-aes192-prfsha256-ecp256-ecp521,aes192-sha256-modp3072 |
367 | 1 | Noel Kuntze | esp=aes192gcm16-aes128gcm16-aes192-ecp256,aes192-sha256-modp3072# |
368 | 1 | Noel Kuntze | keyingtries=%forever |
369 | 1 | Noel Kuntze | leftcert=foobar.pem |
370 | 1 | Noel Kuntze | |
371 | 1 | Noel Kuntze | # this conn is set up for a host with a static IP |
372 | 1 | Noel Kuntze | conn site-1-static-ip |
373 | 1 | Noel Kuntze | also=sts-base |
374 | 1 | Noel Kuntze | keyexchange=ikev2 |
375 | 1 | Noel Kuntze | leftsubnet=10.1.2.0/24,10.1.1.0/24 |
376 | 1 | Noel Kuntze | rightsubnet=10.1.3.0/24 |
377 | 1 | Noel Kuntze | right=1.2.3.4 |
378 | 1 | Noel Kuntze | rightcert=1.2.3.4.pem |
379 | 1 | Noel Kuntze | auto=route |
380 | 1 | Noel Kuntze | |
381 | 1 | Noel Kuntze | # this conn is set up for a host with a dynamic IP |
382 | 1 | Noel Kuntze | conn site-2-dynamic-ip |
383 | 1 | Noel Kuntze | also=sts-base |
384 | 1 | Noel Kuntze | keyexchange=ikev2 |
385 | 1 | Noel Kuntze | leftsubnet=10.1.2.0/24,10.1.1.0/24 |
386 | 1 | Noel Kuntze | rightsubnet=10.1.4.0/24 |
387 | 1 | Noel Kuntze | # for this to work, DNS must be usable and working. |
388 | 1 | Noel Kuntze | right=%example.com |
389 | 1 | Noel Kuntze | rightcert=example.com.pem |
390 | 1 | Noel Kuntze | auto=route |
391 | 1 | Noel Kuntze | |
392 | 1 | Noel Kuntze | # this conn is set up for IKEv1 compatibility. It shows how to define several subnets |
393 | 1 | Noel Kuntze | # with IKEv1. site-3-legacy-1 and site-3-legacy-2 keep the data for the CHILD_SA. |
394 | 1 | Noel Kuntze | # The same can be accomplished with implicit merging by specifying the same IKE_SA |
395 | 1 | Noel Kuntze | # configuration in two different conns. This set up is cleaner, though. |
396 | 1 | Noel Kuntze | # If you put "auto=route" into the "site-3-legacy-base conn", charon will route the |
397 | 1 | Noel Kuntze | # conn with the ts being the local IP that is used to communicate with the remote |
398 | 1 | Noel Kuntze | # peer and the remote's peer. If such a CHILD_SA is not configured on the peer, ICMP |
399 | 1 | Noel Kuntze | # error messages from the remote peer to the local peer will not be able to be transmitted. |
400 | 1 | Noel Kuntze | # So don't do that, unless your remote peer is configured for that. |
401 | 1 | Noel Kuntze | # This is an IKEv1 connection with PSK authentication. That means, that you need to know |
402 | 1 | Noel Kuntze | # the other side's IP. |
403 | 1 | Noel Kuntze | conn site-3-legacy-base |
404 | 1 | Noel Kuntze | also=sts-base |
405 | 1 | Noel Kuntze | keyexchange=ikev1 |
406 | 1 | Noel Kuntze | # IKE and ESP cipher settings are reconfigured, because in IKEv1 every |
407 | 1 | Noel Kuntze | # single cipher suite needs to be enumerated. |
408 | 1 | Noel Kuntze | # It is not possible to define all supported ciphers in one suite. |
409 | 1 | Noel Kuntze | # select apropriate and strong ciphers for your scenario. |
410 | 1 | Noel Kuntze | ike=aes192gcm16-prfsha256-ecp256,aes128gcm16-prfsha256-ecp256,aes128gcm16-prfsha256-ecp521,aes192-sha256-modp3072 |
411 | 1 | Noel Kuntze | esp=aes192gcm16-ecp256,aes192-sha256-modp3072 |
412 | 1 | Noel Kuntze | rightsubnet=10.1.5.0/24 |
413 | 1 | Noel Kuntze | # for this to work, DNS must be usable and working. |
414 | 1 | Noel Kuntze | right=example.com |
415 | 1 | Noel Kuntze | leftauth=psk |
416 | 1 | Noel Kuntze | rightauth=psk |
417 | 1 | Noel Kuntze | |
418 | 1 | Noel Kuntze | conn site-3-legacy-1 |
419 | 1 | Noel Kuntze | leftsubnet=10.1.1.0/24 |
420 | 1 | Noel Kuntze | also=site-3-legacy-base |
421 | 1 | Noel Kuntze | auto=route |
422 | 1 | Noel Kuntze | |
423 | 1 | Noel Kuntze | conn site-3-legacy-2 |
424 | 1 | Noel Kuntze | leftsubnet=10.1.2.0/24 |
425 | 1 | Noel Kuntze | also=site-3-legacy-base |
426 | 1 | Noel Kuntze | auto=route |
427 | 1 | Noel Kuntze | </pre> |
428 | 1 | Noel Kuntze | }} |
429 | 1 | Noel Kuntze | |
430 | 1 | Noel Kuntze | {{collapse(ipsec.secrets) |
431 | 1 | Noel Kuntze | <pre> |
432 | 1 | Noel Kuntze | : RSA foobar.key |
433 | 1 | Noel Kuntze | remote.com : EAP "example" |
434 | 5 | Noel Kuntze | </pre> |
435 | 5 | Noel Kuntze | }} |
436 | 1 | Noel Kuntze | |
437 | 10 | Noel Kuntze | h2. Passthrough policy |
438 | 5 | Noel Kuntze | |
439 | 5 | Noel Kuntze | {{collapse(ipsec.conf) |
440 | 5 | Noel Kuntze | <pre> |
441 | 5 | Noel Kuntze | conn passthrough-1 |
442 | 5 | Noel Kuntze | # makes sure those conns are excluded from every conn selection |
443 | 5 | Noel Kuntze | left=127.0.0.1 |
444 | 5 | Noel Kuntze | right=127.0.0.1 |
445 | 5 | Noel Kuntze | # Those are just example values. Replace them with the apropriate ones! |
446 | 5 | Noel Kuntze | leftsubnet=10.0.0.0/8 |
447 | 5 | Noel Kuntze | rightsubnet=10.0.0.0/8 |
448 | 5 | Noel Kuntze | # those two lines are critical. |
449 | 5 | Noel Kuntze | type=passthrough |
450 | 5 | Noel Kuntze | auto=route |
451 | 5 | Noel Kuntze | </pre> |
452 | 1 | Noel Kuntze | }} |
453 | 7 | Noel Kuntze | |
454 | 13 | Noel Kuntze | h2. Host-To-Host transport mode |
455 | 7 | Noel Kuntze | |
456 | 7 | Noel Kuntze | Based on "the trap-any test scenario":https://www.strongswan.org/testing/testresults/ikev2/trap-any/. |
457 | 7 | Noel Kuntze | |
458 | 7 | Noel Kuntze | The hosts involved are in the 192.168.1.0/24 subnet. |
459 | 8 | Noel Kuntze | The notes from Tobias' comment in issue #196 apply: |
460 | 8 | Noel Kuntze | > The hosts can be limited by specifying rightsubnet (e.g. rightsubnet=192.168.1.0/24,192.168.2.0/30,10.0.2.2/32). It is even possible to limit this to a specific protocol/port (for any remote host use %dynamic[<proto>/<port>], not 0.0.0.0/0[...]). A new test scenario (ikev2/trap-any, bb1d9e45) provides some examples. |
461 | 8 | Noel Kuntze | > |
462 | 8 | Noel Kuntze | > Authentication can easily be done via certificates, but using PSKs is also possible. However, because there is no pattern/subnet matching for IP-based identities you need to either use a single secret for all hosts or use identities appropriately if you want to use different PSKs for different groups of hosts (e.g. use leftid=<host>@<group>.example.com and rightid=*@<group>.example.com in ipsec.conf and *@<group>.example.com : PSK "..." in ipsec.secrets). |
463 | 7 | Noel Kuntze | |
464 | 7 | Noel Kuntze | {{collapse(ipsec.conf) |
465 | 7 | Noel Kuntze | <pre>conn host-to-host |
466 | 7 | Noel Kuntze | ikelifetime=60m |
467 | 7 | Noel Kuntze | keylife=20m |
468 | 7 | Noel Kuntze | rekeymargin=3m |
469 | 7 | Noel Kuntze | keyingtries=1 |
470 | 7 | Noel Kuntze | |
471 | 7 | Noel Kuntze | conn trap-any |
472 | 7 | Noel Kuntze | also=host-to-host |
473 | 7 | Noel Kuntze | right=%any |
474 | 7 | Noel Kuntze | leftsubnet=192.168.1.0/24 |
475 | 7 | Noel Kuntze | rightsubnet=192.168.1.0/24 |
476 | 7 | Noel Kuntze | type=transport |
477 | 7 | Noel Kuntze | authby=psk |
478 | 7 | Noel Kuntze | auto=route |
479 | 7 | Noel Kuntze | </pre> |
480 | 7 | Noel Kuntze | }} |