diff options
Diffstat (limited to 'config/freeradius2/freeradius.inc')
-rw-r--r-- | config/freeradius2/freeradius.inc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/config/freeradius2/freeradius.inc b/config/freeradius2/freeradius.inc index 00076816..76da6213 100644 --- a/config/freeradius2/freeradius.inc +++ b/config/freeradius2/freeradius.inc @@ -48,15 +48,18 @@ require_once("services.inc"); // Check pfSense version $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); -define('FREERADIUS_BASE', '/usr/pbi/freeradius-' . php_uname("m")); +if ($pfs_version == "2.1" || $pfs_version == "2.2") + define('FREERADIUS_BASE', '/usr/pbi/freeradius-' . php_uname("m")); +else + define('FREERADIUS_BASE', '/usr/local'); $bash_path = FREERADIUS_BASE . "/bin/bash"; -if ($pfs_version == "2.1") { - define('FREERADIUS_LIB', FREERADIUS_BASE . '/lib'); - define('FREERADIUS_ETC', FREERADIUS_BASE . '/etc'); -} else { +if ($pfs_version == "2.2") { define('FREERADIUS_LIB', FREERADIUS_BASE . '/local/lib'); define('FREERADIUS_ETC', FREERADIUS_BASE . '/local/etc'); +} else { + define('FREERADIUS_LIB', FREERADIUS_BASE . '/lib'); + define('FREERADIUS_ETC', FREERADIUS_BASE . '/etc'); } // Check freeradius lib version @@ -65,11 +68,11 @@ if ($pfs_version == "2.1") { $libfiles = scandir(FREERADIUS_LIB); foreach ($libfiles as $libfile){ if (preg_match("/freeradius-/",$libfile)) - $frlib=FREERADIUS_BASE . "/lib/{$libfile}"; + $frlib=FREERADIUS_LIB . '/' . $libfile; } } if ($frlib == ""){ - log_error("freeRADIUS - No freeradius lib found on ".FREERADIUS_BASE."/lib"); + log_error("freeRADIUS - No freeradius lib found on ".FREERADIUS_LIB); } function freeradius_deinstall_command() { @@ -92,7 +95,9 @@ function freeradius_install_command() { @symlink(FREERADIUS_ETC . "/raddb", "/usr/local/etc/raddb"); if (!file_exists("/var/log/radutmp")) { exec("touch /var/log/radutmp"); } if (!file_exists("/var/log/radwtmp")) { exec("touch /var/log/radwtmp"); } - exec("chown -R root:wheel " . FREERADIUS_ETC . "/raddb && chown -R root:wheel {$frlib} && chown -R root:wheel /var/log/radacct"); + exec("chown -R root:wheel " . FREERADIUS_ETC . "/raddb /var/log/radacct"); + if (file_exists($frlib)) + exec("chown -R root:wheel {$frlib}"); // creating a backup file of the original policy.conf no matter if user checked this or not if (!file_exists(FREERADIUS_ETC . "/raddb/policy.conf.backup")) { |