久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      CentOS 7 部署LDAP服務(wù)并啟用TLS加密

      簡(jiǎn)介

      • LDAP(輕量級(jí)目錄訪問(wèn)協(xié)議,Lightweight Directory Access Protocol)是為了實(shí)現(xiàn)目錄服務(wù)的信息服務(wù)。
      • 目錄服務(wù)是一種特殊的數(shù)據(jù)庫(kù)系統(tǒng),其專門(mén)針對(duì)讀取,瀏覽和搜索操作進(jìn)行了特定的優(yōu)化。在網(wǎng)絡(luò)中應(yīng)用了LDAP后,用戶只需要使用一個(gè)賬號(hào)和密碼就可以輕松訪問(wèn)網(wǎng)絡(luò)中的所有服務(wù),實(shí)現(xiàn)用戶身份的統(tǒng)一認(rèn)證。
      • 簡(jiǎn)單來(lái)說(shuō):拿LDAP來(lái)統(tǒng)一管理一些賬號(hào),例如: Gitlab,JenKins,Samba,SVN,Zabbix等。

      關(guān)于SSL/TLS

      • LDAP over SSL
      # LDAP over SSL 也就是 ldaps # ldap默認(rèn)不加密情況下是走的389端口 # 當(dāng)使用ldaps的時(shí)候走的就是636端口了 # 可以簡(jiǎn)單理解成http和https的關(guān)系 # 當(dāng)然ldaps已經(jīng)淘汰了,不然也不會(huì)有LDAP over TLS出來(lái)
      • LDAP over TLS
      # TLS可以簡(jiǎn)單理解為ldaps的升級(jí) # 它默認(rèn)走389端口,但是會(huì)通訊的時(shí)候加密 # 客戶端連接LDAP時(shí),需要指明通訊類(lèi)型為T(mén)LS,所以他可以跟不加密的模式一樣,任意端口都行    對(duì)比一下連接方式:  ldaps: ldapsearch -H ldaps://127.0.0.1  TLS:   ldapsearch -ZZ -H ldap://127.0.0.1   

      環(huán)境

      CentOS Linux release 7.5.1804 Kernel 4.20.0-1.el7.elrepo.x86_64 docker-ce 18.09 docker-compose 1.23.1

      安裝docker-compose

      yum install -y Python-pip  pip install docker-compose  docker-compose -v   

      準(zhǔn)備證書(shū)

      • 安裝cfssl
      wget -O /bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64  wget -O /bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64  wget -O /bin/cfssl-certinfo  https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64  for cfssl in `ls /bin/cfssl*`;do chmod +x $cfssl;done;  
      • 配置證書(shū)信息
      cd $HOME && mkdir ssl && cd ssl    # ca配置文件  cat > ca-config.json << EOF  {    "signing": {      "default": {        "expiry": "87600h"      },      "profiles": {        "ldap": {          "usages": [              "signing",              "key encipherment",              "server auth",              "client auth"          ],          "expiry": "87600h"        }      }    }  }  EOF  # 自簽名ca的證書(shū)申請(qǐng)  cat > ldap-ca-csr.json << EOF  {    "CN": "ldap",    "key": {      "algo": "rsa",      "size": 2048    },    "names": [      {        "C": "CN",        "ST": "Shenzhen",        "L": "Shenzhen",        "O": "ldap",        "OU": "LDAP Security"      }    ]  }  EOF    # ldap證書(shū)申請(qǐng)資料 # 下面hosts字段里就是使用這張證書(shū)的主機(jī) # 特別注意一定要加上宿主機(jī)的IP地址,反正是自己頒發(fā)的證書(shū),怎么加都行?。?! # 加上本機(jī)回環(huán)地址,加上ldap容器名,我這里容器名待會(huì)設(shè)置成openldap # 如果你要放到公網(wǎng)去的話,那一可以加上FQDN地址    cat > ldap-csr.json << EOF  {      "CN": "ldap",      "hosts": [        "127.0.0.1",        "192.168.1.1",        "openldap",        "ldap.lotbrick.com",        "lotbrick.com"      ],      "key": {          "algo": "rsa",          "size": 2048      },      "names": [          {              "C": "CN",              "ST": "Shenzhen",              "L": "Shenzhen",              "O": "ldap",              "OU": "LDAP Security"          }      ]  }  EOF  
      • 給證書(shū)簽名
      # CA自簽名  cfssl gencert -initca ldap-ca-csr.json | cfssljson -bare ca    # LDAP證書(shū)簽名,ldap需要的文件為:ca證書(shū),ldap證書(shū),ldap私鑰  cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=ldap ldap-csr.json | cfssljson -bare ldap    # 查看生成的證書(shū) # 其中  ldap-key.pem  ldap.pem ca.pem 是我們需要的  [root@master ssl]#ls  ca-config.json  ca.csr  ca-key.pem  ca.pem  ldap-ca-csr.json  ldap.csr  ldap-csr.json  ldap-key.pem  ldap.pem  

      開(kāi)始安裝ldap

      • 克隆倉(cāng)庫(kù),獲取docker-compose.yaml文件
      cd $HOME  git clone https://github.com/JyBigBoss/docker-compose.git  cd docker-compose/LDAP/
      • 復(fù)制證書(shū)
      mkdir ssl/  cp $HOME/ssl/{ldap-key.pem,ldap.pem,ca.pem} ssl/
      • 修改docker-compose.yaml文件
      vi docker-compose.yaml    # 修改下面的幾項(xiàng) # 鏡像使用的是osixia/openldap # 詳細(xì)的配置解釋:https://github.com/osixia/docker-openldap    LDAP_ORGANISATION: "lotbrick.com"  LDAP_DOMAIN: "lotbrick.com"  LDAP_ADMIN_PASSWORD: "admin"  LDAP_CONFIG_PASSWORD: "admin"  LDAP_TLS: "true"  LDAP_TLS_CRT_FILENAME: "ldap.pem"  LDAP_TLS_KEY_FILENAME: "ldap-key.pem"  LDAP_TLS_CA_CRT_FILENAME: "ca.pem"  LDAP_TLS_ENFORCE: "true"  LDAP_TLS_VERIFY_CLIENT: "try"  domainname: "lotbrick.com"  hostname: "lotbrick.com" # 特別注意LDAP_TLS_VERIFY_CLIENT # 不要設(shè)置成demand,這個(gè)選項(xiàng)可以理解成雙向認(rèn)證,也就是客戶端連接ldap時(shí)也許要提供證書(shū),也就是客戶端也需要有自己的證書(shū) # 設(shè)置成try就行,客戶端不提供證書(shū)也能連接,反正連接已經(jīng)加密了。 # 官方文檔:http://www.openldap.org/doc/admin24/tls.html

      CentOS 7 部署LDAP服務(wù)并啟用TLS加密

      • 啟動(dòng)ldap
      #第一次啟動(dòng)會(huì)比較慢,淡定點(diǎn)  docker-compose pull  docker-compose up -d   ls  docker ps -a # 啟動(dòng)之后會(huì)生成幾個(gè)文件夾 # ldapconf保存的是ldap的配置文件 # ldapdata保存的是ldap的數(shù)據(jù) # lam保存的是lam管理工具的配置    [root@master LDAP]#docker-compose up -d  Creating network "ldap_default" with the default driver  Creating openldap ... done  Creating ldap-account-manager ... done  [root@master LDAP]#ls  docker-compose.yaml  lam  ldapconf  ldapdata  ssl    [root@master LDAP]#docker ps -a  CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS              PORTS                                        NAMES  9b4ebdad17eb        jinyunboss/ldap-account-manager:6.6   "docker-php-entrypoi…"   2 minutes ago       Up 2 minutes        0.0.0.0:8080->80/tcp                         ldap-account-manager  a7ff3bd5dced        osixia/openldap:1.2.2                 "/container/tool/run"    2 minutes ago       Up 2 minutes        0.0.0.0:389->389/tcp, 0.0.0.0:636->636/tcp   openldap  

      打開(kāi)瀏覽器,配置LDAP Account Manager

      • LDAP Account Manager容器監(jiān)聽(tīng)在8080端口
      • 打開(kāi)http://192.168.1.1:8080
      # 配置一下lam管理頁(yè)面 # lam管理界面默認(rèn)密碼是: lam # lam可以管理多個(gè)ldap服務(wù)器,所以可以擁有多個(gè)profile,每個(gè)profile對(duì)應(yīng)一臺(tái)服務(wù)器   # 簡(jiǎn)單添加個(gè)用戶,然后用另一臺(tái)linux機(jī)器測(cè)試ldap連接

      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密

      測(cè)試LDAP

      • 安裝ldap客戶端
      yum install -y openldap-clients  nss-pam-ldapd  
      • 配置配置客戶端
      # 配置系統(tǒng)使用ldap認(rèn)證  authconfig-tui    # 將自簽名的ca證書(shū)給客戶端  cd /etc/openldap/cacerts/    # 修改/etc/nslcd.conf,添加管理員憑據(jù)  echo "binddn cn=admin,dc=lotbrick,dc=com" >> /etc/nslcd.conf  echo "bindpw admin" >> /etc/nslcd.conf    cat /etc/nslcd.conf    # 重啟nslcd服務(wù)    systemctl restart nslcd  

      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密

      • 測(cè)試
      # 執(zhí)行命令看看能不能讀取到LDAP用戶 # 能連接上ldap的話,執(zhí)行之后會(huì)出現(xiàn)ldap用戶    getent passwd    id bigboss    # 切換成bigboss用戶試試    su - bigboss  

      CentOS 7 部署LDAP服務(wù)并啟用TLS加密
      CentOS 7 部署LDAP服務(wù)并啟用TLS加密

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)