容器化部署dex适配openldap

2023-11-04

ldap

    LDAP:在OIDC流程中是用来做身份认证服务的,包括LDAP身份认证服务器,自己的第三方应用需要调用LDAP的客户端接口,用以访问LDAP服务器进行身份验证。作用:用户验证 用户管理 。

  ldap它是用来做统一用户身份认证的.即: 你访问CSDN它说你可以用微信登录,你登录微博,它也支持微信登录等,这就是一种认证服务, 当然它们不一定用LDAP来做为他们的目录服务.LDAP(Light Directory Access Portocol),它是基于X.500标准的轻量级目录访问协议。Linux上实现LDAP的工具是 openladp, 通过配置ldap服务器,将用户信息存储在其中,就可以使用ldap协议,访问用户数据库,来实现LDAP用户认证。

1. 目录树概念

  1. 目录树:在一个目录服务系统中,整个目录信息集可以表示为一个目录信息树,树中的每个节点是一个条目。

  2. 条目:每个条目就是一条记录,每个条目有自己的唯一可区别的名称(DN)。

  3. 对象类(objectclass):与某个实体类型对应的一组属性,对象类是可以继承的,这样父类的必须属性也会被继承下来。

  4. 属性:描述条目的某个方面的信息,一个属性由一个属性类型和一个或多个属性值组成,属性有必须属性和非必须属性。

关键字 英文全称 含义
dc Domain Component 域名的部分,其格式是将完整的域名分成几部分,如域名为example.com变成dc=example,dc=com(一条记录的所属位置)
uid User Id 用户ID songtao.xu(一条记录的ID)
ou Organization Unit 组织单位,组织单位可以包含其他各种对象(包括其他组织单元),如“oa组”(一条记录的所属组织)
cn Common Name 公共名称,如“Thomas Johansson”(一条记录的名称)
sn Surname 姓,如“许”
dn Distinguished Name “uid=songtao.xu,ou=oa组,dc=example,dc=com”,一条记录的位置(唯一)
rdn Relative dn 相对辨别名,类似于文件系统中的相对路径,它是与目录树结构无关的部分,如“uid=tom”或“cn= Thomas Johansson”

    LDAP的信息是以树型结构存储的,在树根一般定义国家(c=CN)或域名(dc=com),在其下则往往定义一个或多个组织 (organization)(o=Acme)或组织单元(organizational units) (ou=People)。一个组织单元可能包含诸如所有雇员、大楼内的所有打印机等信息。此外,LDAP支持对条目能够和必须支持哪些属性进行控制,这是有一个特殊的称为对象类别(objectClass)的属性来实现的。该属性的值决定了该条目必须遵循的一些规则,其规定了该条目能够及至少应该包含哪些属性。

2. 基准识别名(Base Distinguished Name, Base DN):一般指整个目录树的根。

The LDAP connector first initializes a connection to the LDAP directory using the bindDN and bindPW. It then tries to search for the given username and bind as that user to verify their password. Searches that return multiple entries are considered ambiguous and will return an error.

bindDN:一般指整个目录树的根

bindPW:设定根节点的管理密码

// BindDN and BindPW for an application service account. The connector uses these
// credentials to search for users and groups.
BindDN string `json:"bindDN"`
BindPW string `json:"bindPW"`

dex的https自签名证书

1.dex容器化部署的自签名证书会已configmap和secret的形式导出。


#dex的helm文件job-web-certs.yaml截取内容
openssl genrsa -out ca-key.pem 2048;

openssl req -x509 -new -nodes -key ca-key.pem -days {{ .Values.certs.web.caDays }} -out ca.pem -subj "/CN=dex-ca";

openssl genrsa -out key.pem 2048;

openssl req -new -key key.pem -out csr.pem -subj "/CN=dex" -config req.cnf;

openssl x509 -req -in csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -days {{ .Values.certs.web.certDays }} -extensions v3_req -extfile req.cnf;


kubectl create configmap {{ $caName | quote }} --namespace {{ .Release.Namespace }} --from-file dex-ca.pem=ca.pem;

kubectl create secret tls {{ $caName | quote }} --namespace {{ .Release.Namespace }} --cert=ca.pem --key=ca-key.pem;

