Time for action – rejecting requests without a realm
The following steps will demonstrate how to reject requests without a realm:
- Edit the
proxy.conf
file under the FreeRADIUS configuration directory and ensure that themy-org.com
realm does not have thenostrip
directive (it was included in the previous exercise). - Edit the
sites-enabled/default
file and add the following unlang code just after thesuffix
entry in theauthorize
section. This will reject any requests with usernames without a realm:if( request:Realm == NULL ){ update reply { Reply-Message := "Username should be in format username@domain" } reject }
- Restart the FreeRADIUS server in debug mode and try to authenticate as alice. The authentication request should fail.
- Authenticate as
alice@my-org.com
. The request should pass.
What just happened?
We have managed to reject any authentication request where a username does not contain a realm.
We had to put the unlang code after the suffix
module because...