最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用TLS加密通訊遠程連接Docker的示例詳解

 更新時間:2020年12月08日 11:00:17   作者:人人都是酸菜魚又酸又菜又多余  
這篇文章主要介紹了使用TLS加密通訊遠程連接Docker的示例詳解,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下

默認(rèn)情況下,Docker 通過非聯(lián)網(wǎng) UNIX 套接字運行。它還可以使用 HTTP 套接字進行可選通信。
如果需要以安全的方式通過網(wǎng)絡(luò)訪問 Docker,可以通過指定標(biāo)志將 Docker 標(biāo)志指向受信任的 CA 證書來啟用 TLS。
在守護程序模式下,它只允許來自由該 CA 簽名的證書驗證的客戶端的連接。在客戶端模式下,它僅連接到具有該 CA 簽名的證書的服務(wù)器。

# 創(chuàng)建CA證書目錄
[root@localhost ~]# mkdir tls
[root@localhost ~]# cd tls/
# 創(chuàng)建CA密鑰
[root@localhost tls]# openssl genrsa -aes256 -out ca-key.pem 4096
Generating RSA private key, 4096 bit long modulus
..............................................................................++
.....................................................................................................................................................................++
e is 65537 (0x10001)
Enter pass phrase for ca-key.pem:
Verifying - Enter pass phrase for ca-key.pem:
# 創(chuàng)建CA證書
[root@localhost tls]# openssl req -new -x509 -days 1000 -key ca-key.pem -sha256 -subj "/CN=*" -out ca.pem
Enter pass phrase for ca-key.pem:
[root@localhost tls]# ll
總用量 8
-rw-r--r--. 1 root root 3326 12月 3 17:20 ca-key.pem
-rw-r--r--. 1 root root 1765 12月 3 19:03 ca.pem
# 創(chuàng)建服務(wù)器私鑰
[root@localhost tls]# openssl genrsa -out server-key.pem 4096
Generating RSA private key, 4096 bit long modulus
................................................................++
..................++
e is 65537 (0x10001)
[root@localhost tls]# ll
總用量 12
-rw-r--r--. 1 root root 3326 12月 3 17:20 ca-key.pem
-rw-r--r--. 1 root root 1765 12月 3 19:03 ca.pem
-rw-r--r--. 1 root root 3243 12月 3 19:03 server-key.pem
# 對私鑰進行簽名
[root@localhost tls]# openssl req -subj "/CN=*" -sha256 -new -key server-key.pem -out server.csr
[root@localhost tls]# ll
總用量 16
-rw-r--r--. 1 root root 3326 12月 3 17:20 ca-key.pem
-rw-r--r--. 1 root root 1765 12月 3 19:03 ca.pem
-rw-r--r--. 1 root root 1574 12月 3 19:04 server.csr
-rw-r--r--. 1 root root 3243 12月 3 19:03 server-key.pem
使用CA證書與私鑰簽名,輸入上面設(shè)置的密碼
[root@localhost tls]# openssl x509 -req -days 1000 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem
Signature ok
subject=/CN=*
Getting CA Private Key
Enter pass phrase for ca-key.pem:
#生成客戶端密鑰
[root@localhost tls]# openssl genrsa -out key.pem 4096
Generating RSA private key, 4096 bit long modulus
....................................................................................................................++
.................................++
e is 65537 (0x10001)
#對客戶端簽名
[root@localhost tls]# openssl req -subj "/CN=client" -new -key key.pem -out client.csr
#創(chuàng)建配置文件
[root@localhost tls]# echo extendedKeyUsage=clientAuth > extfile.cnf
#簽名證書
[root@localhost tls]# openssl x509 -req -days 1000 -sha256 -in client.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf
Signature ok
subject=/CN=client
Getting CA Private Key
Enter pass phrase for ca-key.pem:
[root@localhost tls]# ll
總用量 40
-rw-r--r--. 1 root root 3326 12月 3 17:20 ca-key.pem
-rw-r--r--. 1 root root 1765 12月 3 19:03 ca.pem
-rw-r--r--. 1 root root  17 12月 3 19:35 ca.srl
-rw-r--r--. 1 root root 1696 12月 3 19:35 cert.pem
-rw-r--r--. 1 root root 1582 12月 3 19:29 client.csr
-rw-r--r--. 1 root root  28 12月 3 19:32 extfile.cnf
-rw-r--r--. 1 root root 3243 12月 3 19:08 key.pem
-rw-r--r--. 1 root root 1647 12月 3 19:08 server-cert.pem
-rw-r--r--. 1 root root 1574 12月 3 19:04 server.csr
-rw-r--r--. 1 root root 3243 12月 3 19:03 server-key.pem
# 刪除多余文件
[root@localhost tls]#

在客戶端測試

[root@client ~]# docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem -H tcp://master:2376 version
Client: Docker Engine - Community
 Version:      19.03.13
 API version:    1.40
 Go version:    go1.13.15
 Git commit:    4484c46d9d
 Built:       Wed Sep 16 17:03:45 2020
 OS/Arch:      linux/amd64
 Experimental:   false

