| 1 |
== Enabling RadSec with FreeRADIUS |
| 2 |
|
| 3 |
Our first task is to set up a RadSec server by configuring an instance of |
| 4 |
FreeRADIUS to accept RADIUS over TLS requests. |
| 5 |
|
| 6 |
The following steps should be performed on the host which will be the |
| 7 |
RadSec server, we will call it `radsecsvr`. |
| 8 |
|
| 9 |
You can install FreeRADIUS using the InkBridge Networks packages by |
| 10 |
following the instructions provided here: |
| 11 |
|
| 12 |
<https://inkbridgenetworks.com/packages/> |
| 13 |
|
| 14 |
Before making any configuration changes, you should stop the radiusd |
| 15 |
service: |
| 16 |
|
| 17 |
[source,shell] |
| 18 |
---- |
| 19 |
service radiusd stop |
| 20 |
---- |
| 21 |
|
| 22 |
Then, enable the `tls` virtual server: |
| 23 |
|
| 24 |
[source,shell] |
| 25 |
---- |
| 26 |
cd /etc/raddb/sites-enabled |
| 27 |
ln -s ../sites-available/tls |
| 28 |
---- |
| 29 |
|
| 30 |
The FreeRADIUS distribution contains an example Certificate Authority |
| 31 |
that will have generated the necessary CA, server and client |
| 32 |
certificates and keys during package installation. You can use this |
| 33 |
CA, or you can use your own CA and certificates. |
| 34 |
|
| 35 |
[TIP] |
| 36 |
==== |
| 37 |
If the example certificates are not present (for example if FreeRADIUS was |
| 38 |
installed from source) then FreeRADIUS will fail to start. The files can be |
| 39 |
regenerated by running `make` in the `/etc/raddb/certs` directory. |
| 40 |
==== |
| 41 |
|
| 42 |
Edit the `tls` virtual server configuration, in order to add |
| 43 |
definitions for the clients by extending the `clients radsec {}` section: |
| 44 |
|
| 45 |
.Example radsec client definitions in `/etc/raddb/sites-available/tls` |
| 46 |
==== |
| 47 |
|
| 48 |
clients radsec { |
| 49 |
... |
| 50 |
# Direct connections from the test client |
| 51 |
client radseccli { |
| 52 |
ipaddr = 172.23.0.2 |
| 53 |
proto = tls |
| 54 |
virtual_server = default |
| 55 |
} |
| 56 |
# Connections via HAproxy |
| 57 |
client haproxy { |
| 58 |
ipaddr = 172.23.0.4 |
| 59 |
proto = tls |
| 60 |
virtual_server = default |
| 61 |
} |
| 62 |
# Connections via Traefik |
| 63 |
client traefik { |
| 64 |
ipaddr = 172.23.0.5 |
| 65 |
proto = tls |
| 66 |
virtual_server = default |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
==== |
| 71 |
|
| 72 |
The client `ipaddr` configuration item is used to match the source IP |
| 73 |
address of incoming connections. You must add client definitions for |
| 74 |
each of the clients which will connect. |
| 75 |
|
| 76 |
For RadSec, you can just list the IP address of the RadSec client. |
| 77 |
This client definition is used for processing RADIUS packets from the |
| 78 |
RadSec client. |
| 79 |
|
| 80 |
[NOTE] |
| 81 |
==== |
| 82 |
A `secret` does not have to be specified for RadSec clients, as the |
| 83 |
default is `radsec`. If you specify a secret, then that will be used |
| 84 |
instead of `radsec`. |
| 85 |
==== |
| 86 |
|
| 87 |
When the PROXY protocol is used, you must _also_ define a client which |
| 88 |
matches the IP address of the proxy (haproxy, etc). This client is |
| 89 |
only used to check that the source IP is permitted to connect to the |
| 90 |
server. Fields other than `ipaddr` can be specified (and in some |
| 91 |
cases may be required). However, all other fields will be ignored. |
| 92 |
|
| 93 |
For testing purposes, we want to amend the `default` virtual server so |
| 94 |
that it accepts all authentication reqeusts and immediately responds |
| 95 |
to accounting requests. |
| 96 |
|
| 97 |
Edit the `/etc/raddb/sites-enabled/default` file so that the beginning of |
| 98 |
the `authorize` and `preacct` sections looks as follows: |
| 99 |
|
| 100 |
.Example default virtual server modification to unconditionally accept Access-Requests |
| 101 |
==== |
| 102 |
|
| 103 |
authorize { |
| 104 |
accept |
| 105 |
... |
| 106 |
} |
| 107 |
... |
| 108 |
preacct { |
| 109 |
handled |
| 110 |
... |
| 111 |
} |
| 112 |
|
| 113 |
==== |
| 114 |
|
| 115 |
This change makes the `authorize` section always "accept" the user, |
| 116 |
and makes the `preacct` section always say "we handled the accounting |
| 117 |
request". These changes are only for testing, and should never be |
| 118 |
used in production. |
| 119 |
|
| 120 |
Start the FreeRADIUS service in the foreground with debugging enabled: |
| 121 |
|
| 122 |
[source,shell] |
| 123 |
---- |
| 124 |
radiusd -fxxl /dev/stdout |
| 125 |
---- |
| 126 |
|
| 127 |
Examine the output from FreeRADIUS to ensure that it is now listening for |
| 128 |
RadSec connection on TCP/2083: |
| 129 |
|
| 130 |
.Example output from running `radiusd -fxxl /dev/stdout` |
| 131 |
==== |
| 132 |
|
| 133 |
FreeRADIUS Version 3.0.24 |
| 134 |
Copyright (C) 1999-2021 The FreeRADIUS server project and contributors |
| 135 |
... |
| 136 |
... : Debug: Listening on auth+acct proto tcp address * port 2083 (TLS) bound to server default |
| 137 |
... : Debug: Listening on auth address * port 1812 bound to server default |
| 138 |
... : Debug: Listening on acct address * port 1813 bound to server default |
| 139 |
... : Debug: Listening on auth address :: port 1812 bound to server default |
| 140 |
... : Debug: Listening on acct address :: port 1813 bound to server default |
| 141 |
... |
| 142 |
... : Info: Ready to process requests |
| 143 |
|
| 144 |
==== |
| 145 |
|
| 146 |
FreeRADIUS is now ready to process RadSec traffic. |
| 147 |
|
| 148 |
For testing, we first test normal RADIUS over UDP functionality, then |
| 149 |
the RadSec connection using a test client, then introduce a proxy |
| 150 |
server, and finally we enable PROXY Protocol. Doing the tests in this |
| 151 |
way ensures that we know that all previous steps work before trying |
| 152 |
the next step. This process allows us to quickly narrow down |
| 153 |
problems, and gets us to the final goal _faster_ than just "doing |
| 154 |
everything all at once". |
| 155 |
|
| 156 |
=== Testing the RADIUS policy |
| 157 |
|
| 158 |
Before moving on, verify that the FreeRADIUS policy is able to |
| 159 |
authenticate a local test RADIUS Access-Request over UDP: |
| 160 |
|
| 161 |
[source,shell] |
| 162 |
---- |
| 163 |
echo "User-Name = terry" | radclient 127.0.0.1 auth testing123 |
| 164 |
---- |
| 165 |
|
| 166 |
Due to the `accept` we added in the `authorize` section, the expected |
| 167 |
output should be an Access-Accept: |
| 168 |
|
| 169 |
.Expected output from radclient |
| 170 |
=============================== |
| 171 |
|
| 172 |
Sent Access-Request Id 157 from 0.0.0.0:36850 to 127.0.0.1:1812 length 27 |
| 173 |
Received Access-Accept Id 157 from 127.0.0.1:1812 to 127.0.0.1:36850 length 20 |
| 174 |
|
| 175 |
=============================== |
| 176 |
|
| 177 |
Any other output indicates that there is a problem with the FreeRADIUS |
| 178 |
configuration which *must* be solved before testing RadSec. Carefully verify that |
| 179 |
you have carried out each of the above steps correctly and examine the debug |
| 180 |
output from FreeRADIUS, which will usually tell you what is wrong. |
| 181 |
|
| 182 |
See [how to read the debug |
| 183 |
output](http://wiki.freeradius.org/radiusd-X) for instructions on |
| 184 |
reading amd understanding the debug output. |
| 185 |
|
| 186 |
The next step is to xref:protocols/proxy/radsec_client.adoc[configure |
| 187 |
FreeRADIUS as a RadSec test client] so that we can verify that our |
| 188 |
RadSec server is working. |