Hi all, I want to advise everyone of a debian-specific problem using $ENV{HOSTNAME} in freeradius 2 config files : It seems environment passed to freeradius at startup does not have HOSTNAME defined. In fact, it seems only a subset of environment variables are passed to executables ... To be able to use this, we have to explicitly set HOSTNAME environment BEFORE launching freeradius. For example : freeradius -X will expand $ENV{HOSTNAME} to empty string HOSTNAME=`hostname` freeradius -X will expand $ENV{HOSTNAME} to correct value ... in /etc/freeeradois/init.d, you could use this : export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" ### this is present in original export HOSTNAME="`hostname`" ### this has to be added to access $ENV{HOSTNAME} Please note : other debian base distro as Ubuntu show same issue. Best regards Fred
It seems environment passed to freeradius at startup does not have HOSTNAME defined.
Which version of debian are you using? In squeeze /bin/sh is provided by dash, rather than bash, which doesn't seem to set HOSTNAME. Is HOSTNAME used in the default debian freeradius config? If so I would suggest raising a bug to the maintainer of the debian freeradius package. Ben -- | Ben Brown Broadband Solutions for | Infrastructure Engineer Home & Business@ | Plusnet Plc www.plus.net | Registered Office: Internet House, 2 Tenter Street, Sheffield, S1 4BY | Registered in England no: 3279013 + --------------- Plusnet - ISPA Best Consumer ISP 2008 ---------------
I use squeeze. echo "SHELL:$SHELL HOSTNAME:$HOSTNAME" SHELL:/bin/bash HOSTNAME:radius3.nsslab My shell seems to be bash and hostname is present en my interactive environment but absent form a program environment. Try this code : #include <stdlib.h> #include <stdio.h> int main() { const char *hostname = getenv( "HOSTNAME" ); const char *shell = getenv( "SHELL" ); const char *pwd = getenv( "PWD" ); const char *path = getenv( "PATH" ); const char *user = getenv( "USER" ); const char *shlvl = getenv( "SHLVL" ); printf( "PWD (%s)\n", (pwd ? pwd : "not defined!") ); printf( "PATH (%s)\n", (path ? path : "not defined!") ); printf( "SHELL (%s)\n", (shell ? shell : "not defined!") ); printf( "SHLVL (%s)\n", (shell ? shlvl : "not defined!") ); printf( "HOSTNAME (%s)\n", (hostname ? hostname : "not defined!") ); return 0; } Here is the result I got : ./getenv PWD (/home/support/src/getenv) PATH (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin) SHELL (/bin/bash) SHLVL (2) HOSTNAME (not defined!) HOSTNAME=`hostname` ./getenv PWD (/home/support/src/getenv) PATH (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin) SHELL (/bin/bash) SHLVL (2) HOSTNAME (radius3.nsslab) Best regards, Fred 2011/9/29 Ben Brown <bbrown@plus.net>:
It seems environment passed to freeradius at startup does not have HOSTNAME defined.
Which version of debian are you using?
In squeeze /bin/sh is provided by dash, rather than bash, which doesn't seem to set HOSTNAME.
Is HOSTNAME used in the default debian freeradius config? If so I would suggest raising a bug to the maintainer of the debian freeradius package.
Ben
-- | Ben Brown Broadband Solutions for | Infrastructure Engineer Home & Business@ | Plusnet Plc www.plus.net | Registered Office: Internet House, 2 Tenter Street, Sheffield, S1 4BY | Registered in England no: 3279013 + --------------- Plusnet - ISPA Best Consumer ISP 2008 --------------- - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
No, HOSTNAME is not used in default config, as Alan stated before. I believe this is a plateform-specific issue and not really a freeradius issue... Fred 2011/9/29 Ben Brown <bbrown@plus.net>:
It seems environment passed to freeradius at startup does not have HOSTNAME defined.
Which version of debian are you using?
In squeeze /bin/sh is provided by dash, rather than bash, which doesn't seem to set HOSTNAME.
Is HOSTNAME used in the default debian freeradius config? If so I would suggest raising a bug to the maintainer of the debian freeradius package.
Ben
-- | Ben Brown Broadband Solutions for | Infrastructure Engineer Home & Business@ | Plusnet Plc www.plus.net | Registered Office: Internet House, 2 Tenter Street, Sheffield, S1 4BY | Registered in England no: 3279013 + --------------- Plusnet - ISPA Best Consumer ISP 2008 --------------- - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (3)
-
Alan DeKok -
Ben Brown -
Fred