Fix TLS example
[freeradius.git] / raddb / sites-available / tls
1 ######################################################################
2 #
3 #  Initial implementation of RADIUS over TLS (radsec)
4 #
5 ######################################################################
6
7 listen {
8         ipaddr = *
9         port = 2083
10         type = auth
11
12         # For now, only TCP transport is allowed.
13         proto = tcp
14
15         # Send packets to the default virtual server
16         virtual_server = default
17
18         clients = radsec
19
20         #  This is *exactly* the same configuration as used by the EAP-TLS
21         #  module.  It's OK for testing, but for production use it's a good
22         #  idea to use different server certificates for EAP and for RADIUS
23         #  transport.
24         tls {
25                 private_key_password = whatever
26                 private_key_file = ${certdir}/server.pem
27
28                 #  If Private key & Certificate are located in
29                 #  the same file, then private_key_file &
30                 #  certificate_file must contain the same file
31                 #  name.
32                 #
33                 #  If CA_file (below) is not used, then the
34                 #  certificate_file below MUST include not
35                 #  only the server certificate, but ALSO all
36                 #  of the CA certificates used to sign the
37                 #  server certificate.
38                 certificate_file = ${certdir}/server.pem
39
40                 #  Trusted Root CA list
41                 #
42                 #  ALL of the CA's in this list will be trusted
43                 #  to issue client certificates for authentication.
44                 #
45                 #  In general, you should use self-signed
46                 #  certificates for 802.1x (EAP) authentication.
47                 #  In that case, this CA file should contain
48                 #  *one* CA certificate.
49                 #
50                 #  This parameter is used only for EAP-TLS,
51                 #  when you issue client certificates.  If you do
52                 #  not use client certificates, and you do not want
53                 #  to permit EAP-TLS authentication, then delete
54                 #  this configuration item.
55                 CA_file = ${cadir}/ca.pem
56
57                 #
58                 #  For DH cipher suites to work, you have to
59                 #  run OpenSSL to create the DH file first:
60                 #
61                 #       openssl dhparam -out certs/dh 1024
62                 #
63                 dh_file = ${certdir}/dh
64                 random_file = ${certdir}/random
65
66                 #
67                 #  The default fragment size is 1K.
68                 #  However, it's possible to send much more data than
69                 #  that over a TCP connection.  The upper limit is 64K.
70                 #  Setting the fragment size to more than 1K means that
71                 #  there are fewer round trips when setting up a TLS
72                 #  connection.  But only if the certificates are large.
73                 #
74                 fragment_size = 8192
75
76                 #  include_length is a flag which is
77                 #  by default set to yes If set to
78                 #  yes, Total Length of the message is
79                 #  included in EVERY packet we send.
80                 #  If set to no, Total Length of the
81                 #  message is included ONLY in the
82                 #  First packet of a fragment series.
83                 #
84         #       include_length = yes
85
86                 #  Check the Certificate Revocation List
87                 #
88                 #  1) Copy CA certificates and CRLs to same directory.
89                 #  2) Execute 'c_rehash <CA certs&CRLs Directory>'.
90                 #    'c_rehash' is OpenSSL's command.
91                 #  3) uncomment the line below.
92                 #  5) Restart radiusd
93         #       check_crl = yes
94                 CA_path = ${cadir}
95
96                #
97                #  If check_cert_issuer is set, the value will
98                #  be checked against the DN of the issuer in
99                #  the client certificate.  If the values do not
100                #  match, the cerficate verification will fail,
101                #  rejecting the user.
102                #
103                #  In 2.1.10 and later, this check can be done
104                #  more generally by checking the value of the
105                #  TLS-Client-Cert-Issuer attribute.  This check
106                #  can be done via any mechanism you choose.
107                #
108         #       check_cert_issuer = "/C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd"
109
110                #
111                #  If check_cert_cn is set, the value will
112                #  be xlat'ed and checked against the CN
113                #  in the client certificate.  If the values
114                #  do not match, the certificate verification
115                #  will fail rejecting the user.
116                #
117                #  This check is done only if the previous
118                #  "check_cert_issuer" is not set, or if
119                #  the check succeeds.
120                #
121                #  In 2.1.10 and later, this check can be done
122                #  more generally by checking the value of the
123                #  TLS-Client-Cert-CN attribute.  This check
124                #  can be done via any mechanism you choose.
125                #
126         #       check_cert_cn = %{User-Name}
127         #
128                 # Set this option to specify the allowed
129                 # TLS cipher suites.  The format is listed
130                 # in "man 1 ciphers".
131                 cipher_list = "DEFAULT"
132
133                 #
134
135                 #  This configuration entry should be deleted
136                 #  once the server is running in a normal
137                 #  configuration.  It is here ONLY to make
138                 #  initial deployments easier.
139                 #
140                 #
141                 #  This is enabled in eap.conf, so we don't need it here.
142                 #
143 #               make_cert_command = "${certdir}/bootstrap"
144
145                 #
146                 #  Session resumption / fast reauthentication
147                 #  cache.
148                 #
149                 #  The cache contains the following information:
150                 #
151                 #  session Id - unique identifier, managed by SSL
152                 #  User-Name  - from the Access-Accept
153                 #  Stripped-User-Name - from the Access-Request
154                 #  Cached-Session-Policy - from the Access-Accept
155                 #
156                 #  The "Cached-Session-Policy" is the name of a
157                 #  policy which should be applied to the cached
158                 #  session.  This policy can be used to assign
159                 #  VLANs, IP addresses, etc.  It serves as a useful
160                 #  way to re-apply the policy from the original
161                 #  Access-Accept to the subsequent Access-Accept
162                 #  for the cached session.
163                 #
164                 #  On session resumption, these attributes are
165                 #  copied from the cache, and placed into the
166                 #  reply list.
167                 #
168                 #  You probably also want "use_tunneled_reply = yes"
169                 #  when using fast session resumption.
170                 #
171                 cache {
172                       #
173                       #  Enable it.  The default is "no".
174                       #  Deleting the entire "cache" subsection
175                       #  Also disables caching.
176                       #
177                       #  You can disallow resumption for a
178                       #  particular user by adding the following
179                       #  attribute to the control item list:
180                       #
181                       #         Allow-Session-Resumption = No
182                       #
183                       #  If "enable = no" below, you CANNOT
184                       #  enable resumption for just one user
185                       #  by setting the above attribute to "yes".
186                       #
187                       enable = no
188
189                       #
190                       #  Lifetime of the cached entries, in hours.
191                       #  The sessions will be deleted after this
192                       #  time.
193                       #
194                       lifetime = 24 # hours
195
196                       #
197                       #  The maximum number of entries in the
198                       #  cache.  Set to "0" for "infinite".
199                       #
200                       #  This could be set to the number of users
201                       #  who are logged in... which can be a LOT.
202                       #
203                       max_entries = 255
204
205                       #
206                       #  Internal "name" of the session cache.
207                       #  Used to distinguish which TLS context
208                       #  sessions belong to.
209                       #
210                       #  The server will generate a random value
211                       #  if unset. This will change across server
212                       #  restart so you MUST set the "name" if you
213                       #  want to persist sessions (see below).
214                       #
215                       #  If you use IPv6, change the "ipaddr" below
216                       #  to "ipv6addr"
217                       #
218                       #name = "TLS ${..ipaddr} ${..port} ${..proto}"
219
220                       #
221                       #  Simple directory-based storage of sessions.
222                       #  Two files per session will be written, the SSL
223                       #  state and the cached VPs. This will persist session
224                       #  across server restarts.
225                       #
226                       #  The server will need write perms, and the directory
227                       #  should be secured from anyone else. You might want
228                       #  a script to remove old files from here periodically:
229                       #
230                       #    find ${logdir}/tlscache -mtime +2 -exec rm -f {} \;
231                       #
232                       #  This feature REQUIRES "name" option be set above.
233                       #
234                       #persist_dir = "${logdir}/tlscache"
235                 }
236
237                 #
238                 #  Require a client certificate.
239                 #
240                 require_client_cert = yes
241
242                 #
243                 #  As of version 2.1.10, client certificates can be
244                 #  validated via an external command.  This allows
245                 #  dynamic CRLs or OCSP to be used.
246                 #
247                 #  This configuration is commented out in the
248                 #  default configuration.  Uncomment it, and configure
249                 #  the correct paths below to enable it.
250                 #
251                 verify {
252                         #  A temporary directory where the client
253                         #  certificates are stored.  This directory
254                         #  MUST be owned by the UID of the server,
255                         #  and MUST not be accessible by any other
256                         #  users.  When the server starts, it will do
257                         #  "chmod go-rwx" on the directory, for
258                         #  security reasons.  The directory MUST
259                         #  exist when the server starts.
260                         #
261                         #  You should also delete all of the files
262                         #  in the directory when the server starts.
263         #               tmpdir = /tmp/radiusd
264
265                         #  The command used to verify the client cert.
266                         #  We recommend using the OpenSSL command-line
267                         #  tool.
268                         #
269                         #  The ${..CA_path} text is a reference to
270                         #  the CA_path variable defined above.
271                         #
272                         #  The %{TLS-Client-Cert-Filename} is the name
273                         #  of the temporary file containing the cert
274                         #  in PEM format.  This file is automatically
275                         #  deleted by the server when the command
276                         #  returns.
277         #               client = "/path/to/openssl verify -CApath ${..CA_path} %{TLS-Client-Cert-Filename}"
278                 }
279         }
280 }
281
282 clients radsec {
283         client 127.0.0.1 {
284                 ipaddr = 127.0.0.1
285                 proto = tcp
286                 secret = testing123
287         }
288 }
289
290 listen {
291        ipaddr = 127.0.0.1
292        port = 4000
293        type = auth
294 }
295
296 home_server tls {
297         ipaddr = 127.0.0.1
298         port = 2083
299         type = auth
300         secret = testing123
301         proto = tcp
302         status_check = none
303
304         tls {
305                 private_key_password = whatever
306                 private_key_file = ${certdir}/client.pem
307
308                 #  If Private key & Certificate are located in
309                 #  the same file, then private_key_file &
310                 #  certificate_file must contain the same file
311                 #  name.
312                 #
313                 #  If CA_file (below) is not used, then the
314                 #  certificate_file below MUST include not
315                 #  only the server certificate, but ALSO all
316                 #  of the CA certificates used to sign the
317                 #  server certificate.
318                 certificate_file = ${certdir}/client.pem
319
320                 #  Trusted Root CA list
321                 #
322                 #  ALL of the CA's in this list will be trusted
323                 #  to issue client certificates for authentication.
324                 #
325                 #  In general, you should use self-signed
326                 #  certificates for 802.1x (EAP) authentication.
327                 #  In that case, this CA file should contain
328                 #  *one* CA certificate.
329                 #
330                 #  This parameter is used only for EAP-TLS,
331                 #  when you issue client certificates.  If you do
332                 #  not use client certificates, and you do not want
333                 #  to permit EAP-TLS authentication, then delete
334                 #  this configuration item.
335                 CA_file = ${cadir}/ca.pem
336
337                 #
338                 #  For DH cipher suites to work, you have to
339                 #  run OpenSSL to create the DH file first:
340                 #
341                 #       openssl dhparam -out certs/dh 1024
342                 #
343                 dh_file = ${certdir}/dh
344                 random_file = ${certdir}/random
345
346                 #
347                 #  The default fragment size is 1K.
348                 #  However, TLS can send 64K of data at once.
349                 #  It can be useful to set it higher.
350                 #
351                 fragment_size = 8192
352
353                 #  include_length is a flag which is
354                 #  by default set to yes If set to
355                 #  yes, Total Length of the message is
356                 #  included in EVERY packet we send.
357                 #  If set to no, Total Length of the
358                 #  message is included ONLY in the
359                 #  First packet of a fragment series.
360                 #
361         #       include_length = yes
362
363                 #  Check the Certificate Revocation List
364                 #
365                 #  1) Copy CA certificates and CRLs to same directory.
366                 #  2) Execute 'c_rehash <CA certs&CRLs Directory>'.
367                 #    'c_rehash' is OpenSSL's command.
368                 #  3) uncomment the line below.
369                 #  5) Restart radiusd
370         #       check_crl = yes
371                 CA_path = ${cadir}
372
373                #
374                #  If check_cert_issuer is set, the value will
375                #  be checked against the DN of the issuer in
376                #  the client certificate.  If the values do not
377                #  match, the cerficate verification will fail,
378                #  rejecting the user.
379                #
380                #  In 2.1.10 and later, this check can be done
381                #  more generally by checking the value of the
382                #  TLS-Client-Cert-Issuer attribute.  This check
383                #  can be done via any mechanism you choose.
384                #
385         #       check_cert_issuer = "/C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd"
386
387                #
388                #  If check_cert_cn is set, the value will
389                #  be xlat'ed and checked against the CN
390                #  in the client certificate.  If the values
391                #  do not match, the certificate verification
392                #  will fail rejecting the user.
393                #
394                #  This check is done only if the previous
395                #  "check_cert_issuer" is not set, or if
396                #  the check succeeds.
397                #
398                #  In 2.1.10 and later, this check can be done
399                #  more generally by checking the value of the
400                #  TLS-Client-Cert-CN attribute.  This check
401                #  can be done via any mechanism you choose.
402                #
403         #       check_cert_cn = %{User-Name}
404         #
405                 # Set this option to specify the allowed
406                 # TLS cipher suites.  The format is listed
407                 # in "man 1 ciphers".
408                 cipher_list = "DEFAULT"
409         }
410
411 }
412
413 home_server_pool tls {
414                  type = fail-over
415                  home_server = tls
416 }
417
418 realm tls {
419       auth_pool = tls
420 }