久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

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

      簡介

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

      關(guān)于SSL/TLS

      • LDAP over SSL
      # LDAP over SSL 也就是 ldaps # ldap默認不加密情況下是走的389端口 # 當使用ldaps的時候走的就是636端口了 # 可以簡單理解成http和https的關(guān)系 # 當然ldaps已經(jīng)淘汰了,不然也不會有LDAP over TLS出來
      • LDAP over TLS
      # TLS可以簡單理解為ldaps的升級 # 它默認走389端口,但是會通訊的時候加密 # 客戶端連接LDAP時,需要指明通訊類型為TLS,所以他可以跟不加密的模式一樣,任意端口都行    對比一下連接方式:  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   

      準備證書

      • 安裝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;  
      • 配置證書信息
      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的證書申請  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證書申請資料 # 下面hosts字段里就是使用這張證書的主機 # 特別注意一定要加上宿主機的IP地址,反正是自己頒發(fā)的證書,怎么加都行!?。?/span> # 加上本機回環(huán)地址,加上ldap容器名,我這里容器名待會設(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  
      • 給證書簽名
      # CA自簽名  cfssl gencert -initca ldap-ca-csr.json | cfssljson -bare ca    # LDAP證書簽名,ldap需要的文件為:ca證書,ldap證書,ldap私鑰  cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=ldap ldap-csr.json | cfssljson -bare ldap    # 查看生成的證書 # 其中  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  

      開始安裝ldap

      • 克隆倉庫,獲取docker-compose.yaml文件
      cd $HOME  git clone https://github.com/JyBigBoss/docker-compose.git  cd docker-compose/LDAP/
      • 復(fù)制證書
      mkdir ssl/  cp $HOME/ssl/{ldap-key.pem,ldap.pem,ca.pem} ssl/
      • 修改docker-compose.yaml文件
      vi docker-compose.yaml    # 修改下面的幾項 # 鏡像使用的是osixia/openldap # 詳細的配置解釋: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,這個選項可以理解成雙向認證,也就是客戶端連接ldap時也許要提供證書,也就是客戶端也需要有自己的證書 # 設(shè)置成try就行,客戶端不提供證書也能連接,反正連接已經(jīng)加密了。 # 官方文檔:http://www.openldap.org/doc/admin24/tls.html

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

      • 啟動ldap
      #第一次啟動會比較慢,淡定點  docker-compose pull  docker-compose up -d   ls  docker ps -a # 啟動之后會生成幾個文件夾 # 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  

      打開瀏覽器,配置LDAP Account Manager

      • LDAP Account Manager容器監(jiān)聽在8080端口
      • 打開http://192.168.1.1:8080
      # 配置一下lam管理頁面 # lam管理界面默認密碼是: lam # lam可以管理多個ldap服務(wù)器,所以可以擁有多個profile,每個profile對應(yīng)一臺服務(wù)器   # 簡單添加個用戶,然后用另一臺linux機器測試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加密

      測試LDAP

      • 安裝ldap客戶端
      yum install -y openldap-clients  nss-pam-ldapd  
      • 配置配置客戶端
      # 配置系統(tǒng)使用ldap認證  authconfig-tui    # 將自簽名的ca證書給客戶端  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加密

      • 測試
      # 執(zhí)行命令看看能不能讀取到LDAP用戶 # 能連接上ldap的話,執(zhí)行之后會出現(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號-2    滬公網(wǎng)安備31011702889846號