「lldap-cli」- lldap 的客户端管理工具

认识

官网:https://github.com/Zepmann/lldap-cli
文档:https://github.com/Zepmann/lldap-cli
仓库:https://github.com/Zepmann/lldap-cli

LLDAP-CLI is a command line interface for LLDAP. 简而言之,我们可以通过 lldap-cli 来查看、修改在 lldap 中的数据。

组成

—— 该部分将介绍 lldap-cli 工具的内在组成,但鉴于我们更加关注于 lldap-cli 工具的使用,所以暂 05/25/2025 不研究 lldap-cli 内在实现。

LLDAP uses GraphQL to offer an HTTP-based API.

LLDAP-CLI translates CLI commands to GraphQL API calls.

构建

下载 lldap-cli 命令,并授予执行权限即可使用。https://github.com/Zepmann/lldap-cli

性质

  • Its primary goal is to offer the same functionality the web interface, but through a CLI instead.
  • A secondary goal is to support new additional features available through the GraphQL API but which are not supported by the web interface.

所以,lldap-cli 的功能是针对 WEB GUI 的补充,其并非 LDAP Client 实现。

应用

export LLDAP_HTTPURL=
export LLDAP_USERNAME=
export LLDAP_PASSWORD=

eval $(lldap-cli login)

# lldap-cli -H https://ldap.example.com -D admin -w admin123 schema attribute user list
Name           Type       Is list  Is visible  Is editable
----           ----       -------  ----------  -----------
avatar         JpegPhoto  false    true        true
creation_date  DateTime   false    true        false
display_name   String     false    true        true
first_name     String     false    true        true
last_name      String     false    true        true
mail           String     false    true        true
user_id        String     false    true        false
uuid           String     false    true        false

改进

[WIP] … Invalid JWT …

通过 docker.io/lldap/lldap:v0.6.1 运行,当重启 lldap 容器后,使用 admin 账号再次执行 lldap-cli 显示如下错误:

# lldap-cli user list
ERROR: Invalid JWT
       Most likely the offered (refresh) token is not valid anymore. Try logging in again.

分析:

  • 相关文章:https://github.com/lldap/lldap/issues/848
  • 当更换其他用户之后,能够正常操作。
  • 查看 sqlite users.db 之后,我们猜测是 WEB GUI 与 lldap-cli 同时登陆 admin 用户,导致 jwt 相关的 seesion 发生覆盖,导致一方失效。我们未进行进一步验证。