Server: Docker Engine - Community
 Engine:
 Version:     19.03.13
 API version:   1.40 (minimum version 1.12)
 Go version:    go1.13.15
 Git commit:    4484c46d9d
 Built:      Wed Sep 16 17:02:21 2020
 OS/Arch:     linux/amd64
 Experimental:   false
 containerd:
 Version:     1.3.9
 GitCommit:    ea765aba0d05254012b0b9e595e995c09186427f
 runc:
 Version:     1.0.0-rc10
 GitCommit:    dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
 Version:     0.18.0
 GitCommit:    fec3683

到此這篇關(guān)于使用TLS加密通訊遠程連接Docker的示例詳解的文章就介紹到這了,更多相關(guān)TLS加密遠程連接Docker內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Windows下Docker安裝各種軟件的詳細過程

    Windows下Docker安裝各種軟件的詳細過程

    這篇文章主要介紹了Windows下Docker安裝各種軟件的詳細過程,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-07-07
  • docker?gitea?drone實現(xiàn)超輕量級CI?CD實戰(zhàn)詳解

    docker?gitea?drone實現(xiàn)超輕量級CI?CD實戰(zhàn)詳解

    這篇文章主要為大家介紹了docker?gitea?drone實現(xiàn)超輕量級CI?CD實戰(zhàn)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2022-10-10
  • Docker快速部署國產(chǎn)達夢數(shù)據(jù)庫的實現(xiàn)示例

    Docker快速部署國產(chǎn)達夢數(shù)據(jù)庫的實現(xiàn)示例

    本文主要介紹了Docker快速部署國產(chǎn)達夢數(shù)據(jù)庫的實現(xiàn)示例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-07-07
  • docker 實現(xiàn)容器與宿主機無縫調(diào)用shell命令

    docker 實現(xiàn)容器與宿主機無縫調(diào)用shell命令

    這篇文章主要介紹了docker 實現(xiàn)容器與宿主機無縫調(diào)用shell命令的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨想過來看看吧
    2021-03-03
  • docker中使用opwrt詳解

    docker中使用opwrt詳解

    本文主要介紹了在Docker中配置OpenWRT的詳細步驟,首先需要配置Docker網(wǎng)絡(luò),包括開啟網(wǎng)卡混雜模式和創(chuàng)建Docker的虛擬網(wǎng)絡(luò);然后需要準(zhǔn)備OpenWRT鏡像,包括獲取相應(yīng)鏡像和解壓導(dǎo)入Docker網(wǎng)絡(luò);接著生成并開啟配置好的容器,修改容器內(nèi)的網(wǎng)絡(luò)設(shè)置
    2024-10-10
  • docker(alpine+golang)?中?hosts?不生效問題解決方法

    docker(alpine+golang)?中?hosts?不生效問題解決方法

    這篇文章主要介紹了docker(alpine+golang)?中?hosts?不生效問題解決大全,本文給大家分享了三種解決方法,每種方法給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-07-07
  • docker安裝tomcat8的實現(xiàn)方法

    docker安裝tomcat8的實現(xiàn)方法

    這篇文章主要介紹了docker安裝tomcat8的實現(xiàn)方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • docker生命周期管理和鏡像管理命令詳解

    docker生命周期管理和鏡像管理命令詳解

    Docker通過容器技術(shù)提供了一種輕量級、快速部署和可移植的應(yīng)用程序運行環(huán)境,極大地簡化了應(yīng)用程序的部署和管理過程,提高了開發(fā)和運維的效率,這篇文章主要介紹了docker生命周期管理和鏡像管理命令,需要的朋友可以參考下
    2023-08-08
  • Docker network自定義網(wǎng)絡(luò)方式

    Docker network自定義網(wǎng)絡(luò)方式

    這篇文章主要介紹了Docker network自定義網(wǎng)絡(luò)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-05-05
  • docker打造Ubuntu20.04 ssh遠程連接鏡像的實現(xiàn)

    docker打造Ubuntu20.04 ssh遠程連接鏡像的實現(xiàn)

    本文主要介紹了docker打造Ubuntu20.04 ssh遠程連接鏡像的實現(xiàn),再也不用電腦上裝了一堆的軟件(mysql、redis、elk等),文中通過示例代碼介紹的非常詳細,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-07-07

最新評論

库尔勒市| 纳雍县| 和龙市| 正安县| 门源| 玉田县| 新河县| 磴口县| 武强县| 同心县| 慈利县| 淄博市| 健康| 云龙县| 石首市| 赤峰市| 旬邑县| 许昌市| 塘沽区| 英山县| 阳高县| 咸丰县| 车致| 临桂县| 晋州市| 泗水县| 礼泉县| 深州市| 常宁市| 西吉县| 五大连池市| 郧西县| 秦安县| 长丰县| 会理县| 三都| 沂水县| 北流市| 察雅县| 手游| 南通市|