亚欧色一区w666天堂,色情一区二区三区免费看,少妇特黄A片一区二区三区,亚洲人成网站999久久久综合,国产av熟女一区二区三区

  • 發布文章
  • 消息中心
點贊
收藏
評論
分享
原(yuan)創

trino https配置與連接詳解

2023-06-28 04:25:57
754
0

1.概述

trino默(mo)認的(de)jdbc,cli及(ji)web ui等客戶(hu)端均封裝的(de)是http協議,且(qie)無(wu)法使用(yong)密碼,即非安全鏈(lian)接,如下圖所示:

如果(guo)這個時候傳輸密碼(ma)(ma)到(dao)服務端(duan)(duan),會(hui)拋(pao)出Authentication over HTTP is not enabled 異常(chang),當然(ran)也可以(yi)修改(gai)源碼(ma)(ma)支持http+密碼(ma)(ma)的(de)方式訪問trino,但(dan)是(shi)稍微復(fu)雜一些(xie),服務端(duan)(duan)和(he)客戶端(duan)(duan)都需要改(gai)造,如果(guo)是(shi)外接的(de)系統比(bi)如BI就比(bi)較麻煩(fan)。在不(bu)修改(gai)源碼(ma)(ma)的(de)情況(kuang)下,如果(guo)想要使用用戶名+密碼(ma)(ma)的(de)方式訪問trino, 那就必須啟用https。

非安(an)全鏈接配置比較(jiao)簡單(dan)可參(can)考trino官網,下面我們探討一下trino https鏈接

2.https 鏈接

trino支持三種(zhong)方式的https鏈接,分別是(shi):通過代理服(fu)務https訪問trino,  基于私有證(zheng)書的https,基于通用證(zheng)書的https

2.1通過代理服務https訪問trino

這是(shi)官方最推(tui)薦的方式,只需要在coordinator config.properties加如下(xia)配(pei)置:

http-server.process-forwarded=true

然后即可通過前端(duan)(duan)的(de)(de)(de)負載均衡或者代理服務訪問(wen)后端(duan)(duan)的(de)(de)(de)trino coordinator, 這個時候trino coordinator不需(xu)要配(pei)(pei)置(zhi)https,還是默認的(de)(de)(de)http配(pei)(pei)置(zhi),只需(xu)要前端(duan)(duan)的(de)(de)(de)代理https是基于(yu)通用證書即可,客戶(hu)端(duan)(duan)訪問(wen)代理的(de)(de)(de)https接口將信息(xi)轉發到后端(duan)(duan)的(de)(de)(de)trino server,如下圖(tu)所(suo)示:

2.2 基于私有證書的https

一般(ban)生(sheng)產環境也(ye)會使用(yong)這種方式,需(xu)要(yao)自己生(sheng)成證(zheng)書

1.生成證書:

keytool -genkeypair -validity 36500 -ext SAN=IP:${trino_server_ip} -alias trino -keypass ${password} -storepass ${password} -keyalg RSA -dname CN=${trino_server_ip},OU=,O=,L=,ST=,C= -keystore trino.jks
 
keytool -export -rfc -keystore trino.jks --alias trino -file trino.pem
 
2.trino服務端配置:
 
http-server.https.enabled=true
http-server.https.port=8443
http-server.https.keystore.path=etc/trino.jks
http-server.https.keystore.key=${password}
http-server.authentication.type=password
 
默認開啟https后,還需要配置trino集群內部的安全通信密鑰,所以我重新優化了這個功能,這樣集群內部節點之間使用http方式通信即可,無需配置密鑰。
 
 
3.生成密碼文件(也可使用LDAP)
touch password.db
htpasswd -B -C 10 password.db trino
然后輸入密碼即可
 
4.客戶端配置,以cli為例
trino-cli-406-executable.jar --server //{trino_coordinator_ip}:8443  --catalog hive --truststore-path trino.pem --user trino --password
 
需要在客戶端指定證書位置,同理jdbc方式也需要指定證書
 
這種方式的弊端就是如果客戶端是第三方工具就很麻煩,一般需要對第三方工具進行改造從而才能讀到我們提供的證書。
 
 

2.3 基于通用證書的https

需要(yao)申請通(tong)(tong)(tong)(tong)用(yong)證(zheng)書(shu),trino使用(yong)通(tong)(tong)(tong)(tong)用(yong)證(zheng)書(shu)的配(pei)置(zhi)方(fang)(fang)法(fa)和2.2一(yi)樣,但是通(tong)(tong)(tong)(tong)用(yong)證(zheng)書(shu)一(yi)般(ban)有時間(jian)期限,超時需要(yao)重新申請,通(tong)(tong)(tong)(tong)用(yong)證(zheng)書(shu)支持(chi)所有形式的客戶端和瀏覽器的https連接,無需對客戶端做額外配(pei)置(zhi),也是官方(fang)(fang)比(bi)較推(tui)薦的。

申請鏈接:

//letsencrypt.org/

//www.sslforfree.com/

 

 

 

