mantis的用户认证函数Authentication中相关有

$g_login_method
  • MD5
  • LDAP
  • PLAIN
  • CRYPT
  • CRYPT_FULL_SALT
  • BASIC_AUTH
  • Some systems (mostly non-unix) do not have crypt support in PHP. MD5 will accomplish almost the same thing. PLAIN is plain text and there is no attempt to secure the password in the database. You will not be able to easily convert between encryption methods so this needs to be chosen at install time. CRYPT was the default until 0.17.0; MD5 is now the default. Try CRYPT_FULL_SALT if CRYPT is not working.
$g_ldap_server The ldap server (eg: ldaps://ldap.example.com
$g_ldap_port LDAP port (default 636).
$g_ldap_root_dn “dc=example, dc=com”
$g_ldap_organisation “organizationname=*Example)”
$g_use_ldap_email Use email address in LDAP rather than the email stored in the database.
$g_ldap_bind_dn “cn=Manager, dc=example, dc=com”
$g_ldap_bind_passwd  

由于需要涉及到几个程序的统一认证,所以需要mantis到windows的AD进行认证,竟然发现互联网上又没有相关文档,高手们太坏了。诶诶,害的我再次自力更生艰苦奋斗。
相关配置方法:
首先介绍微软的一款Support Tools,ldp.exe,用来查看AD的详细信息。 
给出一个界面

在mantis的config_inc.php中配置以下信息, 
$g_login_method=LDAP; //设置认证方法为LDAP 
$g_ldap_server=’ldap://boofee.local’; //LDAP的访问路径 
$g_ldap_port = ’389′; //端口,微软的AD是389 
$g_ldap_organization = ”; 
$g_ldap_uid_field = ‘CN’; //这句最重要,其他文档配置未成功就是这里出了错 
$g_ldap_root_dn = ‘CN=Users,DC=boofee,DC=local’; //在AD中建立的相关用户在哪个组里面就将此配置到哪里,具体怎么写就是靠ldp.exe进行查询。 
$g_ldap_bind_dn=”CN=user,CN=Users,DC=boofee,DC=local”; //连接AD的用户名,user权限就可以了。 
$g_ldap_bind_passwd=”user”; //连接AD的密码
配置完成后基于AD的LDAP认证成功。
成功之后还是需要在mantis中建立用户名,在AD的相关组中也要有同样的用户名,认证的时候密码使用的是AD内存贮的密码。

转载自:http://www.boofee.net/flyingbamboo/archives/242

Mantis tweaks: logging in via Microsoft Active Directory LDAP

This is a short article on how to get the above Mantis version to work with Microsoft Windows Active Directory LDAP.
Used Mantis version: 1.1.1 and PHP Version 5

Mantis currently supports only login via LDAP directory by the following scheme:

Connect to LDAP server
Bind with anonymous DNS or with a user specified DN (but in a config file permanently)
If the bind succeeds then do an ldap_search
If the search succeeds then login is successful.
When using Microsoft AD LDAP the situation is a bit different, we want to:

Connect to LDAP server
Create a DN basing on the config file and username field that the user entered in the login form
Try Bind with the above DN and password that the user entered in the login form
If the bind succeeds then the login is successful (we don’t need to run the search)
To achieve that, there are some minor changes to do in the Mantis core API.

Step 1
Log in to a fresh mantis installation, and create a user with admin privileges with a username matching your LDAP username (in this example xy2093)

Step 2
First, add to your config_inc.php configuration file the following options:

/* we want to use LDAP auth */

$g_login_method = LDAP;
$g_ldap_server = 'ldap://ldap.myhost.com/';

/* the root DN that will be used to form the bind DN during authentication phase */
$g_ldap_root_dn = 'ou=staff,ou=company,dc=domain,dc=com';

/* we don't want the users to be able to sign-up via mantis */
$g_allow_signup=OFF;

/* we want to use Mantis email field instead of LDAP one */
$g_use_ldap_email = OFF;

/* we don't want false mantis lost password feature */
$g_lost_password_feature = OFF;
Step 3:
Next, you have to modify the core LDAP authentication ldap_authenticate function. Go to core/ldap_api.php, find the above function and replace it with:

function ldap_authenticate( $p_user_id, $p_password ){
if (is_blank($p_password))
return false;
$t_ldap_host = config_get('ldap_server');
$t_ldap_port = config_get('ldap_port');
$t_ldap_rdn = config_get('ldap_root_dn');
$t_ds = ldap_connect($t_ldap_host, $t_ldap_port) or die('Unable to connect to LDAP server<br />');
$t_user = user_get_field($p_user_id, 'realname'); //This checks the users Real Name instead of username
$t_uname = user_get_field($p_user_id, 'username');
$binddn = "CN=$t_user ($t_uname),$t_ldap_rdn";
$t_authenticated = false;
if(@ldap_bind($t_ds,$binddn,$p_password))
$t_authenticated = true;

return $t_authenticated;
}
In the function notice the $bind_dn variable. This is the variable being used to prepare the bind DN for LDAP connection. Feel free to modify it to suit your authentication scheme, however you should not have to. It defaults to:

CN=Firstname Lastname (username),ou=staff,ou=company,dc=domain,dc=com

i.e.

CN=John Doe (xy2093),ou=staff,ou=company,dc=domain,dc=com.

You won’t believe it but that’s it! Now you can try to log in to Mantis with your LDAP password and it should work like a charm.

The next issue to solve here is that you have to have the users from LDAP in your $mantis_user_table, for instance to manage Mantis privileges. There are many ways to achieve that, you can import them every night. Or you can use Mantis SOAP API to check if the user exists in LDAP when they try to log in as I did. But how to do that is another article ;)

转载自:http://www.warden.pl/2008/07/08/mantis-tweaks-getting-it-to-work-with-microsoft-ad-ldap/

 
 

Active directory settings

Active directory settings

Introduction

The page aims at describing how to configure mantis to connect to Active Directory.

General principles

Active Directory can currently be used by mantis for the following usage:

Check user password.
Retrieve user mail address (optional).
Users must be created manually in mantis using the same login as in Active Directory.

The way it proceeds is the following:

Connect to Active Directory using LDAP protocol to search user by its login - A generic account is used for that purpose.
If an entry was found, bind to Active Directory using dn entry found and the password provided by user. If several entries are found, each of them is tried until one successes.
If the connection is a success, and if the option is activated, the user mail address is retrieved from Active Directory.
General LDAP configuration

The following parameters must be set in the config_inc.php file:

$g_login_method = LDAP;
$g_ldap_server = ‘ldap://yourservername’; # or $g_ldap_server = ‘ldaps://yourservername’;
$g_ldap_port = 389; # Default is 389
$g_ldap_root_dn = “OU=your_organization_RDN,DC=your_organization_RDN,DC=your_organization_RDN”; # The root DN where to search users e.g. ‘ou=people,dc=example,dc=com’
$g_ldap_bind_dn = ‘full_DN_entry_for_generic_user’; # A system account to login to LDAP e.g. ‘cn=Robert Smith,ou=people,dc=example,dc=com’
$g_ldap_bind_passwd = ‘**’; # System account password
$g_ldap_organization = ‘‘; # This is additional filter that may be added to search query - you should first leave it empty and may add a filter later for optimization. e.g. ‘(objectClass=person)’
If you want to use user e-mail address defined in Active Directory instead of the one defined when creating mantis account you must add the following parameter:

$g_use_ldap_email = ON;
Specific Active Directory configuration

You must add the following parameters in the config_inc.php file:

$g_ldap_protocol_version = 3;
$g_ldap_uid_field= ‘sAMAccountName’; # Use ‘sAMAccountName’ for Active Directory - this is the name of the attribute used to search a user
Additionally, make sure not to use the root of your domain for $g_ldap_root_dn parameter. If you bind to the root of your domain, i.e. just dc=company,dc=com, then Active Directory, in addition to the search results you expected, will also return referrals to the other directory partitions which would confuse current implementation and cause an error.

http://www.mantisbt.org/wiki/doku.php/mantisbt:active_directory

