aikey2022 我尝试了这种方式, 甚至重启了服务器,但仍未解决。 使用的uid的格式是类似 a.b@c.com 的格式,是否这种格式会导致ldap 登录有问题? 我一直卡在用户名或密码错误

    19 天 后

    StandardStudent

    1. 登录后访问 /kapis/config.kubesphere.io/v1alpha2/configs/oauth,可以看到 LDAPIdentityProvider 是否正确启用了
    2. 邮箱作为用户名是支持的,如果无法登录,可以检查一下 KubeSphere 中是否已经有用户绑定了这个邮箱
    3. 可以通过 ks-apiserver 中认证失败的日志,判断问题出在哪里
      2 个月 后
      7 个月 后

      hongming 配置ldap后,认证可以 但是ks-apiserver liveness 403, 同时所有k8s 都在主和成员集群里, 重启k8s(单节点)后,kubesphere正常了,但是 ldap 认证不行, 我该怎么办?
      /kapis/config.kubesphere.io/v1alpha2/configs/oauth 如下
      {
      “kind”: “Status”,
      “apiVersion”: “v1”,
      “metadata”: {

      },
      “status”: “Failure”,
      “message”: “Unauthorized: token not found in cache”,
      “reason”: “Unauthorized”,
      “code”: 401
      }

        hongming {

        code: 400,

        error: ‘invalid_grant’,

        error_description: ‘incorrect password’,

        statusText: ‘Bad Request’

        }

        –> POST /login 200 10ms 81b 2023/09/27T15:08:03.418

        <– GET /kapis/config.kubesphere.io/v1alpha2/configs/oauth 2023/09/27T15:10:44.708

        16 天 后

        omyhub 请问你ks是什么版本,然后你是如何配置ldap的,你配置ldap之后用户能正常登录么?我遇到这个问题,一直搞不定。

          hongming 你好,我这边ks的版本是:v3.4.0,如下配置了ldap:

          authentication:

          jwtSecret: ""
          
          maximumClockSkew: 10s
          
          multipleLogin: true
          
          oauthOptions:
          
            accessTokenInactivityTimeout: 30m
          
            accessTokenMaxAge: 1h
          
            identityProviders:
          
            - mappingMethod: auto
          
              name: LDAP
          
              provider:
          
                host: 192.168.1.1:389
          
                loginAttribute: uid
          
                mailAttribute: mail
          
                managerDN: cn=xx,dc=xx,dc=com
          
                managerPassword: xgdasssdf
          
                userSearchBase: dc=xx,dc=com
          
              type: LDAPIdentityProvider

          然后请求/kapi得到如下:

          {

          "issuer": "kubesphere",
          
          "identityProviders": [
          
              {
          
                  "name": "LDAP",
          
                  "mappingMethod": "auto",
          
                  "disableLoginConfirmation": false,
          
                  "type": "LDAPIdentityProvider",
          
                  "provider": {
          
                      "host": "192.168.1.1:389",
          
                      "loginAttribute": "uid",
          
                      "mailAttribute": "mail",
          
                      "managerDN": "cn=xx,dc=xx,dc=com",
          
                      "userSearchBase": "dc=xx,dc=com"
          
                  }
          
              }
          
          ],
          
          "clients": [
          
              {
          
                  "name": "kubesphere",
          
                  "redirectURIs": [
          
                      "\*"
          
                  ]
          
              }
          
          ],
          
          "accessTokenMaxAge": 3600000000000,
          
          "accessTokenInactivityTimeout": 1800000000000

          }

          结果是:console页面登录用户,一直提示账号密码错误,ks-apiserver无相关日志,console有如下日志:

          <– POST /login 2023/10/13T10:38:04.310

          {

          code: 400,

          error: ‘invalid_grant’,

          error_description: ‘incorrect password’,

          statusText: ‘Bad Request’

          }

          –> POST /login 200 3ms 81b 2023/10/13T10:38:04.313

          想请教,我应该当如何才能正确接入ldap,感谢

          同这个问题,回退到3.2.1版本可以解决,目前来看kubesphere是快凉了,问他们产品经理都不鸟人了,不维护就赶紧宣布吧,在这里恶心人!

          wuzheng

          看你的配置参数应该是没有问题的,从console上看日志就是密码错误导致 ,你可以仔细翻一下ks-apiserver的日志,如果登录失败应该会记录相应的error日志

            5 天 后

            zhou1203 很让人纠结的就是ks-apiserver一直都没相关的日志,就ks-console一直提示账号密码问题,但是我是可以保证账号密码没问题的,我为了验证都特意修改了一个弱密码页没搞定。

              1 个月 后

              3.4.1更新说明上写着LDAP已经修复,但是我还是登录不上,点击登录的时候登录按钮闪烁一下,也没有任何提示和报错,搞不懂了

              authentication:

              jwtSecret: ''
              
              maximumClockSkew: 10s
              
              multipleLogin: true
              
              oauthOptions:
              
                accessTokenInactivityTimeout: 30m
              
                accessTokenMaxAge: 1h
              
                identityProviders:
              
                  - mappingMethod: auto
              
                    name: LDAP
              
                    provider:
              
                      host: '10.66.66.66:389'
              
                      loginAttribute: SamAccountName
              
                      mailAttribute: mail
              
                      managerDN: 'CN=ldap_auth,OU=LDAP_AUTH,OU=dom,DC=dom,DC=cn'
              
                      managerPassword: laP_fsoBSW2FFN_fpwnhFs.432g
              
                      userSearchBase: 'cn=dom,dc=dom,dc=cn'
              
                    type: LDAPIdentityProvider
                25 天 后

                CXNia 最好是直接重装一下相关的组件。看起来是因为组件问题

                hongming 请问 loginAttribute 字段如何配置同时支持uid和mail登陆验证?谢回复

                1 个月 后

                CXNia 今天升级也遇到了。后来发现登录页面有个“通过LDAP登录”的选项。。。。