0條評論
0 / 1000
yx_knight
5文章數(shu)
0粉絲數(shu)
yx_knight
5 文章 | 0 粉絲(si)
原創

trino https配置與連接詳解

2023-06-28 04:25:57
754
0

1.概述

trino默認(ren)的(de)jdbc,cli及(ji)web ui等客戶(hu)端(duan)均封裝(zhuang)的(de)是http協議,且無(wu)法使用(yong)密碼,即非安全鏈(lian)接,如下圖所示:

如(ru)(ru)(ru)果(guo)(guo)這個(ge)時候傳(chuan)輸密(mi)碼(ma)到服務端,會拋出Authentication over HTTP is not enabled 異常(chang),當然也可(ke)以修(xiu)改(gai)源碼(ma)支(zhi)持(chi)http+密(mi)碼(ma)的方式訪(fang)問(wen)trino,但是稍微復雜(za)一些,服務端和客戶端都(dou)需要改(gai)造(zao),如(ru)(ru)(ru)果(guo)(guo)是外接的系統(tong)比如(ru)(ru)(ru)BI就比較(jiao)麻煩。在(zai)不修(xiu)改(gai)源碼(ma)的情況下,如(ru)(ru)(ru)果(guo)(guo)想要使用(yong)(yong)用(yong)(yong)戶名+密(mi)碼(ma)的方式訪(fang)問(wen)trino, 那就必須啟用(yong)(yong)https。

非安(an)全鏈(lian)接(jie)配置比(bi)較簡單可參(can)考trino官(guan)網(wang),下(xia)(xia)面我們(men)探討(tao)一下(xia)(xia)trino https鏈(lian)接(jie)

2.https 鏈接

trino支(zhi)持三種方式(shi)的(de)https鏈接,分別是:通過代理服務https訪問trino,  基于(yu)私有(you)證書的(de)https,基于(yu)通用證書的(de)https

2.1通過代理服務https訪問trino

這是官(guan)方(fang)最推薦的方(fang)式,只(zhi)需要在coordinator config.properties加如下配(pei)置:

http-server.process-forwarded=true

然后即可(ke)通過前端(duan)(duan)的負載均衡或(huo)者代理(li)(li)服務訪問(wen)后端(duan)(duan)的trino coordinator, 這個時候(hou)trino coordinator不需要配置https,還是默認的http配置,只需要前端(duan)(duan)的代理(li)(li)https是基(ji)于(yu)通用證書即可(ke),客戶端(duan)(duan)訪問(wen)代理(li)(li)的https接口將信息轉發(fa)到后端(duan)(duan)的trino server,如(ru)下圖所(suo)示(shi):

2.2 基于私有證書的https

一(yi)般生(sheng)產(chan)環境也(ye)會使用這種方(fang)式,需要自己(ji)生(sheng)成證書(shu)

1.生成證書:

keytool -genkeypair -validity 36500 -ext SAN=IP:${trino_server_ip} -alias trino -keypass ${password} -storepass ${password} -keyalg RSA -dname CN=${trino_server_ip},OU=,O=,L=,ST=,C= -keystore trino.jks
 
keytool -export -rfc -keystore trino.jks --alias trino -file trino.pem
 
2.trino服務端配置:
 
http-server.https.enabled=true
http-server.https.port=8443
http-server.https.keystore.path=etc/trino.jks
http-server.https.keystore.key=${password}
http-server.authentication.type=password
 
默認開啟https后,還需要配置trino集群內部的安全通信密鑰,所以我重新優化了這個功能,這樣集群內部節點之間使用http方式通信即可,無需配置密鑰。
 
 
3.生成密碼文件(也可使用LDAP)
touch password.db
htpasswd -B -C 10 password.db trino
然后輸入密碼即可
 
4.客戶端配置,以cli為例
trino-cli-406-executable.jar --server //{trino_coordinator_ip}:8443  --catalog hive --truststore-path trino.pem --user trino --password
 
需要在客戶端指定證書位置,同理jdbc方式也需要指定證書
 
這種方式的弊端就是如果客戶端是第三方工具就很麻煩,一般需要對第三方工具進行改造從而才能讀到我們提供的證書。
 
 

2.3 基于通用證書的https

需(xu)要(yao)申請(qing)通用(yong)(yong)證書,trino使用(yong)(yong)通用(yong)(yong)證書的(de)配置方法(fa)和2.2一(yi)樣(yang),但是(shi)通用(yong)(yong)證書一(yi)般有時間期限,超時需(xu)要(yao)重新(xin)申請(qing),通用(yong)(yong)證書支持所有形(xing)式的(de)客戶端和瀏(liu)覽器的(de)https連(lian)接(jie),無需(xu)對客戶端做(zuo)額外配置,也是(shi)官方比較推薦的(de)。

申請鏈接:

//letsencrypt.org/

//www.sslforfree.com/

 

 

 

文章來自個人專欄
文章 | 訂閱
0條評論
0 / 1000
請輸入你的評論
0
0