kubectl create secret tls {{ $tlsSecretName }} --namespace {{ .Release.Namespace }} --cert=cert.pem --key=key.pem;

2.      在签署证书(server.csr签署ca.crt)之前需要确认openssl.cnf中的配置。openssl.cnf用来进行下一步生成服务器签署申请文件server.csr(openssl req -new -out server.csr -key server.key -config /etc/ssl/openssl.cnf)。

#openssl.cnf的alt_names域中如果没有IP这一项,浏览器使用IP访问时验证无法通过
[ alt_names ]
IP.1 = 192.168.50.115  #配置https服务端的访问ip
DNS.1 = dfe.leida.org  #配置https服务端的访问域名可配多个
DNS.2 = ex.abcexpale.net

容器化部署中的dex-server中ldap配置

# Default values for dex
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name: value
image: node5:5000/dex   
imageTag: "v2.21.0"
imagePullPolicy: "IfNotPresent"

inMiniKube: false

nodeSelector: {}

podLabels: {}

podAnnotations: {}

initContainers: []

tolerations: []
  # - key: CriticalAddonsOnly
  #   operator: Exists
  # - key: foo
  #   operator: Equal
  #   value: bar
  #   effect: NoSchedule

replicas: 2   

# resources:
  # limits:
    # cpu: 100m
    # memory: 50Mi
  # requests:
    # cpu: 100m
    # memory: 50Mi

# grpc support
grpc: false

# https termination by dex itself
https: false      #false配置的话dex-server则为http服务.

ports:
  web:
    containerPort: 5556
    # for service.type: NodePort
    nodePort: 32000
    servicePort: 32000
# Relevant only when grpc support is enabled
  grpc:
    containerPort: 5000
    # for service.type: NodePort
    nodePort: 35000
    servicePort: 35000

livenessProbe:
  enabled: true
  initialDelaySeconds: 1
  failureThreshold: 1
  httpPath: "/healthz"
  periodSeconds: 10
  timeoutSeconds: 1

readinessProbe:
  enabled: true
  initialDelaySeconds: 1
  failureThreshold: 1
  httpPath: "/healthz"
  periodSeconds: 10
  timeoutSeconds: 1

service:
  type: NodePort         #在容器化部署中建议选择nodeport的类型用于外网ip连接
  # Override IP for the Service Type: LoadBalancer.
  # This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created.
  # loadBalancerIP: 127.0.0.1
  annotations: {}

ingress:
  enabled: true
  annotations: {}
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  path: /
  hosts:
    - dex.tars.com
  tls: []
  #  - secretName: dex-example-tls
  #    hosts:
  #      - dex.example.com

extraVolumes: []
extraVolumeMounts: []

certs:
  securityContext:
    enabled: true
    runAsUser: 65534
    fsGroup: 65534
  image: node5:5000/kubernetes-dashboard-init-amd64
  imageTag: "v1.0.0"
  imagePullPolicy: "IfNotPresent"
  # Section below is relevant only when https termination is enabled
  web:
    create: true
    activeDeadlineSeconds: 300
    caDays: 10000
    certDays: 10000
    altNames:
      - dex.io
    altIPs: {}
    secret:
      tlsName: dex-web-server-tls
      caName: dex-web-server-ca
    pod:
      annotations: {}
  # Section below is relevant only when grpc support is enabled
  grpc:
    create: true
    activeDeadlineSeconds: 300
    altNames:
      - dex.io
    altIPs: {}
    secret:
      serverTlsName: dex-grpc-server-tls
      clientTlsName: dex-grpc-client-tls
      caName: dex-grpc-ca
    pod:
      annotations: {}

env: []

rbac:
  # Specifies whether RBAC resources should be created
  create: true

crd:
  # Specifies whether dex's CRDs are already present (if not cluster role and cluster role binding will be created
  # to enable dex to create them). Depends on rbac.create
  present: false

serviceAccount:
  # Specifies whether a ServiceAccount should be created
  create: true
  # The name of the ServiceAccount to use.
  # If not set and create is true, a name is generated using the fullname template
  name:

affinity: {}
  # podAntiAffinity:
  #   preferredDuringSchedulingIgnoredDuringExecution:
  #   - weight: 5
  #     podAffinityTerm:
  #       topologyKey: "kubernetes.io/hostname"
  #       labelSelector:
  #         matchLabels:
  #           app: {{ template "dex.name" . }}
  #           release: "{{ .Release.Name }}"

