https://github.com/shanghai-edu/ldap-test-tool/releases/
配置文件
默认配置文件为目录下的 cfg.json,也可以使用 -c 或 --config 来加载自定义的配置文件。
openldap 配置示例
{
“ldap”: {
“addr”: “ldap.example.org:389”,
“baseDn”: “dc=example,dc=org”,
“bindDn”: “cn=manager,dc=example,dc=org”,
“bindPass”: “password”,
“authFilter”: “(&(uid=%s))”,
“attributes”: [“uid”, “cn”, “mail”],
“tls”: false,
“startTLS”: false
},
“http”: {
“listen”: “0.0.0.0:8888”
}
}
AD 配置示例
{
“ldap”: {
“addr”: “ad.example.org:389”,
“baseDn”: “dc=example,dc=org”,
“bindDn”: “manager@example.org”,
“bindPass”: “password”,
“authFilter”: “(&(sAMAccountName=%s))”,
“attributes”: [“sAMAccountName”, “displayName”, “mail”],
“tls”: false,
“startTLS”: false
},
“http”: {
“listen”: “0.0.0.0:8888”
}
}
命令体系
命令行部分使用 cobra 框架,可以使用 help 命令查看命令的使用方式
./ldap-test-tool help
ldap-test-tool is a simple tool for ldap test
build by shanghai-edu.
Complete documentation is available at github.com/shanghai-edu/ldap-test-tool
Usage:
ldap-test-tool [flags]
ldap-test-tool [command]
Available Commands:
auth Auth Test
help Help about any command
http Enable a http server for ldap-test-tool
search Search Test
version Print the version number of ldap-test-tool
Flags:
-c, --config string load config file. default cfg.json (default “cfg.json”)
-h, --help help for ldap-test-tool
Use “ldap-test-tool [command] --help” for more information about a command.
认证
./ldap-test-tool auth -h
Auth Test
Usage:
ldap-test-tool auth [flags]
ldap-test-tool auth [command]
Available Commands:
multi Multi Auth Test
single Single Auth Test
Flags:
-h, --help help for auth
Global Flags:
-c, --config string load config file. default cfg.json (default “cfg.json”)
Use “ldap-test-tool auth [command] --help” for more information about a command.
单用户测试
命令行说明
Single Auth Test
Usage:
ldap-test-tool auth single [username] [password] [flags]
Flags:
-h, --help help for single
Global Flags:
-c, --config string load config file. default cfg.json (default “cfg.json”)
示例
./ldap-test-tool auth single qfeng 123456
LDAP Auth Start