| 1 |
= Group Project - Simulating a production service |
| 2 |
|
| 3 |
*Goal:* To create a simulated, federated, production service |
| 4 |
|
| 5 |
*Time:* 2-3 hours |
| 6 |
|
| 7 |
This task is split into multiple sections. If working with an instructor |
| 8 |
you should ask for your configuration file to be validated by the instructor |
| 9 |
after each section is complete. |
| 10 |
|
| 11 |
For this task you will need at least two participants. |
| 12 |
|
| 13 |
== Preparation |
| 14 |
|
| 15 |
Each participant should decide on the following: |
| 16 |
|
| 17 |
* A realm e.g. `example.com`, that their RADIUS server will respond to request for |
| 18 |
the realm must be unique within the group. This will be referred to as |
| 19 |
`your_realm` in the rest of the text. |
| 20 |
* A shared secret for the realm `your_secret`. |
| 21 |
* A backend module (`your_module`) to use to authenticate their users. Again, |
| 22 |
this should be unique within the group. |
| 23 |
Options are: |
| 24 |
+ |
| 25 |
-- |
| 26 |
** `files` |
| 27 |
** `ldap` |
| 28 |
** `redis` |
| 29 |
** `rest` |
| 30 |
** `sql` |
| 31 |
-- |
| 32 |
+ |
| 33 |
For everything except `files` it's recommended to pick a module where you're |
| 34 |
familiar with the backend protocol. |
| 35 |
* A set of credentials (`your_user`, `your_password`). These should not be |
| 36 |
sensitive credentials as they will be seen by the rest of the group. |
| 37 |
|
| 38 |
Each user should send the following information to the instructor or place it in |
| 39 |
a shared document: |
| 40 |
|
| 41 |
- `your_realm` |
| 42 |
- `your_secret` |
| 43 |
- `your_ip` (the public IP address of your test machine) |
| 44 |
- `your_module` |
| 45 |
- `your_user` |
| 46 |
- `your_password` |
| 47 |
|
| 48 |
For local preparation, you should ensure that the following sections have no |
| 49 |
content: |
| 50 |
|
| 51 |
- The `recv Access-Request { ... }` or `authorize { ... }` section of |
| 52 |
`/etc/raddb/sites-available/default`. |
| 53 |
- The `send Access-Accept { ... }` or `post-auth { ... }` section of |
| 54 |
`/etc/raddb/sites-available/default`. |
| 55 |
_Clear the `post-auth-type reject { ...}` section if present but do not remove_. |
| 56 |
- The `send Access-Reject { ... }` section of `/etc/raddb/sites-available/default`. |
| 57 |
|
| 58 |
After completing each of the sections below, you should check that the |
| 59 |
configuration you've produced is valid (radiusd -XC), and if possible, test the |
| 60 |
functionality you've configured using `radtest` or `radclient`/ |
| 61 |
|
| 62 |
== Proxying |
| 63 |
|
| 64 |
*Goal:* To simulate federated access, by configuring proxy destinations for |
| 65 |
multiple upstream home servers. |
| 66 |
|
| 67 |
*Files:* |
| 68 |
|
| 69 |
- xref:reference:raddb/mods-available/radius.adoc[`etc/raddb/mods-available/radius`] |
| 70 |
- xref:reference:raddb/sites-available/default.adoc[`etc/raddb/sites-available/default`] (optionally) |
| 71 |
- xref:reference:raddb/mods-available/linelog.adoc[`etc/raddb/mods-available/linelog`] (optionally) |
| 72 |
|
| 73 |
*Time:* 20-30 minutes |
| 74 |
|
| 75 |
For each participant in the group, create a realm with a single home server. |
| 76 |
|
| 77 |
The information for the realm should come from the shared document, and should use |
| 78 |
the realm name, the secret, and the ip address supplied by the participant. |
| 79 |
|
| 80 |
For `your_realm`, you should create a realm which authenticates users locally on |
| 81 |
your server. |
| 82 |
|
| 83 |
Liveliness checks should be performed with 'status-server'. |
| 84 |
|
| 85 |
All remote realms should be configured with "nostrip", so the full username is |
| 86 |
proxied. |
| 87 |
|
| 88 |
The local realm should not have "nostrip" set. |
| 89 |
|
| 90 |
=== Bonus tasks |
| 91 |
|
| 92 |
* When proxied requests fail, create a linelog message containing the date, the |
| 93 |
username and the destination realm. |
| 94 |
* Log all outbound packets to the proxy. |
| 95 |
* Log all inbound packets from the proxy. |
| 96 |
* For each home server. |
| 97 |
** Set the check interval to three seconds. |
| 98 |
** Set the check timeout to three seconds. |
| 99 |
** Set the "number of answers until alive" to three answers. |
| 100 |
|
| 101 |
== Clients |
| 102 |
|
| 103 |
*Goal:* Allow incoming requests from other servers. |
| 104 |
|
| 105 |
*Files:* |
| 106 |
|
| 107 |
- xref:reference:raddb/clients.conf.adoc[`etc/raddb/clients.conf`] |
| 108 |
|
| 109 |
*Time*: 15-20 minutes |
| 110 |
|
| 111 |
Add client entries for each of the other participants server's, using |
| 112 |
the participant's name as the client name, the ip of their server as `ipaddr` and |
| 113 |
`your_secret` as the secret. |
| 114 |
|
| 115 |
[WARNING] |
| 116 |
==== |
| 117 |
The secret used for the client _must_ be _your_ secret, not the other participants |
| 118 |
secret. The other participant will be configuring your secret in the home |
| 119 |
server definition to send requests to your home server. The client and home server |
| 120 |
definitions must match. |
| 121 |
==== |
| 122 |
|
| 123 |
== Loading credentials |
| 124 |
|
| 125 |
*Goal:* Setup the backend, and populate it with credentials. |
| 126 |
|
| 127 |
*Time:* 10-60 minutes |
| 128 |
|
| 129 |
For your chosen backend: |
| 130 |
|
| 131 |
- Install any necessary packages |
| 132 |
- Load any FreeRADIUS specific schemas |
| 133 |
|
| 134 |
After the backend has bee setup insert your own credentials, and those for every |
| 135 |
other participant in the group, into your backend datastore. |
| 136 |
|
| 137 |
If the datastore provides no authentication method (`sql`, `redis`), you should |
| 138 |
use the value of `Stripped-User-Name` as the key, and when the user attempts to |
| 139 |
login, retrieve the user's password and store it in |
| 140 |
`control.Password.Cleartext`. |
| 141 |
|
| 142 |
== Authorization |
| 143 |
|
| 144 |
*Goal:* Retrieve user information from a backend datastore. |
| 145 |
|
| 146 |
*Files:* |
| 147 |
|
| 148 |
//- xref:reference:raddb/mods-available/suffix.adoc[`etc/raddb/mods-available/suffix`] |
| 149 |
- xref:reference:raddb/mods-available/files.adoc[`etc/raddb/mods-available/files`] |
| 150 |
- `etc/raddb/mods-config/files/authorize` |
| 151 |
- xref:reference:raddb/mods-available/ldap.adoc[`etc/raddb/mods-available/ldap`] |
| 152 |
- xref:reference:raddb/mods-available/redis.adoc[`etc/raddb/mods-available/redis`] |
| 153 |
- xref:reference:raddb/mods-available/rest.adoc[`etc/raddb/mods-available/rest`] |
| 154 |
- xref:reference:raddb/mods-available/sql.adoc[`etc/raddb/mods-available/sql`] |
| 155 |
|
| 156 |
*Time:* 20-60 minutes |
| 157 |
|
| 158 |
First, in the `recv Access-Request { ... }` or `authorize { ... }` section of |
| 159 |
of an appropriate virtual server, call the suffix module. |
| 160 |
|
| 161 |
If, after the suffix module has returned, the `control.Proxy-To-Realm` attribute |
| 162 |
is set, use the `return` keyword to exit from the section. This prevents local |
| 163 |
modules being called, when we know the request will be handled by a remote proxy. |
| 164 |
|
| 165 |
[source,unlang] |
| 166 |
---- |
| 167 |
suffix |
| 168 |
if (control.Proxy-To-Realm) { |
| 169 |
return |
| 170 |
} |
| 171 |
---- |
| 172 |
|
| 173 |
The following backend modules have an built in authorization method: |
| 174 |
|
| 175 |
- `files` |
| 176 |
- `ldap` |
| 177 |
- `rest` |
| 178 |
- `sql` |
| 179 |
|
| 180 |
The redis module has a string expansion %redis(<command>) which can be used |
| 181 |
to retrieve a single value from the datastore. |
| 182 |
|
| 183 |
Call the backend module's authorize method (or run an appropriate expansion) to |
| 184 |
determine if the authenticating user exists in the datastore. |
| 185 |
|
| 186 |
If the user does exist, and your module has an authenticate method (`ldap`, |
| 187 |
`rest`), set `control.Auth-Type` to an appropriate value. |
| 188 |
|
| 189 |
If the backend module does not have an authenticate method (`redis`, `files`, |
| 190 |
`sql`), you should ensure the "known good" copy of the user's password is set in |
| 191 |
`control.Password.Cleartext` and then call the pap module. |
| 192 |
|
| 193 |
=== Bonus tasks |
| 194 |
|
| 195 |
- If the user was `notfound`, i.e. the user is local, log the fact the user was |
| 196 |
not found, along with the username, date and client IP address. |
| 197 |
|
| 198 |
== Authentication |
| 199 |
|
| 200 |
*Goal:* Authenticate a user. |
| 201 |
|
| 202 |
*Time:* 20-30 minutes |
| 203 |
|
| 204 |
For `ldap` and `rest` add or uncomment an appropriate `Auth-Type` section. |
| 205 |
|
| 206 |
For other backend modules, ensure the PAP module's `Auth-Type` section is |
| 207 |
uncommented. |
| 208 |
|
| 209 |
Run `radtest` or `radclient`, with credentials: |
| 210 |
`<your_user>@<your_realm>` and `your_password`. You should receive an Access-Accept. |
| 211 |
|
| 212 |
=== Bonus tasks |
| 213 |
|
| 214 |
- If the user was accepted, log the date, username, and client ip address. |
| 215 |
- If the user was rejected, log the date, username, and client ip address. |
| 216 |
|
| 217 |
== Remote-Authentication |
| 218 |
|
| 219 |
*Goal:* Verify all participants have configured their RADIUS services correctly. |
| 220 |
|
| 221 |
*Time:* 20+ minutes |
| 222 |
|
| 223 |
Check with the other participants to see how much of the exercise they have |
| 224 |
completed. If a participant has a working RADIUS server, send request |
| 225 |
with `<your_user>@<their_realm>` and `your_password`, and verify that |
| 226 |
their server responds with an Access-Accept. |
| 227 |
|
| 228 |
If their server does not respond with an Access-Accept, work with the other |
| 229 |
participant to debug the issue. |
| 230 |
|
| 231 |
|
| 232 |
// Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0. |
| 233 |
// This documentation was developed by Network RADIUS SAS. |