podDisruptionBudget: {}
  # maxUnavailable: 1

config:
  issuer: http://dex.dex:32000  ##建议改成ip,貌似用域名的会出现验证的问题
  storage:
    type: kubernetes
    config:
      inCluster: true
  logger:
    level: debug
  web:
    # port is taken from ports section above
    address: 0.0.0.0
    tlsCert: /etc/dex/tls/https/server/tls.crt
    tlsKey: /etc/dex/tls/https/server/tls.key
# Section below is relevant only when grpc support is enabled
  grpc:
    # port is taken from ports section above
    address: 127.0.0.1
    tlsCert: /etc/dex/tls/grpc/server/tls.crt
    tlsKey: /etc/dex/tls/grpc/server/tls.key
    tlsClientCA: /etc/dex/tls/grpc/ca/tls.crt
  connectors:
   - type: ldap
     id: ldap
     name: openLDAP
     config:
       host: openldap.openldap:389   #ldap-server的host
       # No TLS for this setup.
       insecureNoSSL: true
       clientID: authServer
       clientSecret: XhhbXBsZS1hcHAtc2VjcmV0
       redirectURI: http://dex.dex:32000/callback
       org: kubernetes
       
       # This would normally be a read-only user.
       bindDN: cn=admin,dc=alibaba,dc=com
       bindPW: test
       usernamePrompt: User Name
       userSearch:
         baseDN: ou=staff,dc=tencent,dc=com  #搜索条目的基域
         filter: (objectclass=organizationalPerson)
         username: uid
          # "DN" (case sensitive) is a special attribute name. It indicates that
         # this value should be taken from the entity's DN not an attribute on
         # the entity.
         idAttr: uid
         emailAttr: mail
         nameAttr: cn

       groupSearch:
        baseDN: dc=alibaba,dc=com
        filter: (objectclass=People)
        userMatchers:
         # A user is a member of a group when their DN matches
         # the value of a "member" attribute on the group entity.
        - userAttr: uid
          groupAttr: member
        #The group name should be the "cn" value.
        nameAttr: cn
  oauth2:
    alwaysShowLoginScreen: false
    skipApprovalScreen: true

  expiry:
     signingKeys: "6h"
     idTokens: "24h"

  staticClients:     #dex-client的配置
   - id: authServer
     redirectURIs:   #dex-client的回调url
     - 'http://127.0.0.1:5555/callback'     
     name: 'authServer'
     secret: XhhbXBsZfdfdS1hdfcHAtc2VfjcmV0

  enablePasswordDB: true
#  staticPasswords:
#   - email: "admin@example.com"
#     # bcrypt hash of the string "password"
#     hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
#     username: "admin"
#     userID: "08a8684b-db88-4b73-90a9-3cd1661f5466"

# frontend:
#   logoURL: https://example.com/yourlogo.png


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

