Debian Codegraph @

doc/antora/modules/tutorials/pages/module_fail_over.adoc

raw
1 = Module Fail-Over
2
3
4
5 *Goal:* To configure the server to use a "backup" module if a
6 "primary" module fails.
7
8 *Time:* 15-25 minutes
9
10 *Files:*
11
12 - `etc/raddb/mods-available/detail`
13 - `usr/share/doc/freeradius*/configurable_failover`
14 - `/var/log/radius/radacct/detail1`
15 - `/var/log/radius/radacct/detail2`
16
17 When the server uses an external database to find user authentication
18 information or to log accounting requests, that database may sometimes
19 fail temporarily. This situation is similar to the situation seen in the exercise
20 in xref:proxy_failover.adoc[Proxy Failover], where proxied
21 requests "fail-over" to a backup RADIUS server when the primary
22 RADIUS server does not respond.
23
24 In this exercise, we will configure the server to use two "databases"
25 (here, detail files) for recording accounting data. We will simulate the
26 failure of one database by changing the file permissions on the first
27 detail file, and we will verify that accounting requests are logged to the
28 second detail file.
29
30 The first step is to configure the server to have two instances of the
31 `detail` module. The following information should be added to the
32 `etc/raddb/mods-available/detail` file:
33
34 --------------------------------------------------
35 detail detail1 {
36 filename = ${radacctdir}/detail1
37 permissions = 0600
38 }
39
40 detail detail2 {
41 filename = ${radacctdir}/detail2
42 permissions = 0600
43 }
44 --------------------------------------------------
45
46 In the file `configurable_failover` in the documentation directory,
47 there is a section titled "More Complex Configurations". This section contains a
48 sample entry for the "accounting" section of `etc/raddb/sites-available/default`.
49 The sample entry is a "group" with configurable fail-over between two modules named
50 `detail1` and `detail2`. Copy the "group" section to the start of the
51 `accounting` section in your `etc/raddb/sites-available/default` file.
52
53 Now start the server and verify that it is `Ready to process requests.`
54
55 Send the server a sample accounting packet (`bob-acct-start.sh`). Verify
56 that the client receives an accounting response packet and that the
57 server is using the `detail1` module to log the request.
58
59 Verify that the `detail1` file contains the accounting request by
60 examining it:
61
62 [source, bash]
63 -----------------------------------------------
64 $ more /var/log/radius/radacct/detail1
65 -----------------------------------------------
66
67 Also, verify that the `detail2` module is not referenced in the
68 debugging messages of the server when the request is processed. Check
69 that the `detail2` file does not exist:
70
71 [source, bash]
72 ---------------------------------------------
73 $ ls /var/log/radius/radacct/detail2
74 ---------------------------------------------
75
76 The command should fail with an error like "file not found."
77
78 Now, simulate a database failure by changing the permissions on the
79 file so that the server may not access it:
80
81 [source, bash]
82 ----------------------------------------------------
83 $ chmod a-w /var/log/radius/radacct/detail1
84 ----------------------------------------------------
85
86 Send the server another accounting packet ( `bob-acct-stop.sh`).
87
88 Verify that the client receives an accounting response packet, that
89 the `detail1` module fails, and that the server is using the `detail2`
90 module to log the request.
91
92 Verify that the `detail1` file does not contain the accounting request
93 by examining it:
94
95 [source, bash]
96 -----------------------------------------------
97 $ more /var/log/radius/radacct/detail1
98 -----------------------------------------------
99
100 Verify that the `detail2` file exists, and that it contains the accounting
101 request:
102
103 [source, bash]
104 -----------------------------------------------
105 $ more /var/log/radius/radacct/detail2
106 -----------------------------------------------
107
108 == Questions
109
110 1. Could the configuration for the "group" section containing the
111 "detail1" and "detail2" modules be simplified? If so, how?
112
113 // Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
114 // This documentation was developed by Network RADIUS SAS.