Example #1
0
 function UserIDAuthenticate($userid, $password)
 {
     global $SAMSConf;
     //added by DogEater
     $this->userid = $userid;
     $request = "SELECT s_nick, s_domain, s_gauditor, squiduser.s_group_id, s_autherrorc, s_autherrort, s_user_id FROM squiduser WHERE s_user_id='{$userid}'";
     $this->LoadUserVariables($request);
     //	$STR=$this->SAMSConf->WBINFOPATH." ".$this->UserName." \"$password\"";
     //	$e = escapeshellcmd( $STR );
     //	$aaa=ExecuteShellScript("bin/testwbinfopasswd", $e);
     //	$aaa=ExecuteShellScript("bin/testwbinfopasswd", $e);
     $aaa = ntlm_auth($this->UserName, $password, $SAMSConf->WBINFOPATH);
     //	if(stristr($aaa,"authentication succeeded" )!=false||stristr($aaa,"NT_STATUS_OK" )!=false)
     if (stristr($aaa, "OK") != false || stristr($aaa, "ERR") != true) {
         $this->authOk = 1;
         if ($SAMSConf->NTLMDOMAIN == "Y") {
             if (strrpos($user, "+") != false) {
                 $domainname = strtok($user, "+");
                 $username = strtok("+");
             }
             if (stristr($user, "\\") != false) {
                 $domainname = strtok($user, "\\");
                 $username = strtok("\\");
             }
             if (stristr($user, "@") != false) {
                 $domainname = strtok($user, "@");
                 $username = strtok("@");
             }
         } else {
             $username = $user;
         }
     }
     return $this->authOk;
 }
Example #2
0
function build()
{
    $unix = new unix();
    $sock = new sockets();
    $checkrad = $unix->find_program("checkrad");
    $EnableMikrotik = $sock->GET_INFO("EnableMikrotik");
    echo "Starting FreeRadius.............: checkrad: `{$checkrad}`\n";
    $ListenIP = $sock->GET_INFO("FreeRadiusListenIP");
    $FreeRadiusListenPort = $sock->GET_INFO("FreeRadiusListenPort");
    if ($ListenIP == null) {
        $ListenIP = "*";
    }
    if (!is_numeric($FreeRadiusListenPort)) {
        $FreeRadiusListenPort = 1812;
    }
    echo "Starting FreeRadius.............: Listen addr: `{$ListenIP}:{$FreeRadiusListenPort}`\n";
    $IsMySQL = IsMySQL();
    $UseMySQL = false;
    if ($IsMySQL > 0) {
        $UseMySQL = true;
    }
    $f[] = "prefix = /usr";
    $f[] = "exec_prefix = /usr";
    $f[] = "sysconfdir = /etc";
    $f[] = "localstatedir = /var";
    $f[] = "sbindir = \${exec_prefix}/sbin";
    $f[] = "logdir = /var/log/freeradius";
    $f[] = "raddbdir = /etc/freeradius";
    $f[] = "radacctdir = \${logdir}/radacct";
    $f[] = "name = freeradius";
    $f[] = "confdir = \${raddbdir}";
    $f[] = "run_dir = \${localstatedir}/run/\${name}";
    $f[] = "db_dir = \${raddbdir}";
    $f[] = "libdir = /usr/lib/freeradius";
    $f[] = "pidfile = /var/run/freeradius/freeradius.pid";
    $f[] = "user = root";
    $f[] = "group = root";
    $f[] = "max_request_time = 30";
    $f[] = "cleanup_delay = 5";
    $f[] = "max_requests = {$FreeRadiusListenPort}";
    $f[] = "listen {";
    $f[] = "\ttype = auth";
    $f[] = "\tport = 1812";
    $f[] = "\tipaddr = {$ListenIP}";
    $f[] = "#\tclients = per_socket_clients";
    $f[] = "}";
    $f[] = "";
    $f[] = "";
    $f[] = "listen {";
    $f[] = "\tport = 0";
    $f[] = "\ttype = acct";
    $f[] = "\tipaddr = {$ListenIP}";
    $f[] = "#\tinterface = eth0";
    $f[] = "#\tclients = per_socket_clients";
    $f[] = "}";
    $f[] = "";
    $f[] = "";
    $f[] = "hostname_lookups = no";
    $f[] = "allow_core_dumps = no";
    $f[] = "regular_expressions\t= yes";
    $f[] = "extended_expressions\t= yes";
    $f[] = "";
    $f[] = "log {";
    $f[] = "\tdestination = syslog";
    $f[] = "\tfile = \${logdir}/radius.log";
    $f[] = "\tsyslog_facility = daemon";
    $f[] = "\tstripped_names = no";
    $f[] = "\tauth = yes";
    $f[] = "\tauth_badpass = yes";
    $f[] = "\tauth_goodpass = no";
    $f[] = "}";
    $f[] = "";
    $f[] = "checkrad = {$checkrad}";
    $f[] = "";
    $f[] = "security {";
    $f[] = "\tmax_attributes = 200";
    $f[] = "\treject_delay = 1";
    $f[] = "\tstatus_server = yes";
    $f[] = "}";
    $f[] = "";
    $f[] = "proxy_requests  = yes";
    $f[] = "\$INCLUDE proxy.conf";
    $f[] = "\$INCLUDE clients.conf";
    $f[] = "";
    $f[] = "thread pool {";
    $f[] = "\tstart_servers = 5";
    $f[] = "\tmax_servers = 32";
    $f[] = "\tmin_spare_servers = 3";
    $f[] = "\tmax_spare_servers = 10";
    $f[] = "\tmax_requests_per_server = 0";
    $f[] = "}";
    $f[] = "pap {";
    $f[] = "\tencryption_scheme = clear";
    $f[] = "}";
    $f[] = "";
    $f[] = "modules {";
    $f[] = "\t\$INCLUDE \${confdir}/modules/";
    $f[] = "\t\$INCLUDE eap.conf";
    if ($UseMySQL) {
        $f[] = "\t\$INCLUDE sql.conf";
    }
    $f[] = "#\t\$INCLUDE sql/mysql/counter.conf";
    $f[] = "#\t\$INCLUDE sqlippool.conf";
    $f[] = "}";
    $f[] = "";
    $f[] = "";
    $f[] = "instantiate {";
    $f[] = "\texpr";
    $f[] = "#\tdaily";
    $f[] = "\texpiration";
    $f[] = "\tlogintime";
    $f[] = "}";
    $f[] = "";
    $f[] = "\$INCLUDE policy.conf";
    $f[] = "\$INCLUDE sites-enabled/";
    //$f[]="\$INCLUDE dictionary";
    dictionary();
    echo "Starting FreeRadius.............: /etc/freeradius/radiusd.conf done...\n";
    @mkdir("/etc/freeradius", 0755, true);
    @file_put_contents("/etc/freeradius/radiusd.conf", @implode("\n", $f));
    attrs_access_reject();
    eap();
    pap();
    proxy();
    ntlm_auth();
    build_sql_connections();
    module_ldap();
    inner_tunnel();
    site_default();
    confusers();
    clients();
    mschap();
    microtik();
}