| 1 |
== Configuring FreeRADIUS as a RadSec test client |
| 2 |
|
| 3 |
Unfortunately, the `radclient` program does not support RadSec. We |
| 4 |
must therefore configure an instance of FreeRADIUS as a "transport |
| 5 |
converter" which proxies UDP-based RADIUS requests to a RadSec |
| 6 |
destination of our choice. |
| 7 |
|
| 8 |
The following steps should be performed on a client system, which we |
| 9 |
will call `radseccli`. This system should be a new system, with a |
| 10 |
different IP address. That is, you shoudl not edit the configuration |
| 11 |
on the `radsecsvr` host. Doing so will break the RadSec configuration. |
| 12 |
|
| 13 |
Install FreeRADIUS using the InkBridge Networks packages by following the |
| 14 |
instructions provided here: |
| 15 |
|
| 16 |
<https://inkbridgenetworks.com/packages/> |
| 17 |
|
| 18 |
Before making any configuration changes, you should stop the radiusd |
| 19 |
service: |
| 20 |
|
| 21 |
[source,shell] |
| 22 |
---- |
| 23 |
service radiusd stop |
| 24 |
---- |
| 25 |
|
| 26 |
Add a new `tls` home server definition, which will point to the RadSec |
| 27 |
server. We do this by creating a file |
| 28 |
`/etc/raddb/sites-enabled/radsec-homeserver` with the following |
| 29 |
contents: |
| 30 |
|
| 31 |
.Example homeserver, pool and realm definitions for the RadSec service |
| 32 |
==== |
| 33 |
|
| 34 |
home_server tls { |
| 35 |
ipaddr = 172.23.0.3 # IP address of our RadSec server |
| 36 |
port = 2083 |
| 37 |
type = auth+acct |
| 38 |
proto = tcp |
| 39 |
tls { |
| 40 |
private_key_password = whatever |
| 41 |
private_key_file = ${certdir}/client.pem |
| 42 |
certificate_file = ${certdir}/client.pem |
| 43 |
ca_file = ${cadir}/ca.pem |
| 44 |
} |
| 45 |
} |
| 46 |
home_server_pool tls { |
| 47 |
type = fail-over |
| 48 |
home_server = tls |
| 49 |
} |
| 50 |
realm tls { |
| 51 |
auth_pool = tls |
| 52 |
acct_pool = tls |
| 53 |
} |
| 54 |
|
| 55 |
==== |
| 56 |
|
| 57 |
[TIP] |
| 58 |
==== |
| 59 |
Complete descriptions of each of the above configuration items can be found in the |
| 60 |
`[raddb]/sites-available/tls` example configuration file. For simple tests, however, |
| 61 |
we can omit all of the comments from the file. |
| 62 |
==== |
| 63 |
|
| 64 |
To use this `tls` home server, we change the `default` virtual server to proxy |
| 65 |
all authentication and accounting requests to it. |
| 66 |
|
| 67 |
Edit the `/etc/raddb/sites-enabled/default` file so that the beginning of |
| 68 |
the `authorize` and `preacct` sections looks as follows: |
| 69 |
|
| 70 |
.Example default virtual server modification to proxy requests to a RadSec proxy server |
| 71 |
==== |
| 72 |
|
| 73 |
authorize { |
| 74 |
update control { |
| 75 |
&Proxy-To-Realm := tls |
| 76 |
} |
| 77 |
handled |
| 78 |
... |
| 79 |
} |
| 80 |
... |
| 81 |
preacct { |
| 82 |
update control { |
| 83 |
&Proxy-To-Realm := tls |
| 84 |
} |
| 85 |
handled |
| 86 |
... |
| 87 |
} |
| 88 |
|
| 89 |
==== |
| 90 |
|
| 91 |
These changes make the `tls` virtual server always proxy packets. |
| 92 |
These changes are only for testing, and should never be used in |
| 93 |
production. |
| 94 |
|
| 95 |
We must now copy the example CA certificate as well as the client |
| 96 |
certificate and key files which are on the `radsecsrv` host to this |
| 97 |
test client. |
| 98 |
|
| 99 |
Replace the following files on `radseccli` with the equivalent files from |
| 100 |
`radsecsrv`: |
| 101 |
|
| 102 |
[cols="1,1,1"] |
| 103 |
|=== |
| 104 |
|File|Corresponding configuration item|Purpose |
| 105 |
|
| 106 |
|/etc/raddb/certs/ca.pem |
| 107 |
|`ca_file` |
| 108 |
|CA certificate which is used to authenticate the server certificate presented by the RadSec server to the client. |
| 109 |
|
| 110 |
|/etc/raddb/certs/client.pem |
| 111 |
|`certificate_file` |
| 112 |
|Client certificate (signed by the CA certificate) that is presented by the test client to the RadSec server. |
| 113 |
|
| 114 |
|/etc/raddb/certs/client.pem |
| 115 |
|`private_key_file` and `private_key_password` |
| 116 |
|Private key corresponding to the client certificate |
| 117 |
|=== |
| 118 |
|
| 119 |
Note that the client certificate and key are typically bundled into a single file. |
| 120 |
|
| 121 |
[CAUTION] |
| 122 |
==== |
| 123 |
If you do not correctly replace the CA, client certificate, and key |
| 124 |
material on the test client then the RadSec client and RadSec server |
| 125 |
will fail to mutually authenticate each other as they do not share a |
| 126 |
trusted CA. If you see messages like `unknown CA`, then you know that |
| 127 |
the certificates have not been set up correctly. |
| 128 |
==== |
| 129 |
|
| 130 |
Start the FreeRADIUS service in debug mode: |
| 131 |
|
| 132 |
[source,shell] |
| 133 |
---- |
| 134 |
radiusd -X |
| 135 |
---- |
| 136 |
|
| 137 |
|
| 138 |
=== Testing RadSec connectivity |
| 139 |
|
| 140 |
At this stage you should be able to cause the test client to send RadSec |
| 141 |
requests directly to the RadSec server. |
| 142 |
|
| 143 |
Run the following to send a RADUS (UDP) Access-Request to the local FreeRADIUS |
| 144 |
instance. It should then proxy the request over RadSec connection to |
| 145 |
the remote RadSec server: |
| 146 |
|
| 147 |
[source,shell] |
| 148 |
---- |
| 149 |
echo "User-Name = bob" | radclient 127.0.0.1 auth testing123 |
| 150 |
---- |
| 151 |
|
| 152 |
If the test client is able to successfully establish the RadSec |
| 153 |
connection, and the RadSec server replies with an Access-Accept |
| 154 |
response, then the output will be as follows: |
| 155 |
|
| 156 |
.Expected output from radclient |
| 157 |
=============================== |
| 158 |
|
| 159 |
Sent Access-Request Id 252 from 0.0.0.0:50118 to 127.0.0.1:1812 length 27 |
| 160 |
Received Access-Accept Id 252 from 127.0.0.1:1812 to 127.0.0.1:50118 length 39 |
| 161 |
|
| 162 |
=============================== |
| 163 |
|
| 164 |
Lack of response or an Access-Reject response indicates that the RadSec |
| 165 |
connection is not being established successfully. |
| 166 |
|
| 167 |
There may be serveral reasons for broken connectivity including: |
| 168 |
|
| 169 |
* The client not accepting the certificate presented by the server. |
| 170 |
* The server not accepting the certificate presented by the client. |
| 171 |
|
| 172 |
Look at the debug output generated by both the test client and the RadSec |
| 173 |
server. In many cases it will tell you exactly what the problem is. |
| 174 |
|
| 175 |
Do not proceed with any further steps until direct connections between the |
| 176 |
RadSec client and Radsec Server are working properly. |
| 177 |
|
| 178 |
Once things are working we are ready to |
| 179 |
xref:protocols/proxy/radsec_with_haproxy.adoc[configure HAproxy to proxy RadSec |
| 180 |
connections] or to xref:protocols/proxy/radsec_with_traefik.adoc[configure |
| 181 |
Traefik to proxy RadSec connections]. |