Time for action – using command substitution

Up to now we have used double-quotes to contain a variable that will be referenced. Unlang also features back-quoted strings, which allows for command substitution. The string inside these back-quotes is evaluated similarly to double-quoted strings where string expansion can take place.

Let's modify the previous exercise to show command substitution in action:

  1. Edit the sites-available/default virtual server under the FreeRADIUS configuration directory and add the following inside the post-auth section, at the top of the section:
    if(control:Auth-Type == 'PAP'){ 
        update reply { 
           Reply-Message := `/bin/echo We are using %{control:Auth-Type}`
        } 
    } 
  2. Restart FreeRADIUS in debug mode and try to authenticate as ...

Get FreeRADIUS Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.