Clean up loopback / inaddr_any checks
[freeradius.git] / scripts / exec-program-wait
1 #!/bin/sh
2 #
3 #  $Id$
4 #
5 #  Sample script to add Attribute/Value pairs in the reply sent to
6 #  the NAS.
7 #
8 #  Before version 2.0 of FreeRADIUS, the script could be run from the
9 #  deprecated attributes 'Exec-Program' and 'Exec-Program-Wait'.
10 #  However, these attributes are no longer supported and you have to
11 #  use the module 'rlm_exec' instead.
12 #
13 #  An entry for the module 'rlm_exec' must be added to the file
14 #  'radiusd.conf' with the path of the script.
15 #
16 #modules {
17 #       exec {
18 #               program = "/path/to/program/exec-program-wait"
19 #               wait = yes
20 #               input_pairs = request
21 #               output_pairs = reply
22 #       }
23 #       ...
24 #}
25 #
26 #authorize {
27 #       ...
28 #       exec
29 #       ...
30 #}
31 #
32 #  Each of the attributes in the request will be available in an
33 #  environment variable.  The name of the variable depends on the
34 #  name of the attribute.  All letters are converted to upper case,
35 #  and all hyphens '-' to underlines.
36 #
37 #  For example, the User-Name attribute will be in the $USER_NAME
38 #  environment variable.  If you want to see the list of all of
39 #  the variables, try adding a line 'printenv > /tmp/exec-program-wait'
40 #  to the script.  Then look in the file for a complete list of
41 #  variables.
42 #
43 #  The return value of the program run determines the result
44 #  of the exec instance call as follows:
45 #  (See doc/configurable_failover for details)
46 #  < 0 : fail      the module failed
47 #  = 0 : okthe module succeeded
48 #  = 1 : reject    the module rejected the user
49 #  = 2 : fail      the module failed
50 #  = 3 : okthe module succeeded
51 #  = 4 : handled   the module has done everything to handle the request
52 #  = 5 : invalid   the user's configuration entry was invalid
53 #  = 6 : userlock  the user was locked out
54 #  = 7 : notfound  the user was not found
55 #  = 8 : noop      the module did nothing
56 #  = 9 : updated   the module updated information in the request
57 #  > 9 : fail      the module failed
58 #
59 echo "Reply-Message += \"Hello, %u\","
60 echo "Reply-Message += \"PATH=$PATH\","
61 echo Framed-IP-Address = 255.255.255.255
62 exit 0