O'Reilly logo

FreeRADIUS Beginner's Guide by Dirk van der Walt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using the if statement in unlang

The if statement itself is not very complex. It has the following format:

if(condition){
    ...
}

The condition part can become complex due to its many possibilities.

Obtaining a return code using the if statement

We will now look at the return code of a module and use this code to compare against the specified condition. Each module in FreeRADIUS is required to return a code after it is called. The value of this code can subsequently be used as a conditional check in the if statement.

Authorizing a user using the if statement

This exercise uses the if condition to reject an Access-Request if the user is not in the users file.

  1. Edit the sites-available/default virtual server under the FreeRADIUS configuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required