Debian Codegraph @

doc/antora/modules/installation/pages/upgrade.adoc

raw
1 = Upgrade to v3
2
3 The configuration for version 3 is *largely* compatible with the version 2
4 configuration. However, it is NOT possible to simply use the v2
5 configuration as-is. Instead, you should re-create it.
6
7 == Security
8
9 A number of configuration items have moved into the "security" subsection of
10 radiusd.conf. If you use these, you should move them. Otherwise, they can
11 be ignored.
12
13 The list of moved options is:
14
15 * chroot
16 * user
17 * group
18 * allow_core_dumps
19 * reject_delay
20 * status_server
21
22 These entries should be moved from "radiusd.conf" to the "security"
23 subsection of that file.
24
25 == Naming
26
27 Many names used by configuration items were inconsistent in earlier
28 versions of the server. These names have been unified in version 3.0.
29
30 If a file is being referenced or created the config item `filename`
31 is used.
32
33 If a file is being created, the initial permissions are set by the
34 `permissions` config item.
35
36 If a directory hierarchy needs to be created, the permissions are set
37 by `dir_permissions`.
38
39 If an external host is referenced in the context of a module the
40 `server` config item is used.
41
42 Unless the config item is a well recognised portmanteau
43 (as `filename` is for example), it must be written as multiple
44 distinct words separated by underscores `_`.
45
46 The configuration items `file`, `script_file`, `module`,
47 `detail`, `detailfile`, `attrsfile`, `perm`, `dirperm`,
48 `detailperm`, and `hostname` are deprecated. As well as any false
49 portmanteaus, and configuration items that used hyphens as word
50 delimiters. e.g. `foo-bar` has been changed to `foo_bar`. Please
51 update your module configuration to use the new syntax.
52
53 In most cases the server will tell you the replacement config item to
54 use. As always, run the server in debugging mode to see these
55 messages.
56
57 == Modules Directory
58
59 As of version 3.0, the `modules/` directory no longer exists.
60
61 Instead, all "example" modules have been put into the
62 `mods-available/` directory. Modules which can be loaded by the
63 server are placed in the `mods-enabled/` directory. All of the
64 modules in that directory will be loaded. This means that the
65 `instantiate` section of radiusd.conf is less important. The only
66 reason to list a module in the `instantiate` section is to force
67 ordering when the modules are loaded.
68
69 Modules can be enabled by creating a soft link. For module `foo`, do:
70
71 [source,shell]
72 ----
73 cd raddb/mods-enabled
74 ln -s ../mods-available/foo
75 ----
76
77 To create "local" versions of the modules, we suggest copying the file
78 instead. This leaves the original file (with documentation) in the
79 `mods-available/` directory. Local changes should go into the
80 `mods-enabled/` directory.
81
82 Module-specific configuration files are now in the `mods-config/`
83 directory. This change allows for better organization, and means that
84 there are fewer files in the main `raddb` directory. See
85 `mods-config/README.rst` for more details.
86
87 == Changed Modules
88
89 The following modules have been changed in this version.
90
91 === rlm_sql
92
93 The SQL configuration has been moved from `sql.conf` to
94 `mods-available/sql`. The `sqlippool.conf` file has also been
95 moved to `mods-available/sqlippool`.
96
97 The SQL module configuration has been changed. The old connection
98 pool options are no longer accepted:
99
100 ----
101 num_sql_socks
102 connect_failure_retry_delay
103 lifetime
104 max_queries
105 ----
106
107 Instead, a connection pool configuration is used. This configuration
108 contains all of the functionality of the previous configuration, but
109 in a more generic form. It also is used in multiple modules, meaning
110 that there are fewer different configuration items. The mapping
111 between the configuration items is:
112
113 ----
114 num_sql_socks -> pool { max }
115 connect_failure_retry_delay -> pool { retry_delay }
116 lifetime -> pool { lifetime }
117 max_queries -> pool { uses }
118 ----
119
120 The pool configuration adds a number of new configuration options,
121 which allow the administrator to better control how FreeRADIUS uses
122 SQL connection pools.
123
124 The following parameters have been changed:
125
126 ----
127 trace -> removed
128 tracefile -> logfile
129 ----
130
131 The logfile is intended to log SQL queries performed. If you need to
132 debug the server, use debugging mode. If `logfile` is set, then
133 *all* SQL queries will go to `logfile`.
134
135 You can now use a NULL SQL database:
136
137 .Example
138 ----
139 driver = rlm_sql_null
140 ----
141
142 This is an empty driver which will always return "success". It is
143 intended to be used to replace the `sql_log` module, and to work in
144 conjunction with the `radsqlrelay` program. Simply take your normal
145 configuration for raddb/mods-enabled/sql, and set:
146
147 .Example
148 ----
149 driver = rlm_sql_null
150 ...
151 logfile = ${radacctdir}/sql.log
152 ----
153
154 All of the SQL queries will be logged to that file. The connection
155 pool does not need to be configured for the `null` SQL driver. It
156 can be left as-is, or deleted from the SQL configuration file.
157
158
159 === rlm_sql_sybase
160
161 The `rlm_sql_sybase` module has been renamed to `rlm_sql_freetds`
162 and the old `rlm_sql_freetds` module has been removed.
163
164 `rlm_sql_sybase` used the newer ct-lib API, and `rlm_sql_freetds`
165 used an older API and was incomplete.
166
167 The new `rlm_sql_freetds` module now also supports database
168 selection on connection startup so `use` statements no longer
169 have to be included in queries.
170
171
172 === sql/dialup.conf
173
174 Queries for post-auth and accounting calls have been re-arranged. The
175 SQL module will now expand the 'reference' configuration item in the
176 appropriate sub-section, and resolve this to a configuration
177 item. This behaviour is similar to rlm_linelog. This dynamic
178 expansion allows for a dynamic mapping between accounting types and
179 SQL queries. Previously, the mapping was fixed. Any "new" accounting
180 type was ignored by the module. Now, support for any accounting type
181 can be added by just adding a new target, as below.
182
183 Queries from v2.x.x may be manually copied to the new v3.0
184 `dialup.conf` file (`raddb/sql/main/<dialect>/queries.conf`).
185 When doing this you may also need to update references to the
186 accounting tables, as their definitions will now be outside of
187 the subsection containing the query.
188
189 The mapping from old "fixed" query to new "dynamic" query is as follows:
190
191 ----
192 accounting_onoff_query -> accounting.type.accounting-on.query
193 accounting_update_query -> accounting.type.interim-update.query
194 accounting_update_query_alt +> accounting.type.interim-update.query
195 accounting_start_query -> accounting.type.start.query
196 accounting_start_query_alt +> accounting.type.start.query
197 accounting_stop_query -> accounting.type.stop.query
198 accounting_stop_query_alt +> accounting.type.stop.query
199 postauth_query -> post-auth.query
200 ----
201
202 Alternatively a 2.x.x config may be patched to work with the
203 3.0 module by adding the following:
204
205 .Example
206 [source,unlang]
207 ----
208 accounting {
209 reference = "%{tolower:type.%{Acct-Status-Type}.query}"
210 type {
211 accounting-on {
212 query = "${....accounting_onoff_query}"
213 }
214 accounting-off {
215 query = "${....accounting_onoff_query}"
216 }
217 start {
218 query = "${....accounting_start_query}"
219 query = "${....accounting_start_query_alt}"
220 }
221 interim-update {
222 query = "${....accounting_update_query}"
223 query = "${....accounting_update_query_alt}"
224 }
225 stop {
226 query = "${....accounting_stop_query}"
227 query = "${....accounting_stop_query_alt}"
228 }
229 }
230 }
231 post-auth {
232 query = "${..postauth_query}"
233 }
234 ----
235
236 In general, it is safer to migrate the configuration rather than
237 trying to "patch" it, to make it look like a v2 configuration.
238
239 Note that the sub-sections holding the queries are labelled
240 `accounting-on`, and not `accounting_on`. The reason is that the
241 names of these sections are taken directly from the
242 `Accounting-Request` packet, and the `Acct-Status-Type` field.
243 The `sql` module looks at the value of that field, and then looks
244 for a section of that name, in order to find the query to use.
245
246 That process means that the server can be extended to support any new
247 value of `Acct-Status-Type`, simply by adding a named sub-section,
248 and a query. This behavior is preferable to that of v2, which had
249 hard-coded queries for certain `Acct-Status-Type` values, and was
250 ignored all other values.
251
252 === rlm_ldap
253
254 The LDAP module configuration has been substantially changed. Please
255 read `raddb/mods-available/ldap`. It now uses a connection pool,
256 just like the SQL module.
257
258 Many of the configuration items remain the same, but they have been
259 moved into subsections. This change is largely cosmetic, but it makes
260 the configuration clearer. Instead of having a large set of random
261 configuration items, they are now organized into logical groups.
262
263 You will need to read your old LDAP configuration, and migrate it
264 manually to the new configuration. Simply copying the old
265 configuration WILL NOT WORK.
266
267 Users upgrading from 2.x.x who used to call the ldap module in
268 `post-auth` should now set `edir_autz = yes`, and remove the `ldap`
269 module from the `post-auth` section.
270
271 === rlm_ldap and LDAP-Group
272
273 In 2.x.x the registration of the `LDAP-Group` pair comparison was done
274 by the last instance of rlm_ldap to be instantiated. In 3.0 this has
275 changed so that only the default `ldap {}` instance registers
276 `LDAP-Group`.
277
278 If `<instance>-LDAP-Group` is already used throughout your configuration
279 no changes will be needed.
280
281 === rlm_ldap authentication
282
283 In 2.x.x the LDAP module had a `set_auth_type` configuration item,
284 which forced `Auth-Type := ldap`. This was removed in 3.x.x as it
285 often did not work, and was not consistent with the rest of the
286 server. We generally recommend that LDAP should be used as a
287 database, and that FreeRADIUS should do authentication.
288
289 The only reason to use `Auth-Type := ldap` is when the LDAP server
290 will not supply the "known good" password to FreeRADIUS, *and* where
291 the Access-Request contains User-Password. This situation happens
292 only for Active Directory. If you think you need to force `Auth-Type
293 := ldap` in other situations, you are very likely to be wrong.
294
295 The following is an example of what should be inserted into the
296 `authorize {}` and `authenticate {}` sections of the relevant
297 virtual-servers, to get functionality equivalent to v2.x:
298
299 .Example
300 [source,unlang]
301 ----
302 authorize {
303 ...
304 ldap
305 if ((ok || updated) && User-Password) {
306 update control {
307 Auth-Type := ldap
308 }
309 ...
310 }
311 authenticate {
312 ...
313 Auth-Type ldap {
314 ldap
315 }
316 ...
317 }
318 ----
319
320 === rlm_eap
321
322 The EAP configuration has been moved from `eap.conf` to
323 `mods-available/eap`. A new `pwd` subsection has been added for
324 EAP-PWD.
325
326
327 === rlm_expiration & rlm_logintime
328
329 The rlm_expiration and rlm_logintime modules no longer add a `Reply-Message`,
330 the same behaviour can be achieved checking the return code of the module and
331 adding the `Reply-Message` with unlang:
332
333 .Example
334 [source,unlang]
335 ----
336 expiration
337 if (userlock) {
338 update reply {
339 Reply-Message := "Your account has expired"
340 }
341 }
342 ----
343
344
345 === rlm_unix
346
347 The `unix` module does not have an `authenticate` section. So you
348 cannot set `Auth-Type := System`. The `unix` module has also been
349 deleted from the examples in `sites-available/`. Listing it there
350 has been deprecated for many years.
351
352 The PAP module can do crypt authentication. It should be used instead
353 of Unix authentication.
354
355 The Unix module still can pull the passwords from `/etc/passwd`, or
356 `/etc/shadow`. This is done by listing it in the `authorize`
357 section, as is done in the examples in `sites-available/`. However,
358 some systems using NIS or NSS will not supply passwords to the
359 `unix` module. For those systems, we recommend putting users and
360 passwords into a database, instead of relying on `/etc/passwd`.
361
362
363 === rlm_preprocess
364
365 In 2.x.x `huntroups` and `users` files were loaded from default locations
366 without being configured explicitly. Since 3.x.x you need to set
367 `huntgroups` and `users` configuration item(s) in module section in order
368 to get them being processed.
369
370
371 == New Modules
372
373 === rlm_date
374
375 Instances of rlm_date register an xlat method which can translate
376 integer and date values to an arbitrarily formatted date time
377 string, or an arbitrarily formated time string to an integer,
378 depending on the attribute type passed.
379
380
381 === rlm_rest
382
383 The `rest` module is used to translate RADIUS requests into
384 RESTfull HTTP requests. Currently supported body types are JSON
385 and POST.
386
387
388 === rlm_unpack
389
390 The `unpack` module is used to turn data buried inside of binary
391 attributes. e.g. if we have `Class = 0x00000001020304` then:
392
393 .Example
394 [source,unlang]
395 ----
396 Tmp-Integer-0 := "%{unpack:&Class 4 short}"
397 ----
398
399 will unpack octets 4 and 5 as a "short", which has value 0x0304.
400 All integers are assumed to be in network byte order.
401
402
403 === rlm_yubikey
404
405 The `yubikey` module can be used to forward yubikey OTP token
406 values to a Yubico validation server, or decrypt the token
407 using a PSK.
408
409
410 == Deleted Modules
411
412 The following modules have been deleted, and are no longer supported
413 in Version 3. If you are using one of these modules, your
414 configuration can probably be changed to not need it. Otherwise email
415 the freeradius-devel list, and ask about the module.
416
417
418 === rlm_acct_unique
419
420 This module has been replaced by the "acct_unique" policy. See
421 raddb/policy.d/accounting.
422
423 The method for calculating the value of acct_unique has changed.
424 However, as this method was configurable, this change should not
425 matter. The only issue is in having a v2 and v3 server writing to the
426 same database at the same time. They will calculate different values
427 for Acct-Unique-Id.
428
429
430 === rlm_acctlog
431
432 You should use rlm_linelog instead. That module has a superset of the
433 acctlog functionality.
434
435
436 === rlm_attr_rewrite
437
438 The attr_rewrite module looked for an attribute, and then re-wrote it,
439 or created a new attribute. All of that can be done in "unlang".
440
441 A sample configuration in "unlang" is:
442
443 .Example
444 [source,unlang]
445 ----
446 if (request:Calling-Station-Id) {
447 update request {
448 Calling-Station-Id := "...."
449 }
450 }
451 ----
452
453 We suggest updating all uses of attr_rewrite to use unlang instead.
454
455
456 === rlm_checkval
457
458 The checkval module compared two attributes. All of that can be done in "unlang":
459
460 .Example
461 [source,unlang]
462 ----
463 if (&request:Calling-Station-Id == &control:Calling-Station-Id) {
464 ok
465 }
466 ----
467
468 We suggest updating all uses of checkval to use unlang instead.
469
470
471 === rlm_dbm
472
473 No one seems to use it. There is no sample configuration for it.
474 There is no speed advantage to using it over the "files" module.
475 Modern systems are fast enough that 10K entries can be read from the
476 "users" file in about 10ms. If you need more users than that, use a
477 real database such as SQL.
478
479
480 === rlm_fastusers
481
482 No one seems to use it. It has been deprecated since Version 2.0.0.
483 The "files" module was rewritten so that the "fastusers" module was no
484 longer necessary.
485
486
487 === rlm_policy
488
489 No one seems to use it. Almost all of its functionality is available
490 via `unlang`.
491
492
493 === rlm_sim_files
494
495 The rlm_sim_files module has been deleted. It was never marked "stable",
496 and was never used in a production environment. There are better ways
497 to test EAP.
498
499 If you want similar functionality, see rlm_passwd. It can read CSV
500 files, and create attributes from them.
501
502
503 === rlm_sql_log
504
505 This has been replaced with the "null" sql driver. See
506 `raddb/mods-available/sql` for an example configuration.
507
508 The main SQL module has more functionality than rlm_sql_log, and
509 results in less code in the server.
510
511 == Other Functionality
512
513 The following is a list of new / changed functionality.
514
515 === RadSec
516
517 RadSec (or RADIUS over TLS) is now supported. RADIUS over bare TCP
518 is also supported, but is recommended only for secure networks.
519
520 See `sites-available/tls` for complete details on using TLS. The server
521 can both receive incoming TLS connections, and also originate outgoing
522 TLS connections.
523
524 The TLS configuration is taken from the old EAP-TLS configuration. It
525 is largely identical to the old EAP-TLS configuration, so it should be
526 simple to use and configure. It re-uses much of the EAP-TLS code,
527 so it is well-tested and reliable.
528
529 Once RadSec is enabled, normal debugging mode will not work. This is
530 because the TLS code requires threading to work properly. Instead of doing:
531
532 .Example
533 [source,shell]
534 ----
535 radiusd -X
536 ----
537
538 you will need to do:
539
540 .Example
541 [source,shell]
542 ----
543 radiusd -fxx -l stdout
544 ----
545
546 That's the price to pay for using RadSec. This limitation may be
547 lifted in a future version of the server.
548
549
550 === PAP and User-Password
551
552 From version 3.0 onwards the server no longer supports authenticating
553 against a cleartext password in the 'User-Password' attribute. Any
554 occurences of this (for instance, in the users file) should now be changed
555 to 'Cleartext-Password' instead.
556
557 e.g. change entries like this:
558
559 ----
560 bob User-Password == "hello"
561 ----
562
563 to ones like this:
564
565 ----
566 bob Cleartext-Password := "hello"
567 ----
568
569 If this is not done, authentication will likely fail. The server will
570 also print a helpful message in debugging mode.
571
572 If it really is impossible to do this, the following unlang inserted above
573 the call to the pap module may be used to copy User-Password to the correct
574 attribute:
575
576 .Example
577 [source,unlang]
578 ----
579 if (!control:Cleartext-Password && control:User-Password) {
580 update control {
581 Cleartext-Password := "%{control:User-Password}"
582 }
583 }
584 ----
585
586 However, this should only be seen as a temporary, not permanent, fix.
587 It is better to fix your databases to use the correct configuration.
588
589
590 == Unlang
591
592
593 The unlang policy language is compatible with v2, but has a number of
594 new features. See `man unlang` for complete documentation.
595
596
597 === Errors
598
599 Many more errors are caught when the server is starting up. Syntax
600 errors in `unlang` are caught, and a helpful error message is
601 printed. The error message points to the exact place where the error
602 occurred:
603
604 ----
605 ./raddb/sites-enabled/default[230]: Parse error in condition
606 ERROR: if (User-Name ! "bob") {
607 ERROR: ^ Invalid operator
608 ----
609
610 `update` sections are more generic. Instead of doing `update
611 reply`, you can do the following:
612
613 .Example
614 [source,unlang]
615 ----
616 update {
617 reply:Class := 0x0000
618 control:Cleartext-Password := "hello"
619 }
620 ----
621
622 This change means that you need fewer `update` sections.
623
624
625 === Comparisons
626
627 Attribute comparisons can be done via the `&` operator. When you
628 needed to compare two attributes, the old comparison style was:
629
630 .Example
631 [source,unlang]
632 ----
633 if (User-Name == "%{control:Tmp-String-0}") {
634 ----
635
636 This syntax is inefficient, as the `Tmp-String-0` attribute would be
637 printed to an intermediate string, causing unnecessary work. You can
638 now instead compare the two attributes directly:
639
640 .Example
641 [source,unlang]
642 ----
643 if (&User-Name == &control:Tmp-String-0) {
644 ----
645
646 See `man unlang` for more details.
647
648 === Casts
649
650 Casts are now permitted. This allows you to force type-specific
651 comparisons:
652
653 .Example
654 [source,unlang]
655 ----
656 if (<ipaddr>"%{sql: SELECT...}" == 127.0.0.1) {
657 ----
658
659 This forces the string returned by the SELECT to be treated as an IP
660 address, and compare to `127.0.0.1`. Previously, the comparison
661 would have been done as a simple string comparison.
662
663
664 === Networks
665
666 IP networks are now supported:
667
668 if (127.0.0.1/32 == 127.0.0.1) {
669
670 Will be `true`. The various comparison operators can be used to
671 check IP network membership::
672
673 .Example
674 [source,unlang]
675 ----
676 if (127/8 > 127.0.0.1) {
677 ----
678
679 Returns `true`, because `127.0.0.1` is within the `127/8`
680 network. However, the following comparison will return `false`::
681
682 .Example
683 [source,unlang]
684 ----
685 if (127/8 > 192.168.0.1) {
686 ----
687
688 because `192.168.0.1` is outside of the `127/8` network.
689
690
691 === Optimization
692
693 As `unlang` is now pre-compiled, many compile-time optimizations are
694 done. This means that the debug output may not be exactly the same as
695 what is in the configuration files:
696
697 if (0 && (User-Name == "bob')) {
698
699 The result will always be `false`, as the `if 0` prevents the
700 following `&& ...` from being evaluated.
701
702 Not only that, but the entire contents of that section will be ignored
703 entirely:
704
705 .Example
706 [source,unlang]
707 ----
708 if (0) {
709 this_module_does_not_exist
710 and_this_one_does_not_exist_either
711 }
712 ----
713
714 In v2, that configuration would result in a parse error, as there is
715 no module called `this_module_does_not_exist`. In v3, that text is
716 ignored. This ability allows you to have dynamic configurations where
717 certain parts are used (or not) depending on compile-time configuration.
718
719 Similarly, conditions which always evaluate to `true` will be
720 optimized away:
721
722
723 .Example
724 [source,unlang]
725 ----
726 if (1) {
727 files
728 }
729 ----
730
731 That configuration will never show the `if (1)` output in debugging mode.
732
733 === Dialup_admin
734
735 The dialup_admin directory has been removed. No one stepped forward
736 to maintain it, and the code had not been changed in many years.
737