diff --git a/Dockerfile b/Dockerfile
index 0326936..69f6bbc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,21 @@
FROM php:7.0-apache
-RUN apt-get update && apt-get install -y --no-install-recommends libldb-dev libldap2-dev && rm -rf /var/lib/apt/lists/* && ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \
-&& ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
-RUN docker-php-source extract && docker-php-ext-install -j$(nproc) ldap && docker-php-source delete
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ libldb-dev libldap2-dev \
+ libfreetype6-dev \
+ libjpeg-dev \
+ libpng-dev && \
+ rm -rf /var/lib/apt/lists/* && \
+ ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so && \
+ ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
+
+RUN docker-php-ext-configure gd \
+ --enable-gd-native-ttf \
+ --with-freetype-dir=/usr/include/freetype2 \
+ --with-png-dir=/usr/include \
+ --with-jpeg-dir=/usr/include && \
+ docker-php-ext-install -j$(nproc) ldap gd
ADD https://github.com/PHPMailer/PHPMailer/archive/v6.2.0.tar.gz /tmp
diff --git a/README.md b/README.md
index fe03e4b..13b8b29 100644
--- a/README.md
+++ b/README.md
@@ -4,18 +4,17 @@ LDAP User Manager
This is a PHP LDAP account manager; a web-based GUI interface which allows you to quickly populate a new LDAP directory and easily manage user accounts and groups. It also has a self-service password change module.
It's designed to work with OpenLDAP and to be run as a container. It complements OpenLDAP containers such as [*osixia/openldap*](https://hub.docker.com/r/osixia/openldap/).
-
-
Features
---
* Setup wizard: this will create the necessary structure to allow you to add users and groups and will set up an initial admin user that can log into the user manager.
* Group creation and management.
* User account creation and management.
- * Optionally send an email to the new user with their account credentials.
+ * Optionally send an email to the user with their new or updated account credentials.
* Secure password auto-generator: click the button to generate a secure password.
* Password strength indicator.
* Self-service password change: non-admin users can log in to change their password.
+ * An optional form for people to request accounts (request emails are sent to an administrator).
Screenshots
---
@@ -36,26 +35,6 @@ Screenshots
![self_service_password_change](https://user-images.githubusercontent.com/17613683/59344258-9ffcab80-8d05-11e9-9dc2-27dfd373fcc8.png)
-A note on your LDAP schema - please read this!
----
-
-By default this application will expect the LDAP server to be using the **RFC2307BIS** schema. OpenLDAP (including the **osixia/openldap** image) uses the older NIS schema as its default schema.
-
-> :warning: If you haven't explicitly set up the **RFC2307BIS** schema on your LDAP server then you need to set `LDAP_USES_NIS_SCHEMA` to `TRUE` as shown in the Quick start example below.
-
-**Why should I use RFC2307BIS?**
-
-The user manager will work with either NIS or BIS, but BIS is recommended as it allows you to use **memberOf** searches. You can enable BIS in **osixia/openldap** by setting `LDAP_RFC2307BIS_SCHEMA` to `true` during the initial setup.
-
-**Why not make NIS the default?**
-
-The original versions of this application were set to expect BIS by default. This was before we used specific release versions, so we're expecting the BIS schemas as the default to keep backwards-compatibility for anyone using the `latest` tag.
-
-**I'm unable to use the BIS schema!**
-
-If you can't or prefer not to use RFC2307BIS then set `LDAP_USES_NIS_SCHEMA` to `TRUE`. This will create groups solely as the **posixGroup** objectclass, and the default for `LDAP_GROUP_MEMBERSHIP_USES_UID` will `TRUE`.
-
-
Quick start
---
@@ -72,11 +51,11 @@ docker run \
-e "LDAP_ADMINS_GROUP=admins" \
-e "LDAP_ADMIN_BIND_DN=cn=admin,dc=example,dc=com" \
-e "LDAP_ADMIN_BIND_PWD=secret"\
- -e "LDAP_USES_NIS_SCHEMA=true" \
- -e "EMAIL_DOMAIN=ldapusermanager.org"\
- wheelybird/ldap-user-manager:v1.4
+ -e "LDAP_IGNORE_CERT_ERRORS=true" \
+ -e "EMAIL_DOMAIN=ldapusermanager.org" \
+ wheelybird/ldap-user-manager:v1.5
```
-Change the variable values to suit your environment. You might need to change `LDAP_USES_NIS_SCHEMA` if you're using the BIS schema. Now go to https://lum.example.com/setup.
+Change the variable values to suit your environment. Now go to https://lum.example.com/setup.
Configuration
@@ -84,8 +63,8 @@ Configuration
Configuration is via environmental variables. Please bear the following in mind:
- * This tool needs to bind to LDAP as a user with permissions to modify everything under the base DN.
- * This interface is designed to work with a fresh LDAP server and should be against populated LDAP directories with caution and at your own risk.
+ * This tool needs to bind to LDAP as a user that has the permissions to modify everything under the base DN.
+ * This interface is designed to work with a fresh LDAP server and should only be against existing, populated LDAP directories with caution and at your own risk.
Mandatory:
----
@@ -116,17 +95,24 @@ Optional:
* `LDAP_USER_OU` (default: *people*): The name of the OU used to store user accounts (without the base DN appended).
-* `LDAP_USES_NIS_SCHEMA` (default: *FALSE*): If you use the NIS schema instead of the (preferable) RFC2307BIS schema, set this to `TRUE`. See [A note on your LDAP schema](#a-note-on-your-ldap-schema) for more information.
-
* `LDAP_GROUP_OU` (default: *groups*): The name of the OU used to store groups (without the base DN appended).
-* `LDAP_GROUP_MEMBERSHIP_ATTRIBUTE` (default: *memberUID* or *uniqueMember*): The attribute used when adding a user to a group. If `LDAP_USES_NIS_SCHEMA` is `TRUE` the default is `memberUID`, otherwise it's `uniqueMember`. Explicitly setting this variable will override the default.
-* `LDAP_GROUP_MEMBERSHIP_USES_UID` (default: *TRUE* or *FALSE*): If *TRUE* then the entry for a member of a group will be just the username. Otherwise it's the member's full DN. If `LDAP_USES_NIS_SCHEMA` is `TRUE` the default is `TRUE`, otherwise it's `FALSE`. Explicitly setting this variable will override the default.
* `LDAP_REQUIRE_STARTTLS` (default: *TRUE*): If *TRUE* then a TLS connection is required for this interface to work. If set to *FALSE* then the interface will work without STARTTLS, but a warning will be displayed on the page.
* `LDAP_IGNORE_CERT_ERRORS` (default: *FALSE*): If *TRUE* then problems with the certificate presented by the LDAP server will be ignored (for example FQDN mismatches). Use this if your LDAP server is using a self-signed certificate and you don't have a CA certificate for it or you're connecting to a pool of different servers via round-robin DNS.
-* `LDAP_TLS_CACERT` (no default): If you need to use a specific CA certificate for TLS connections to the LDAP server (when `LDAP_REQUIRE_STARTTLS` is set) then assign the contents of the CA certificate to this variable. e.g. `-e LDAP_TLS_CACERT=$(/etc/apache2/sites-enabled/lum.conf
diff --git a/www/account_manager/index.php b/www/account_manager/index.php
index e989755..097ee7c 100644
--- a/www/account_manager/index.php
+++ b/www/account_manager/index.php
@@ -48,9 +48,8 @@ if (isset($_POST['delete_user'])) {
}
}
-
+#'
$people = ldap_get_user_list($ldap_connection);
-ldap_close($ldap_connection);
?>
\n";
-
+
}
?>
diff --git a/www/account_manager/new_user.php b/www/account_manager/new_user.php
index 8b40a07..7603094 100644
--- a/www/account_manager/new_user.php
+++ b/www/account_manager/new_user.php
@@ -33,9 +33,26 @@ $mismatched_passwords = FALSE;
$invalid_username = FALSE;
$weak_password = FALSE;
$invalid_email = FALSE;
+$disabled_email_tickbox = TRUE;
-if ($SMTP['host'] != "") { $can_send_email = TRUE; } else { $can_send_email = FALSE; }
+if (isset($_GET['account_request'])) {
+ $first_name=filter_var($_GET['first_name'], FILTER_SANITIZE_STRING);
+ $last_name=filter_var($_GET['last_name'], FILTER_SANITIZE_STRING);
+ $email=filter_var($_GET['email'], FILTER_SANITIZE_EMAIL);
+ $username = generate_username($first_name,$last_name);
+
+ if ($email == "") {
+ if (isset($EMAIL_DOMAIN)) {
+ $email = $username . "@" . $EMAIL_DOMAIN;
+ $disabled_email_tickbox = FALSE;
+ }
+ }
+ else {
+ $disabled_email_tickbox = FALSE;
+ }
+
+}
if (isset($_POST['create_account'])) {
@@ -53,7 +70,7 @@ if (isset($_POST['create_account'])) {
if (preg_match("/\"|'/",$password)) { $invalid_password = TRUE; }
if ($_POST['password'] != $_POST['password_match']) { $mismatched_passwords = TRUE; }
if (!preg_match("/$USERNAME_REGEX/",$username)) { $invalid_username = TRUE; }
- if (isset($_POST['send_email']) and isset($email) and $can_send_email == TRUE) { $send_user_email = TRUE; }
+ if (isset($_POST['send_email']) and isset($email) and $EMAIL_SENDING_ENABLED == TRUE) { $send_user_email = TRUE; }
if ( isset($first_name)
@@ -84,8 +101,7 @@ You've been set up with an account for $ORGANISATION_NAME. Your credentials are
Username: $username
Password: $password
-You should change your password as soon as possible. Log into the account manager at ${SITE_PROTOCOL}${SERVER_HOSTNAME}/log_in using your credentials.
-Once logged in you can change your password at ${SITE_PROTOCOL}${SERVER_HOSTNAME}/change_password/
+You should change your password as soon as possible. Go to ${SITE_PROTOCOL}${SERVER_HOSTNAME}/change_password and log in using your new credentials. This will take you to a page where you can change your password.
EoT;
include_once "mail_functions.inc.php";
@@ -216,15 +232,15 @@ render_js_email_generator('username','email');
function check_email_validity(email) {
- var check_regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+ var check_regex =
if (! check_regex.test(email) ) {
document.getElementById("email_div").classList.add("has-error");
- document.getElementById("send_email_checkbox").disabled = true;
+ document.getElementById("send_email_checkbox").disabled = true;
}
else {
document.getElementById("email_div").classList.remove("has-error");
- document.getElementById("send_email_checkbox").disabled = false;
+ document.getElementById("send_email_checkbox").disabled = false;
}
}
@@ -289,11 +305,11 @@ render_js_email_generator('username','email');
-
+
- Email these credentials to the user?
+ > Email these credentials to the user?
You've been automatically logged out because you've been inactive for over
+ minutes. Click on the 'Log in' link to get back into the system.
+
+
-
+
Log in
-
+
+
+
+ Please log in to continue
+
+
+
+
+
+ You were logged out because your session expired. Log in again to continue.
+
+
+
The username and/or password are unrecognised.
-
-
+
-
+
-
+
diff --git a/www/request_account/fonts/font_01.ttf b/www/request_account/fonts/font_01.ttf
new file mode 100644
index 0000000..1c388aa
Binary files /dev/null and b/www/request_account/fonts/font_01.ttf differ
diff --git a/www/request_account/fonts/font_02.ttf b/www/request_account/fonts/font_02.ttf
new file mode 100644
index 0000000..6f94b55
Binary files /dev/null and b/www/request_account/fonts/font_02.ttf differ
diff --git a/www/request_account/fonts/font_03.ttf b/www/request_account/fonts/font_03.ttf
new file mode 100644
index 0000000..06486d9
Binary files /dev/null and b/www/request_account/fonts/font_03.ttf differ
diff --git a/www/request_account/fonts/font_04.ttf b/www/request_account/fonts/font_04.ttf
new file mode 100644
index 0000000..c9bf25d
Binary files /dev/null and b/www/request_account/fonts/font_04.ttf differ
diff --git a/www/request_account/human.php b/www/request_account/human.php
new file mode 100644
index 0000000..c0793ad
--- /dev/null
+++ b/www/request_account/human.php
@@ -0,0 +1,76 @@
+";
+}
+
+header('Content-type: image/png');
+imagepng($image);
+imagedestroy($image);
+?>
diff --git a/www/request_account/index.php b/www/request_account/index.php
new file mode 100644
index 0000000..5c9dfdc
--- /dev/null
+++ b/www/request_account/index.php
@@ -0,0 +1,176 @@
+
Account requesting is disabled.
0) { ?>
+
+ The request couldn't be sent because:
+
+
+ $message\n";
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Use this form to send a request for an account to an administrator at .
+ If the administrator approves your request they'll get in touch with you to give you your new credentials.
+
+What's this?";
+ print "\n";
+
+}
+else {
+
+ print "$li_warn The RFC2307BIS schema doesn't appear to be available. \nIf this is incorrect, set FORCE_RFC2307BIS to TRUE, restart the user manager and run the setup again. ";
+ print "What's this?";
+ print "\n";
+
+}
+
+
?>
@@ -73,7 +111,7 @@ if ($group_result['count'] != 1) {
print "";
print "\n";
$show_finish_button = FALSE;
-
+
}
else {
print "$li_good The group OU (${LDAP['group_dn']}) is present.";
@@ -92,7 +130,7 @@ if ($user_result['count'] != 1) {
print "";
print "\n";
$show_finish_button = FALSE;
-
+
}
else {
print "$li_good The user OU (${LDAP['user_dn']}) is present.";
@@ -122,7 +160,7 @@ if ($gid_result['count'] != 1) {
print "";
print "\n";
$show_finish_button = FALSE;
-
+
}
else {
print "$li_good The lastGID entry is present.";
@@ -142,7 +180,7 @@ if ($uid_result['count'] != 1) {
print "";
print "\n";
$show_finish_button = FALSE;
-
+
}
else {
print "$li_good The lastUID entry is present.";
@@ -162,7 +200,7 @@ if ($defgroup_result['count'] != 1) {
print "";
print "\n";
$show_finish_button = FALSE;
-
+
}
else {
print "$li_good The default user group ($DEFAULT_USER_GROUP) is present.";
@@ -182,13 +220,13 @@ if ($adminsgroup_result['count'] != 1) {
print "";
print "\n";
$show_finish_button = FALSE;
-
+
}
else {
print "$li_good The LDAP account administrators group (${LDAP['admins_group']}) is present.";
$admins = ldap_get_group_members($ldap_connection,$LDAP['admins_group']);
-
+
if (count($admins) < 1) {
print "$li_fail The LDAP administration group is empty. You can add an admin account in the next section.";
$show_finish_button = FALSE;