Mantis集成 LDAP 认证的更多相关文章

  1. LDAP落地实战(四):Jenkins集成OpenLDAP认证

    前几篇分文章分别介绍了OpenLDAP的部署管理和维护以及svn.git的接入,今天我们再下一城接入jenkins. 前情提要:LDAP系列文章 LDAP落地实战(一):OpenLDAP部署及管理维护 ...

  2. LDAP落地实战(三):GitLab集成OpenLDAP认证

    上一篇文章介绍了svn集成OpenLDAP认证,版本控制除了svn外,git目前也被越来越多的开发者所喜爱,本文将介绍GitLab如何集成openldap实现账号认证 GitLab集成OpenLDAP ...

  3. Django集成OpenLDAP认证

    本文详细介绍了django-auth-ldap的使用方法,参数含义,并提供了示例代码 版本说明 Django==2.2 django-auth-ldap==1.7.0 集成过程 Django集成LDA ...

  4. 本地docker搭建gitlab, 并配置ldap认证

    基于Docker在Mac OS X系统中的部署和设置GitLab的具体过程如下:   1. 安装Docker for Mac (参见https://docs.docker.com/docker-for ...

  5. LDAP落地实战(二):SVN集成OpenLDAP认证

    上一篇文章我们介绍了LDAP的部署以及管理维护,那么如何接入LDAP实现账号统一认证呢?这篇文章将带你完成svn的接入验证 subversion集成OpenLDAP认证 系统环境:debian8.4 ...

  6. No.2 CAS之SPNEGO+LDAP认证配置

    1.概述 本文先配置了SPNEGO认证,就是如果用户操作系统如果登陆了公司的Windows域,用户浏览器访问应用服务即可免登录. 然后如果不在域里的员工,用LDAP认证方式,输账号密码登陆. 参考文档 ...

  7. ldap配置系列二:jenkins集成ldap

    ldap配置系列二:jenkins集成ldap jenkins简介 jenkins是一个独立的.开放源码的自动化服务器,它可以用于自动化与构建.测试.交付或部署软件相关的各种任务. jenkins官方 ...

  8. Jenkins-配置LDAP认证

    Jenkins-配置LDAP认证 参考文档: LDAP添加用户详见我的博文  Linux分类 中的< LDAP2-创建OU和用户>博文. 1.LDAP配置 1.准备一个adminDN账号用 ...

  9. hive、impala集成ldap

    1.概要 1.1 环境信息 hadoop:cdh5.10 os:centos6.7 user:root hive.impala已集成sentry 1.2 访问控制权限 这里通过使用openldap来控 ...

随机推荐

  1. Kafka(四)Kafka在zookeeper中的存储

    一 Kafka在zookeeper中存储结构图 二 分析 2.1 topic注册信息 /brokers/topics/[topic] : 存储某个topic的partitions所有分配信息 [zk: ...

  2. js回到顶部 动画速度 (自己记录)

    x=x-20; 设置回到每10s的速度, function gotoTop(){ var x=document.body.scrollTop||document.documentElement.scr ...

  3. python3与mysql交互:pymysql

    python3与mysql交互 1.安装pymysql模块 pip3 install pymysql3 2.pymysql的简单使用: # /usr/bin/env python3 import py ...

  4. iOS开发之app打包发布流程

    一.准备工作 苹果开发者中心 1.申请苹果开发者账号 首先需要申请苹果开发者账号才能在APP store 里发布应用. 开发者账号分类:(1)个人开发者账号 (2)企业开发者账号 主要的区别是:点击这 ...

  5. MongoDB入门教程一[文档与集合]

    MongoDB 是面向集合存储的文档型数据库,其涉及到的基本概念与关系型数据库相比有所不同.举个例子,在关系型数据库中,我们记录一个订单的信息,通常是这样设计表结构的: 设计一个订单基本信息表和一个订 ...

  6. js javascript 实现多线程

    在讲之前,大家都知道js是基于单线程的,而这个线程就是浏览器的js引擎. 首先来看一下大家用的浏览器都具有那些线程吧. 假如我们要执行一些耗时的操作,比如加载一张很大的图片,我们可能需要一个进度条来让 ...

  7. 基于Apollo实现.NET Core微服务统一配置(测试环境-单机)

    一.前言 注:此篇只是为测试环境下的快速入门.后续会给大家带来生产环境下得实战开发. 具体的大家可以去看官方推荐.非常的简单明了.以下介绍引用官方内容: Apollo(阿波罗)是携程框架部门研发的分布 ...

  8. JPG图片EXIF信息提取工具exif

    JPG图片EXIF信息提取工具exif   有相机生成的JPG图片(如照片)都包含有EXIF信息.这些信息包括拍照所使用的设备.地理位置.拍摄时间等敏感信息.Kali Linux内置了EXIF信息提取 ...

  9. Highmaps网页图表教程之Highmaps第一个实例与图表构成

    Highmaps网页图表教程之Highmaps第一个实例与图表构成 Highmaps第一个实例 下面我们来实现本教程的第一个Highmaps实例. [实例1-1:hellomap]下面来制作一个中国地 ...

  10. cloudstack模板

    玩cloudstack的人都应该玩过模板这个功能,这里还是比较有意思的,我们底层连接vcenter 创建vm采用模板 实际这里的磁盘方案,并不是给系统重新分配的磁盘大小而是又新挂上了一块磁盘,新磁盘的 ...