How make freeradius - rlm_exec run multithreaded?

Ryan Allen ryanallenemail at gmail.com
Fri Jan 10 20:46:40 CET 2020


In FreeRadius, we are trying to use rlm_exec to call an external
script in a multithreaded fashion, but once "exec" is called, it
blocks other requests and only processes one request at a time.  We
need to support multiple users signing in at the same time.  How can
we make this multithreaded/multiprocessed?

Here is a simple example we used to verify the blocking issue:
# In file: raddb/sites-available/default
authorize {
    ...
    exec
    update reply {
        Reply-Message = config:Reply-Message
        State = config:State
    }
    handled
    ...
}

# In file: raddb/mods-enabled/exec
exec {
   program = "/bin/bash -f
/etc/raddb/mods-config/.../execBashCustomAuthorization.sh"
   wait = yes
   input_pairs = request
   output_pairs = config
   shell_escape = yes
   timeout = 30
}

# In file: raddb/mods-config/.../execBashCustomAuthorization.sh
#!/bin/bash
sleep 5
echo "Reply-Message = \"A short message\","
echo "State = \"2496578198c5447a8167fe3fe0398133\","
echo "Response-Packet-Type = \"Access-Challenge\""
exit 0

If we send 5 requests to our freeradius server, we expect all 5
responses to come back at about the same time, but they each respond 5
seconds apart, and it takes about 25 seconds for all to complete.

We know that "wait=yes" makes freeradius wait for the script to finish
and processes what the external script sent to stdout, but we thought
it could still handle multiple requests in parallel.  We can't use
"wait=no" because we need output from the external script.

Here are the details of our runtime environment:
FreeRADIUS Version: 3.0.19
Python Version: 2.7.15

Please let us know if you need any additional environmental or
configuration information.

We thank you in advance for any help you can provide.


More information about the Freeradius-Users mailing list