Hello, I am trying to use exec to check if a user in valid in a custom PHP script, what I would like is to get multiple attributes returned. I created a module as: ======================================================================= exec checkuser { wait = yes input_pairs = request output_pairs = reply program = "/etc/raddb/check-user.php -log -debug '%{User-Name}' '%{User-Password}'" shell_escape = yes } ======================================================================= and then activated it in the "authorize" section. The check-user.php script I would like to output the following: ======================================================================= <?php echo "Access-Accept = Accept"; // I used also commas.. same error echo "Mikrotik-Group = student"; echo "Mikrotik-Rate-Limit = 1564k/6400k"; So howevery I am echo-ing these I just get: "Exec format error" ======================================================================== [checkuser] expand: '%{User-Name}' -> 'AC:81:F3:63:7D:07' [checkuser] expand: '%{User-Password}' -> '' Exec-Program output: Exec-Program: FAILED to execute /etc/raddb/check-user.php: Exec format error Exec-Program-Wait: plaintext: Exec-Program: FAILED to execute /etc/raddb/check-user.php: Exec format error Exec-Program: returned: 1 ++[checkuser] returns reject ====================================================================== What is the correct way to return multiple attributes in PHP All help is appreciated, that you. Adnan
Hi ! Is there a cebang on the first line of your PHP script ? like #!/usr/bin/php The interpreter should be available to run your soft. Dom Le 30/11/2013 16:43, Adnan Miljkovic a écrit :
Hello,
I am trying to use exec to check if a user in valid in a custom PHP script, what I would like is to get multiple attributes returned.
I created a module as: ======================================================================= exec checkuser { wait = yes input_pairs = request output_pairs = reply program = "/etc/raddb/check-user.php -log -debug '%{User-Name}' '%{User-Password}'" shell_escape = yes } ======================================================================= and then activated it in the "authorize" section.
The check-user.php script I would like to output the following: =======================================================================
<?php
echo "Access-Accept = Accept"; // I used also commas.. same error
echo "Mikrotik-Group = student"; echo "Mikrotik-Rate-Limit = 1564k/6400k";
So howevery I am echo-ing these I just get: "Exec format error" ======================================================================== [checkuser] expand: '%{User-Name}' -> 'AC:81:F3:63:7D:07' [checkuser] expand: '%{User-Password}' -> '' Exec-Program output: Exec-Program: FAILED to execute /etc/raddb/check-user.php: Exec format error Exec-Program-Wait: plaintext: Exec-Program: FAILED to execute /etc/raddb/check-user.php: Exec format error Exec-Program: returned: 1 ++[checkuser] returns reject ======================================================================
What is the correct way to return multiple attributes in PHP
All help is appreciated, that you.
Adnan
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Adnan Miljkovic wrote:
I am trying to use exec to check if a user in valid in a custom PHP script, what I would like is to get multiple attributes returned.
That should be possible.
The check-user.php script I would like to output the following: =======================================================================
<?php
Uh... you do realize that syntax is only for web pages, right? The script that FreeRADIUS runs *must* be a valid executable. i.e. if you can't run it from the command line, then FreeRADIUS can't run it either. You'll have to replace that line with the typical shell script header: #!/path/to/php But using the real path, not that string above. The "chmod +x" the script. AND test to see if you can run it from the command line: $ ./script user password You should get the attributes printed out.
What is the correct way to return multiple attributes in PHP
Use a real shell script, not a snippet from a web page. Alan DeKok.
participants (3)
-
Adnan Miljkovic -
Alan DeKok -
Dominique Fournier