Self Service Password

Aplikacja do samodzielnej zmiany hasła. Źródło: LDAP ToolBox.

Polonizacja

Już nie potrzebna. Została wykonana i włączona do projektu. Jak również wszystkie poniższe poprawki. A poza tym jest już włączone do FreeBSD ports :-)

Zmiany w konfiguracji

touch /usr/local/www/self-service-password/config.inc.local.php

Konfiguracja nginx

# --- definicja katalog/ow ze stronkami -----------------------------
#
location /ssp/ {
    alias /usr/local/www/self-service-password/htdocs/;
    index index.php;

    # zablokowanie dost/epu do znany lokalizacji
    #
    location ~ /(LICENCE|README.md)$/ { deny all; }
    location ~ /(conf|scripts|lib)/ { deny all; }

    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php-fpm-www.socket;
        fastcgi_param  HTTPS on;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $request_filename;
        include        fastcgi_params;
    }

    include expires.conf;
}

location ~ /(haslo|zmianahasla|zmiana-hasla|zmienhaslo|zmien-haslo)/ {
    return 301 https://$server_name/ssp/;
}

Powyższa konfiguracja jest załączana do serwera z repozytorium konfiguracji.

config.inc.php

Istotne miejsca konfiguracji:

  1. ldap_filter decyduje, jakie obiekty są wyszukiwane w katalogu. Domyślnie konta pocztowe są m.in. obiektami typu person. Ale już np. konta PureFTPd nie są. Dlatego też albo trzeba mieć dwie instancje skryptu albo też inaczej napisać filtr.

  2. Problemem jest również mail_attribute. W moim rozwiązaniu zawartość email nie jest zrozumiała dla klientów. Dlatego wybrany jest mailAlternateAddress, co może czasami prowadzić do nadużyć (wspólny alias dla dwóch kont). Niemniej ryzyko jest znikome.

--- config.inc.php.sample       2021-04-20 21:37:47.000000000 +0200
+++ config.inc.php      2021-05-02 15:45:15.259561000 +0200
@@ -34,14 +34,14 @@
 $debug = false;

 # LDAP
-$ldap_url = "ldap://localhost";
+$ldap_url = "ldap://127.0.0.1";
 $ldap_starttls = false;
-$ldap_binddn = "cn=manager,dc=example,dc=com";
-$ldap_bindpw = 'secret';
-$ldap_base = "dc=example,dc=com";
+$ldap_binddn = "uid=ssp,ou=admins,dc=domena,dc=tld";
+$ldap_bindpw = '_haslo_specjalnego_administratora__';
+$ldap_base = "dc=domena,dc=tld";
 $ldap_login_attribute = "uid";
-$ldap_fullname_attribute = "cn";
-$ldap_filter = "(&(objectClass=person)($ldap_login_attribute={login}))";
+$ldap_fullname_attribute = "displayName";
+$ldap_filter = "(&(|(objectClass=simpleSecurityObject)(objectClass=person))($ldap_login_attribute={login}))";
 $ldap_use_exop_passwd = false;
 $ldap_use_ppolicy_control = false;

@@ -82,7 +82,7 @@ $shadow_options['shadow_expire_days'] = -1;
 # clear (the default)
 # auto (will check the hash of current password)
 # This option is not used with ad_mode = true
-$hash = "clear";
+$hash = "SSHA";

 # Prefix to use for salt with CRYPT
 $hash_options['crypt_salt_prefix'] = "$6$";
@@ -104,15 +104,15 @@ $client_ip_header = 'REMOTE_ADDR';
 # Local password policy
 # This is applied before directory password policy
 # Minimal length
-$pwd_min_length = 0;
+$pwd_min_length = 8;
 # Maximal length
-$pwd_max_length = 0;
+$pwd_max_length = 63;
 # Minimal lower characters
-$pwd_min_lower = 0;
+$pwd_min_lower = 1;
 # Minimal upper characters
-$pwd_min_upper = 0;
+$pwd_min_upper = 1;
 # Minimal digit characters
-$pwd_min_digit = 0;
+$pwd_min_digit = 1;
 # Minimal special characters
 $pwd_min_special = 0;
 # Definition of special characters
@@ -180,7 +180,7 @@ $notify_on_sshkey_change = false;

 ## Questions/answers
 # Use questions/answers?
-$use_questions = true;
+$use_questions = false;
 # Allow to register more than one answer?
 $multiple_answers = false;
 # Store many answers in a single string attribute
