Skip to content

Changes about some reverse-proxy and LDAP issues #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion www/include/auth/ldap.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,31 @@ function auth_ldap(){
* @return bool
*/
function checkPass($user,$pass){
// reject empty password
global $base;
$ldap_conf="{$base}/local/config/auth_ldap.config.php";

//Opening of the LDAP conf file
$confFile=fopen($ldap_conf,"r");

// This list can be modified depending on the LDAP config file
$var=['debug','version','server','usertree','grouptree','groupfilter'];

for ($i=0;$i<count($var);$i++){
$reading=fgets($confFile);
while($reading[0]!="$"){
$reading=fgets($confFile);
};
$string=explode(" = '",$reading);
$this->cnf[$var[$i]]=explode("';",$string[1])[0];
};

// This 2 variables below can be modified depending on the LDAP configuration you have
$this->cnf['port']=389;
$this->cnf['groupkey']='cn';

fclose($confFile);

// reject empty password
if(empty($pass)) return false;
if(!$this->_openLDAP()) return false;

Expand Down
2 changes: 1 addition & 1 deletion www/include/functions_general.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ function startSession() {
session_set_cookie_params([
'lifetime' => $conf['cookie_life'],
'path' => '/',
'domain' => $_SERVER['SERVER_NAME'],
'domain' => $_SERVER['HTTP_HOST'],
'secure' => $secure,
'httponly' => true,
'samesite' => 'Strict'
Expand Down
2 changes: 1 addition & 1 deletion www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You can enable or disable this by setting the "disable_guest" sysconfig option
if (!$_SESSION['ona']['auth']['user']['username'] and !$conf['disable_guest']) {
$_SESSION['ona']['auth']['user']['username'] = 'guest';
list($status, $js) = get_authentication('guest','guest');
list($status, $js) = get_authentication('guest','test');
get_perms('guest');
}

Expand Down
13 changes: 5 additions & 8 deletions www/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
// Log the user out and redirect them to the login page:

// Print a logout message
printmsg("INFO => [Desktop] {$_SESSION['ona']['auth']['user']['username']} has logged out",0);
if(isset($_SESSION['ona']['auth']['user']['username'])){
printmsg("INFO => [Desktop] {$_SESSION['ona']['auth']['user']['username']} has logged out",0);
}

// Unset session info relating to their account
if(isset($_SESSION['ona']['auth'])) {
Expand All @@ -23,12 +25,7 @@
session_destroy();

// Print javascript to redirect them to https so they can login again
echo <<<EOL
<html><body>
<script type="text/javascript"><!--
window.location = "{$https}{$baseURL}/";
--></script>
</body></html>
EOL;
header("Location: index.php");
exit();

?>