parent
4f6fd7bad9
commit
fdde529e91
14 changed files with 160 additions and 21 deletions
@ -1 +1 @@ |
||||
Marc Wäckerlin (http://marc.waeckerlin.org) <marc@waeckerlin.org> |
||||
Marc Wäckerlin (https://marc.wäckerlin.ch) <marc@waeckerlin.org> |
||||
|
@ -0,0 +1,24 @@ |
||||
<?php |
||||
$realm = "MY REALM HERE"; |
||||
$ldaphost = "my.ldap.host"; |
||||
$base = "dc=my,dc=server,dc=com"; |
||||
$userbase = "ou=people,".$base; |
||||
$groupbase = "ou=group,".$base; |
||||
if (!isset($_SERVER['PHP_AUTH_USER'])) { |
||||
header('WWW-Authenticate: Basic realm="'.$REALM.'"'); |
||||
header('HTTP/1.0 401 Unauthorized'); |
||||
exit; |
||||
} else { |
||||
$tstusername = ereg_replace('/^[a-z]/', '-', $_SERVER['PHP_AUTH_USER']); |
||||
$password = $_SERVER['PHP_AUTH_PW']; |
||||
$ldapconn = ldap_connect($ldaphost, 389) |
||||
or error_die("connection to LDAP host failed"); |
||||
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3) |
||||
or error_die("failed to set LDAP protocol version 3"); |
||||
ldap_start_tls($ldapconn) |
||||
or error_die($ldapconn, "cannot start LDAP TLS"); |
||||
$ldapbind = @ldap_bind($ldapconn, 'uid='.$tstusername.','.$userbase, $password) |
||||
or error_die("login failed for $username", '403 Forbidden'); |
||||
$username = $tstuserbname; |
||||
} |
||||
?> |
@ -0,0 +1,13 @@ |
||||
## @id $Id$ |
||||
## |
||||
## This file has been added: |
||||
## - by bootstrap.sh |
||||
## - on Sun, 26 February 2017 11:29:20 +0100 |
||||
## Feel free to change it or even remove and rebuild it, up to your needs |
||||
## |
||||
## 1 2 3 4 5 6 7 8 |
||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890 |
||||
|
||||
pkgsysconfdir = ${sysconfdir}/@PACKAGE_NAME@ |
||||
|
||||
dist_pkgsysconf_DATA = settings.php authentication.php |
@ -0,0 +1,5 @@ |
||||
<?php |
||||
$path='/path/to/your/files'; |
||||
$thumbs='/var/tmp/sahring-gallery/thumbnails/'; |
||||
$max_validity_days=30; |
||||
?> |
@ -0,0 +1,6 @@ |
||||
<?php |
||||
$server_password=file_get_contents('@PKGSYSCONFDIR@/password'); |
||||
require('@PKGSYSCONFDIR@/settings.php'); |
||||
if (!$server_password) error_die('no server password'); |
||||
if (!isset($_REQUEST['secret'])) require('@PKGSYSCONFDIR@/authentication.php'); |
||||
?> |
Loading…
Reference in new issue