@@ -210,7 +210,7 @@ $questions_use_default = true;
 $questions_count = 1;

 # Should the user be able to select registered question(s) by entering only the login?
-$question_populate_enable = false;
+$question_populate_enable = true;

 ## Token
 # Use tokens?
@@ -232,17 +232,17 @@ $mail_attribute = "mail";
 # default = false
 $mail_address_use_ldap = false;
 # Who the email should come from
-$mail_from = "admin@example.com";
-$mail_from_name = "Self Service Password";
+$mail_from = "haslo@domena.tld";
+$mail_from_name = "Samodzielna Zmiana Hasla";
 $mail_signature = "";
 # Notify users anytime their password is changed
 $notify_on_change = false;
 # PHPMailer configuration (see https://github.com/PHPMailer/PHPMailer)
-$mail_sendmailpath = '/usr/sbin/sendmail';
+$mail_sendmailpath = '/usr/local/sbin/sendmail';
 $mail_protocol = 'smtp';
 $mail_smtp_debug = 0;
 $mail_debug_format = 'error_log';
-$mail_smtp_host = 'localhost';
+$mail_smtp_host = 'localhost.domena.tld';
 $mail_smtp_auth = false;
 $mail_smtp_user = '';
 $mail_smtp_pass = '';
@@ -259,7 +259,7 @@ $mail_priority = 3;

 ## SMS
 # Use sms
-$use_sms = true;
+$use_sms = false;
 # SMS method (mail, api)
 $sms_method = "mail";
 $sms_api_lib = "lib/smsapi.inc.php";
@@ -286,16 +286,16 @@ $max_attempts = 3;
 # Encryption, decryption keyphrase, required if $use_tokens = true and $crypt_tokens = true, or $use_sms, or $crypt_answer
 # Please change it to anything long, random and complicated, you do not have to remember it
 # Changing it will also invalidate all previous tokens and SMS codes
-$keyphrase = "secret";
+$keyphrase = "__losowe_haslo_z_apgd__";

 # Reset URL (if behind a reverse proxy)
-#$reset_url = $_SERVER['HTTP_X_FORWARDED_PROTO'] . "://" . $_SERVER['HTTP_X_FORWARDED_HOST'] . $_SERVER['SCRIPT_NAME'];
+# $reset_url = $_SERVER['HTTP_X_FORWARDED_PROTO'] . "://" . $_SERVER['HTTP_X_FORWARDED_HOST'] . $_SERVER['SCRIPT_NAME'];

 # Display help messages
 $show_help = true;

 # Default language
-$lang = "en";
+$lang = "pl";

 # List of authorized languages. If empty, all language are allowed.
 # If not empty and the user's browser language setting is not in that list, language from $lang will be used.
@@ -315,7 +315,7 @@ $display_footer = true;

 # Where to log password resets - Make sure apache has write permission
 # By default, they are logged in Apache log
-#$reset_request_log = "/var/log/self-service-password";
+$reset_request_log = "/var/cache/www/ssp/self-service-password";

 # Invalid characters in login
 # Set at least "*()&|" to prevent LDAP injection
@@ -375,8 +375,8 @@ $use_restapi = false;
 #$header_name_extra_config="SSP-Extra-Config";

 # Cache directory
-#$smarty_compile_dir = "/var/cache/self-service-password/templates_c";
-#$smarty_cache_dir = "/var/cache/self-service-password/cache";
+$smarty_compile_dir = "/var/cache/www/ssp/templates_c";
+$smarty_cache_dir = "/var/cache/www/ssp/cache";

 # Allow to override current settings with local configuration
 if (file_exists (__DIR__ . '/config.inc.local.php')) {

config.inc.local.php

<?php
if (!defined("SMARTY")) {
    define("SMARTY", "/usr/local/share/smarty3-php74/Smarty.class.php");
}

?>

Katalog dla plików smarty

# aby nie tworzy/c dodatkowej partycji
mkdir -p /var/cache/www/ssp

# ew. dedykowana partycja zfs
zfs create sys/data/v/cache/www

# ustawienie uprawnie/n
chown www:www /var/cache/www/ssp
chmod 1777 /var/cache/www/ssp

Plik z logiem

O ile będzie wykorzystywane ustawienie domyślne:

touch /var/log/self-service-password
chown www:www /var/log/self-service-password


{i}  (c) 2004 - 2026 BSD Serwis Krzysztof Stryjek. W przypadku błędów, poprawek proszę kontaktować się z administratorem wiki.

SelfServicePassword (ostatnio edytowane 2021-05-04 21:03:58 przez wtps0n)