#!/usr/bin/php <?php if (isset($argv[1]) && $argv[1] == '-d') { $debug = true; $config['auth_ad_debug'] = 1; } $init_modules = array('web'); require __DIR__ . '/includes/init.php'; // if ldap like, check selinux if($config['auth_mechanism'] = 'ldap' || $config['auth_mechanism'] = "active_directory" ) { $output = shell_exec('getsebool httpd_can_connect_ldap'); if ($output != "httpd_can_connect_ldap --> on\n") { print_error("You need to run: setsebool -P httpd_can_connect_ldap=1"); exit; } } $username = readline('Username: '); echo 'Password: '; `stty -echo`; $password = trim(fgets(STDIN)); `stty echo`; echo PHP_EOL; echo "Authenticate user $username: \n"; if (authenticate($username, $password)) { print_message("AUTH SUCCESS\n"); } else { print_error("AUTH FAILURE\n"); } echo 'ID: ' . get_userid($username) . PHP_EOL; echo 'Name: ' . get_fullname($username) . PHP_EOL; echo 'Level: ' . get_userlevel($username) . PHP_EOL; echo 'Groups: ' . implode('; ', get_group_list()) . PHP_EOL; unset($password);