容器化部署dex适配openldap 的相关文章

  • Python-Tkinter 图形化界面设计

    摘抄来自Python Tkinter 图形化界面设计 还是自己去看一下比较好 我只是摘抄我用的上的 一 最基本框架 from tkinter import root Tk root title 我的第一个Python窗体 root geom
  • P2524 Uim的情人节礼物·其之弐【康托展开模板题】

    题目链接 我在这里加了树状数组来优化康托展开 但是这道题的数据其实很小 不需要加也是可以的 include
  • 27 类深度学习主要神经网络

    1 感知器 Perceptron P 感知器模型也称为单层神经网络 这个神经网络只包含两层 输入层 输出层 这种类型的神经网络没有隐藏层 它接受输入并计算每个节点的加权 然后 它使用激活函数 大多数是Sigmoid函数 进行分类 应用 分类
  • 49 题目 1431: [蓝桥杯][2014年第五届真题]分糖果

    题目 1431 蓝桥杯 2014年第五届真题 分糖果 时间限制 1Sec 内存限制 128MB 提交 5807 解决 2969 题目描述 问题描述 有n个小朋友围坐成一圈 老师给每个小朋友随机发偶数个糖果 然后进行下面的游戏 每个小朋友都把
  • Python中Requests模块的异常值处理

    在我们用Python的requests模块进行爬虫时 一个简单高效的模块就是requests模块 利用get 或者post 函数 发送请求 但是在真正的实际使用过程中 我们可能会遇到网络的各种变化 可能会导致请求过程发生各种未知的错误导致程
  • Vue中的路由以及默认路由跳转

    文章目录 官方网址 Vue路由配置 安装 引入并使用 配置路由 官方网址 https router vuejs org Vue路由配置 安装 npm install vue router save 或者 cnpm install vue r
  • SpringBoot集成XxlJob分布式任务调度中心(超详细之手把手教学)

    一 前言 废话就不多说了 介绍Xxl Job的网上已经有很多 本文就不多加复制粘贴了 直接步入第二步 PS 本文包括Xxl Job分布式定时任务调度中心的搭建 以及SpringBoot集成XxlJob的全过程 如果不想了解搭建的小伙伴可以直
  • 判断加密方式

    如何判断密文的加密方式 1 如果密文是十进制 字符范围是 0 9 可以猜测是ASCII编码 2 如果密文由 a z A Z 和 构成 特别是末尾有 那么判断可能是Base64编码 Base64在线解码网址 BASE64加密解密 3 如果密文
  • Docker 部署 RocketMQ

    文章目录 安装nameserver 拉取镜像 运行容器 出现问题卸载 安装broker 创建配置文件 运行容器 出现问题卸载 安装控制台 拉取镜像 运行容器 出现问题卸载 安装nameserver 拉取镜像 docker pull rock
  • 时序预测

    时序预测 MATLAB实现ARIMA时间序列预测 armax函数 本程序基于MATLAB的armax函数实现arima时间序列预测 实现了模型趋势分析 序列差分 序列平稳化 AIC准则模型参数识别与定阶 预测结果与误差分析过程 逻辑清晰 数
  • 【NLP实践】使用Pytorch进行文本分类——BILSTM+ATTENTION

    目录 网络结构 代码实现 Attention计算 模型效果 调参 相关文章 网络结构 代码实现 class TextBILSTM nn Module def init self config TRNNConfig char size 500

