搭建ldap自助修改密码系统--Self Service Password

系统版本:centos6 

Self Service Password版本:1.1

服务安装:

      安装依赖:yum install php70-ldap.x86_64 -y (版本尽量大于5.3,否则会提示更新php程序)
                     yum install httpd -y
      安装Self Service Password:yum install https://ltb-project.org/rpm/6Server/noarch/self-service-password-1.1-1.el6.noarch.rpm

配置apache: /etc/httpd/conf.d/self-service-password.conf

NameVirtualHost *:80
<VirtualHost *:80>
       ServerName changepasswd.xxxxx.net
       DocumentRoot /usr/share/self-service-password
       DirectoryIndex index.php
       AddDefaultCharset UTF-8
      <Directory "/usr/share/self-service-password">
            AllowOverride None
            Require all granted
      </Directory>
      LogLevel warn   
      ErrorLog /var/log/httpd/ssp_error_log
      CustomLog /var/log/httpd/ssp_access_log combined
</VirtualHost>

 

配置Self Service Password,支持密码修改和邮件重置: vim  /usr/share/self-service-password/conf/config.inc.php

       #关闭 问题验证 和 短信验证(视个人需要):

            $use_questions=false;
            $use_sms= false;

      #配置 LDAP
    $ldap_url = "ldap://ldap.xxxxx.net";
    $ldap_starttls = false;
    $ldap_binddn = "cn=Manager,dc=ldap,dc=xxxxxx,dc=net";   
    $ldap_bindpw = "xxxxxxxxx";
    $ldap_base = "dc=ldap,dc=xxxxxx,dc=net";
    $ldap_login_attribute = "cn";
    $ldap_fullname_attribute = "cn";
    $ldap_filter = "(&(objectClass=person)($ldap_login_attribute={login}))";
            $who_change_password = "manager";   #指定LDAP 以什么用户身份更改密码

      #配置邮件
    $mail_from = "elk@xxxxx.com";
    $mail_from_name = "企业账号密码重置";
    $mail_signature = "";
            $notify_on_change = true;      #密码修改成功后,向用户发送通知邮件
    $mail_sendmailpath = '/usr/sbin/sendmail';   #需安装sendmail服务 yum install -y sendmail
    $mail_protocol = 'smtp';
    $mail_smtp_debug = 0;
    $mail_debug_format = 'html';
    $mail_smtp_host = 'smtp.gmail.com';
    $mail_smtp_auth = true;
    $mail_smtp_user = 'elk@xxxxxx.com';
    $mail_smtp_pass = 'xxxxxx';
    $mail_smtp_port = 587;
    $mail_smtp_timeout = 30;
    $mail_smtp_keepalive = false;
    $mail_smtp_secure = 'tls';
    $mail_contenttype = 'text/plain';
    $mail_wordwrap = 0;
    $mail_charset = 'utf-8';
    $mail_priority = 3;
    $mail_newline = PHP_EOL;

配置完成,登录网页访问,通过网页修改账号密码验证

如果遇到以下错误:

修改配置: $keyphrase = "secret";   --->  $keyphrase = "ldapchangepasswd"; #任意字符串

验证邮件重置密码:

查看邮件,点击链接修改即可:

修改完成会收到一条邮件:

以上便是ldap自主修改密码服务--Self Service Password 的配置。

参考链接:http://blog.leanote.com/post/benmo/e98d072f2b28

posted @ 2018-07-31 16:50  imcati  阅读(13103)  评论(0编辑  收藏  举报