Self Service Password 密碼策略

来源:https://www.cnblogs.com/jackcui/archive/2019/10/09/11640783.html
-Advertisement-
Play Games

1.在活動目錄中新建一個用戶,並賦予域管理員許可權;2.拷貝conf目錄下的config.inc.php為config.inc.local.php;3.按自己的實際情況及要求修改config.inc.local.php文件中的相關參數,說明如下: ...


1.在活動目錄中新建一個用戶,並賦予域管理員許可權;
2.拷貝conf目錄下的config.inc.php為config.inc.local.php;
3.按自己的實際情況及要求修改config.inc.local.php文件中的相關參數,說明如下:

<?php
#==============================================================================
# LTB Self Service Password
#
# Copyright (C) 2009 Clement OUDOT
# Copyright (C) 2009 LTB-project.org
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# GPL License: http://www.gnu.org/licenses/gpl.txt
#
#==============================================================================
#==============================================================================
# All the default values are kept here, you should not modify it but use
# config.inc.local.php file instead to override the settings from here.
#==============================================================================
#==============================================================================
# Configuration
#==============================================================================
# Debug mode
# true: log and display any errors or warnings (use this in configuration/testing)
# false: log only errors and do not display them (use this in production)
$debug = false; //調試模式
# LDAP
$ldap_url = "LDAPS://dc.xxxx.cn";  //LDAP伺服器地址
$ldap_starttls = false;  ////LDAP伺服器是否支持TLS
$ldap_binddn = "CN=xxx,CN=Users,DC=xxxx,DC=cn";  //連接LDAP伺服器的賬戶DN
$ldap_bindpw = "xxxxxx";  //連接LDAP伺服器的賬戶DN的密碼
$ldap_base = "OU=1-XXXX,DC=xxxx,DC=cn";  //檢索OU的路徑
$ldap_login_attribute = "sAMAccountName";  //LDAP用戶名欄位
$ldap_fullname_attribute = "cn";  //LDAP用戶全名欄位
$ldap_filter = "(&(objectClass=user)(sAMAccountName={login})(sAMAccountType=805306368)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))";  //過濾LDAP用戶規則
# Active Directory mode
# true: use unicodePwd as password field
# false: LDAPv3 standard behavior
$ad_mode = true;  //是否啟用Active Directory模式
# Force account unlock when password is changed
$ad_options['force_unlock'] = true; //強制解鎖:當密碼更改將解鎖鎖定帳戶
# Force user change password at next login
$ad_options['force_pwd_change'] = false;  //強制用戶在下次登錄時更改密碼
# Allow user with expired password to change password
$ad_options['change_expired_password'] = true;  //允許用戶更改密碼,如果密碼過期
# Samba mode
# true: update sambaNTpassword and sambaPwdLastSet attributes too
# false: just update the password
$samba_mode = false;  //是否啟用Samba模式
# Set password min/max age in Samba attributes
#$samba_options['min_age'] = 5;
#$samba_options['max_age'] = 45;
# Shadow options - require shadowAccount objectClass
# Update shadowLastChange
$shadow_options['update_shadowLastChange'] = false;
$shadow_options['update_shadowExpire'] = false;
# Default to -1, never expire
$shadow_options['shadow_expire_days'] = -1;
# Hash mechanism for password:
# SSHA, SSHA256, SSHA384, SSHA512
# SHA, SHA256, SHA384, SHA512
# SMD5
# MD5
# CRYPT
# clear (the default)
# auto (will check the hash of current password)
# This option is not used with ad_mode = true
$hash = "clear";  //啟用密碼加密演算法,此選項在Active Directory模式下被忽略。 
# Prefix to use for salt with CRYPT
$hash_options['crypt_salt_prefix'] = "$6$";
$hash_options['crypt_salt_length'] = "6";
# Local password policy
# This is applied before directory password policy
# Minimal length
$pwd_min_length = 6;  //定義最短密碼位數
# Maximal length
$pwd_max_length = 14;  //定義最長密碼位數
# Minimal lower characters
$pwd_min_lower = 0;  //定義密碼應包含多少位小寫字母
# Minimal upper characters
$pwd_min_upper = 0;  //定義密碼應包含多少位大寫字母
# Minimal digit characters
$pwd_min_digit = 0;  //定義密碼應包含多少位數字
# Minimal special characters
$pwd_min_special = 0;  //定義密碼應包含多少位特殊字元
# Definition of special characters
$pwd_special_chars = "^a-zA-Z0-9";  //定義密碼正則表達式
# Forbidden characters
#$pwd_forbidden_chars = "@%";  //定義密碼禁止的特殊字元
# Don't reuse the same password as currently
$pwd_no_reuse = true;  //是否禁止使用重覆密碼
# Check that password is different than login
$pwd_diff_login = true;  //檢查密碼是否與登錄密碼不同
# Complexity: number of different class of character required
$pwd_complexity = 3;  //定義密碼應包含多少種組合
# use pwnedpasswords api v2 to securely check if the password has been on a leak
$use_pwnedpasswords = false;  //檢查密碼是否已在https://haveibeenpwned.com資料庫中泄露
# Show policy constraints message:
# always
# never
# onerror
$pwd_show_policy = "always";  //是否顯示密碼更改策略
# Position of password policy constraints message:
# above - the form
# below - the form
$pwd_show_policy_pos = "above";  //定義密碼更改策略顯示位置
# Who changes the password?
# Also applicable for question/answer save
# user: the user itself
# manager: the above binddn
$who_change_password = "manager";  //定義使用什麼賬戶來修改密碼,如選用manager請確保binddn用戶有修改用戶密碼的許可權(建議域管理員身份)
## Standard change
# Use standard change form?
$use_change = true;  //啟用密碼更改功能
## SSH Key Change
# Allow changing of sshPublicKey?
$change_sshkey = false;
# What attribute should be changed by the changesshkey action?
$change_sshkey_attribute = "sshPublicKey";
# Who changes the sshPublicKey attribute?
# Also applicable for question/answer save
# user: the user itself
# manager: the above binddn
$who_change_sshkey = "user";
# Notify users anytime their sshPublicKey is changed
## Requires mail configuration below
$notify_on_sshkey_change = false;
## Questions/answers
# Use questions/answers?
# true (default)
# false
$use_questions = true;  //啟用問題答案修改密碼功能
# Answer attribute should be hidden to users!
$answer_objectClass = "user";  //如果$answer_attribute屬性不是在標準用戶對象類,配置對象類與此屬性的使用方法,在Active Directory中,extensibleObject的是不知道。您可以使用user,
$answer_attribute = "info";  //LDAP用戶存儲問題密碼欄位,屬性名稱必須是小寫
# Crypt answers inside the directory
$crypt_answers = false;  //是否加密問題答案
# Extra questions (built-in questions are in lang/$lang.inc.php)
#$messages['questions']['ice'] = "What is your favorite ice cream flavor?";
$messages['questions']['Q3'] = "你少年時代最好的朋友叫什麼名字?";  //額外的問題
$messages['questions']['Q4'] = "你的第一個寵物叫什麼名字?";
$messages['questions']['Q5'] = "你第一次坐飛機是去哪裡?";
$messages['questions']['Q6'] = "你的理想工作是什麼?";
$messages['questions']['Q7'] = "你擁有的第一輛車是什麼型號?";
$messages['questions']['Q8'] = "你童年時代的綽號是什麼?";
$messages['questions']['Q9'] = "你的第一個上司叫什麼名字?";
$messages['questions']['Q10'] = "您最喜歡哪個球隊?";
## Token
# Use tokens?
# true (default)
# false
$use_tokens = true;  //啟用郵件修改密碼功能
# Crypt tokens?
# true (default)
# false
$crypt_tokens = true;  //是否保持會話標識符,就是令牌生命周期
# Token lifetime in seconds
$token_lifetime = "3600";  //保持會話標識符時長(秒)
## Mail
# LDAP mail attribute
$mail_attribute = "wWWHomePage";  //LDAP用戶存儲郵箱地址欄位
# Get mail address directly from LDAP (only first mail entry)
# and hide mail input field
# default = false
$mail_address_use_ldap = false;  //是否直接從LDAP獲取郵件地址並隱藏郵件輸入欄位
# Who the email should come from
$mail_from = "[email protected]";  //定義郵件發件人地址
$mail_from_name = "Service";  //定義郵件發件人名稱
$mail_signature = "";  //定義郵件發件人簽名
# Notify users anytime their password is changed
$notify_on_change = true;  //定義更改密碼時是否通知用戶
# PHPMailer configuration (see https://github.com/PHPMailer/PHPMailer)    //設置PHPMailer的所有參數
$mail_sendmailpath = '/usr/sbin/sendmail';
$mail_protocol = 'smtp';
$mail_smtp_debug = 0;
$mail_debug_format = 'html';
$mail_smtp_host = 'mail.xxxx.cn';
$mail_smtp_auth = true;
$mail_smtp_user = '[email protected]';
$mail_smtp_pass = 'xxxxxx';
$mail_smtp_port = 587;
$mail_smtp_timeout = 30;
$mail_smtp_keepalive = false;
$mail_smtp_secure = 'tls';
$mail_smtp_autotls = true;
$mail_contenttype = 'text/plain';
$mail_wordwrap = 0;
$mail_charset = 'utf-8';
$mail_priority = 3;
$mail_newline = PHP_EOL;
## SMS
# Use sms
$use_sms = true;  //啟用簡訊修改密碼功能
# SMS method (mail, api)
$sms_method = "api";  //定義使用哪種方法發送簡訊
$sms_api_lib = "lib/smsapi.inc.php";  //API腳本配置
# GSM number attribute
$sms_attribute = "mobile";  //LDAP用戶存儲手機號碼欄位
# Partially hide number
$sms_partially_hide_number = true;  //頁面是否部分隱藏號碼
# Send SMS mail to address
$smsmailto = "{sms_attribute}@service.provider.com";  //定義使用mail方法發送簡訊時發送簡訊到的郵件地址
# Subject when sending email to SMTP to SMS provider
$smsmail_subject = "Provider code";  //定義向SMTP提供商發送電子郵件時的主題
# Message
$sms_message = "{smsresetmessage} {smstoken}";  //定義消息模板
# Remove non digit characters from GSM number
$sms_sanitize_number = false;  //從手機號碼中刪除非數字字元
# Truncate GSM number
$sms_truncate_number = false;  //是否截斷手機號碼
$sms_truncate_number_length = 10;
# SMS token length
$sms_token_length = 6;  //簡訊驗證碼長度
# Max attempts allowed for SMS token
$max_attempts = 3;  //單個簡訊驗證碼重試次數
# Encryption, decryption keyphrase, required if $crypt_tokens = true
# 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 = "xxxxxx";  //密鑰短語,如果$crypt_tokens = true則需要更改為任何內容,不必記住它,更改它也會使所有以前的令牌和簡訊代碼無效。
# Reset URL (if behind a reverse proxy)
#$reset_url = $_SERVER['HTTP_X_FORWARDED_PROTO'] . "://" . $_SERVER['HTTP_X_FORWARDED_HOST'] . $_SERVER['SCRIPT_NAME'];  //預設情況下,重置密碼URL使用伺服器名稱和埠計算的,但如果應用背後是一個反向代理,這些值可能是錯誤的。在這種情況下,你可以自己設置網址
# Display help messages
$show_help = true;  //是否顯示幫助信息
# Default language
$lang = "zh-CN";  //預設顯示語言
# 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.
$allowed_lang = array();  //定義授權語言列表。 如果為空,則允許使用所有語言。
# Display menu on top
$show_menu = true;  //是否顯示導航欄
# Logo
$logo = "images/logo.png";  //LOGO地址
# Background image
$background_image = "images/unsplash-lanse.jpg";  //背景圖調用
# Where to log password resets - Make sure apache has write permission
# By default, they are logged in Apache log
$reset_request_log = "logs/self.log";  //定義日誌存放路徑,預設生成的URL記錄在Apache日誌中。
# Invalid characters in login
# Set at least "*()&|" to prevent LDAP injection
# If empty, only alphanumeric characters are accepted
$login_forbidden_chars = "*()&|";  //登錄保護,以避免LDAP註射。某些字元是被禁止的
## CAPTCHA  //以下為谷歌CAPTCHA驗證碼調用配置
# Use Google reCAPTCHA (http://www.google.com/recaptcha)
$use_recaptcha = false;
# Go on the site to get public and private key
$recaptcha_publickey = "";
$recaptcha_privatekey = "";
# Customization (see https://developers.google.com/recaptcha/docs/display)
$recaptcha_theme = "light";
$recaptcha_type = "image";
$recaptcha_size = "normal";
# reCAPTCHA request method, null for default, Fully Qualified Class Name to override
# Useful when allow_url_fopen=0 ex. $recaptcha_request_method = '\ReCaptcha\RequestMethod\CurlPost';
$recaptcha_request_method = null;
## Default action
# change
# sendtoken
# sendsms
$default_action = "change";  //配置預設頁面
## Extra messages  //編輯消息模板
# They can also be defined in lang/ files
#$messages['passwordchangedextramessage'] = NULL;
$messages['changehelpextramessage'] = ">>帳戶被鎖定請使用導航欄中的其他方式解鎖賬戶並重置密碼。<br />回答問題重置密碼:請確認您已自行設置答案。<br />通過郵件發送鏈接:請確認您已聯繫管理員設置郵箱。<br />通過簡訊重置密碼:請確認您已聯繫管理員設置手機號碼。";
# Launch a posthook script after successful password change
#$posthook = "/usr/share/self-service-password/posthook.sh";  //密碼更改成功後啟動posthook腳本
#$display_posthook_error = true;
# Hide some messages to not disclose sensitive information
# These messages will be replaced by badcredentials error
$obscure_failure_messages = array("mailnomatch");  //讓一些錯誤不顯示

  


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 在linux系統命令行界面預設目錄顏色是藍色,在黑色底色上無法看清 原來效果圖: 最終效果圖: 大致步驟:1.複製配置文件到個人用戶的根目錄下2.修改配置文件中字體顏色的設置3.重新啟動視窗,輸入ls查看輸出的顏色是否OK 具體步驟: 1.將/etc/DIR_COLORS文件cp到~/下,並改名為. ...
  • httpd:是一個提供網站服務的程式 監聽埠:80 環境準備: Linux CentOS7.3系統 使用一臺服務端,一臺客戶端即可; 一、安裝httpd 1:安裝 [root@localhost ~]# systemctl stop firewalld [root@localhost ~]# se ...
  • 本人環境:虛擬機CentOS71804、虛擬機軟體VMwareWorkstation14Pro、所要添加的共用文件夾在物理機NTFS格式磁碟分區上。 本文僅對上述環境情況有效,其它情況僅供參考。 出現這個問題的原因是VMwareTools安裝不完全——之所以說不完全,是因為安裝CentOS時,預設安 ...
  • server { listen 80; server_name www.xxxx.com; if ($host = "www.xxxx.com"){ return 301 https://www.xxxx.com$request_uri; } } ...
  • vsftpd文件傳輸協議 系統環境:CentOS Linux release 7.6.1810 (Core) 一、簡介 FTP(文件傳輸協議)全稱是:Very Secure FTP Server。 Vsftpd是linux類操作系統上運行的ftp伺服器軟體。 vsftp提供三種登陸方式:1.匿名登錄 ...
  • 第一步:輸入網址: https://www.oracle.com/technetwork/java/javase/downloads/index.html 第二步:進入網址翻到最後一頁: 第三步:選擇下載大版本 第四步:選擇下載小版本 第五步:選擇下載小版本 1、下載jdk到任意位置,並通過tar ...
  • Linux系統 CentOS7 一、檢查網卡配置 vim /etc/sysconfig/network-scripts/ifcfg-ens32 確定是否開啟網卡 ONBOOT=yes 添加HWADDR=00:0c:29:36:e6:78(網卡mac地址) 二、檢查虛擬機網卡是否正確:(如圖) 檢查是 ...
  • 在cmd視窗輸入for /?後的原文,被我自己“翻譯”了一下,更像人話了。 推薦去https://www.cnblogs.com/cbugs/p/8992059.html這篇部落格裡去看看,講的更好。 在cmd視窗輸入for /?後 原文“翻譯” 對一組文件中的每一個文件執行某個特定命令。 基本格式 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...