随机推荐

  • 学习Vue 之 创建一个 Vue 应用

    文章目录 Vue js 概述 了解 Vue 创建一个 Vue 应用 参考 Vue js 概述 计划学习前端 已有一些HTML js CSS的基础知识 下一步学习Vue js 以下是一些适合新手的Vue js教程 你可以根据自己的实际情况和需
  • Python提示 TypeError: super(type, obj): obj must be an instance or subtype of type问题

    Python提示 TypeError super type obj obj must be an instance or subtype of type问题 简述问题 在工作中有一天将debug下正常工作的python代码编译之后运行却抛出
  • 奇迹mu修改服务器名,奇迹MU 红名设置调整方案说明

    尊敬的用户 经过与游戏制作方的沟通 已经确认本次游戏版本中红名设置突然调整的原因 由于韩国奇迹MU之外的所有服务器 国际服 日服 中国服务器等 将对红名设置进行统一设置 红名设置将恢复成为Season 8版本期间的模式 红名2阶段之后可以继
  • 使用JAVA连接MySQL,储存歌曲,图片,影片文件

    MySQL中创建数据表 存放歌曲等文件字节流 使用longblob字段类型 我这个只是演示所以就一个字段 如果想比较好的管理文件 不要这么搞 create dadabase ttest use ttest create table musi
  • 【stm32单片机基础】按键状态机实现长按和短按

    stm32单片机基础 按键状态机 文章目录 stm32单片机基础 按键状态机 前言 一 按键的消抖 二 按键状态机实现 0 状态机模式 1 单个按键检测 2 单个按键实现长按和短按 三 长按和短按测试示例 四 多按键检测 按键处理经典例程
  • openEuler20.03如何安装图形化界面

    需求描述 需要安装图形界面方便操作 详细步骤 1 安装ukui图形界面 字体库 root localhost yum install ukui y root localhost local yum groupinstall fonts y
  • 2021白盒测试常用工具介绍【建议收藏】

    白盒测试工具一般是针对代码进行测试 测试中发现的缺陷可以定位到代码级 根据测试工具原理的不同 又可以分为静态测试工具和动态测试工具 1 Jtest 是一个代码分析和动态类 组件测试工具 是一个集成的 易于使用和自动化的Java单元测试工具
  • js 在数组对象中模糊搜索(直接上代码)

    1 测试数据 学生对象数组 var students id 1 name 张三 age 14 id 2 name 李四 age 15 id 3 name 王五 age 17 id 4 name 赵六 age 18 2 查询操作 根据下标查询
  • 写论文的开源免费神器汇总

    科研办公学习的开源免费神器汇总 一 公式 1 Mathtype 是一款专业的数学公式编辑工具 理科生专用的工具 mathtype公式编辑器能够帮助用户在各种文档中插入复杂的数学公式和符号 2 Mathpix Mathpix可以将图片 PDF
  • 非对称加密算法--RSA加密原理详解

    密码学是在编码与破译的斗争实践中逐步发展起来的 并随着先进科学技术的应用 已成为一门综合性的尖端技术科学 密码学发展史 在说RSA加密算法之前 先说下密码学的发展史 其实密码学的诞生 就是为了运用在战场 在公元前 战争之中出现了秘密书信 在
  • ETCD 简介 + 使用

    随着CoreOS和Kubernetes等项目在开源社区日益火热 它们项目中都用到的etcd组件作为一个高可用 强一致性的服务发现存储仓库 渐渐为开发人员所关注 在云计算时代 如何让服务快速透明地接入到计算集群中 如何让共享配置信息快速被集群
  • getPerspectiveTransform通过4对点确认透视变换矩阵的原理分析

    老猿Python博文目录 https blog csdn net LaoYuanPython 一 引言 图像透视变换 Perspective Transformation 的本质是将图像从一个几何平面投影到另一个几何平面 透视变换保证同一条
  • html禁止Input文本输入缓存的两种方法

    默认情况下大多数的浏览器都会缓存input输入框的值 当输入框获取焦点时缓存值就会出现 我们只能通过清除浏览器的缓存来清除输入框的缓存值 这里介绍两种去掉输入框缓存的方法 input 的属性autocomplete 默认为on 其含义代表是
  • matlab自带各种分类器的使用示例

    目前了解到的 MATLAB 中分类器有 K 近邻分类器 随机森林分类器 朴素贝叶斯 集成学习方法 鉴别分析分类器 支持向量机 现将其主要函数使用方法总结如下 更多细节需参考 MATLAB 帮助文件 设 训练样本 train data 矩阵
  • 二叉树的认识

    愚昧将使你达不到任何成果 并在失望和忧郁之中自暴自弃 达芬奇 目录 一 二叉树的概念 二 二叉树的特点 结构 三 三种特殊的二叉树 1 斜树 2 满二叉树 3 完全二叉树 四 二叉树的性质 五 二叉树的存储方式 1 顺序存储 2 链式存储
  • 【前端】Vue项目:旅游App-(2)TabBar:搭建TabBar、循环获取动态数据、相关工具封装

    文章目录 目标 代码与过程 静态html css 改成动态数据 效果 总代码 修改或新建的文件 tabbarData js tab bar vue load assets App vue 目标 有两种实现方式 把数据写死 静态 直接写在ht
  • DotNetZip知识系列:用来解压缩zip

    说明 这是 net平台可以使用的一个库 NuGet Gallery Package Downloads for DotNetZip 这是官方文档 About DotNetZip DotNetZip Documentation
  • 2022.03.06 mysql8拉链表-测试

    1 创建业务表并初始数据 drop table if exists mall user create table mall user uid bigint unsigned auto increment comment 用户唯一ID pri
  • shell快速迁移海量文件的两种方案

    最近遇到这样一个小需求 linux服务器上某个目录下有几百万个文件 导致各种操作不便 急需转移历史文件 保留90天 同时对转移到的目录下新建日期文件夹 按文件创建来存放文件 想到了两种解决方案 第一种直接按创建日期find 这样需检索整个目
  • 容器化部署dex适配openldap

    ldap LDAP 在OIDC流程中是用来做身份认证服务的 包括LDAP身份认证服务器 自己的第三方应用需要调用LDAP的客户端接口 用以访问LDAP服务器进行身份验证 作用 用户验证 用户管理 ldap它是用来做统一用户身份认证的 即 你