Debian Codegraph @

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

raw
1 = Multiple instances of a module
2
3
4
5 *Goal:* To configure the server to have multiple instances of a module.
6
7 *Time:* 10-20 minutes
8
9 *File:*
10
11 - `/etc/raddb/mods-available/detail`
12
13 In this exercise, we will configure the server to use two independent
14 ``databases'' (here, detail files) for recording accounting data. These
15 databases will use the same `detail` module, but with two different
16 configurations. The `detail` module logs plain-text information about
17 the request to a local file and is therefore an easy module to use for
18 demonstration purposes.
19
20 The first step is to configure the server to have two instances of the
21 `detail` module. The first instance should log requests to a different
22 file for each user name. The second should log requests to a different file
23 for each date. The following information should be added to the
24 `/etc/raddb/mods-available/detail` file.
25
26 --------------------------------------------------------------------
27 detail byname {
28 filename = ${radacctdir}/byname/%{User-Name || 'none'}
29 permissions = 0600
30 }
31
32 detail bydate {
33 filename = ${radacctdir}/bydate/%Y-%m-%d
34 permissions = 0600
35 }
36 --------------------------------------------------------------------
37
38 In the module configurations contained within `/etc/raddb/mods-available/*`,
39 each module may have two names. The first name is the name of the dynamically
40 loadable module that implements that functionality. The second (optional) name
41 is the name of an additional instance of the module. In this case, the `detail`
42 module has two additional instances, `byname` and `bydate`. These instance names
43 can be used in the `authorize`, `accounting`, etc. sections, just like a
44 normal module name.
45
46 You should now add the two modules to the list of modules in the
47 `authorize` section. Start the server and verify that it is
48 `Ready to process requests.`
49
50 Send the server a test `Access-Request` packet (`bob.sh`). Verify that
51 the client receives a response packet and that the server is using the
52 two modules to log the request.
53
54 Verify that the request was logged to two different files by examining
55 them:
56
57 [source, bash]
58 ------------------------------------------------
59 $ more /var/log/radius/radacct/byname/*
60 $ more /var/log/radius/radacct/bydate/*
61 ------------------------------------------------
62
63 Once you have verified that the files exist and that the correct
64 information is logged in them, you may stop the server.
65
66 == Questions
67
68 1. Why is it useful to have multiple versions of a module?
69
70 // Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
71 // This documentation was developed by Network RADIUS SAS.