2024年4月21日 星期日

Stunnel

Stunnel 有點像 SSH tunnel,可以建立加密通道
原本未加密的協議,讓它走 Stunnel,就可以達到不改變協議,數據有加密的效果
以下用一個實例說明:

A 要 telnet B,IP 12.34.56.78,因 telnet 協議本身未加密,
若要讓 A 到 B 的傳輸數據加密,此時就可以用 Stunnel

建立憑證
cd /etc/stunnel
openssl req -new -x509 -days 9999 -nodes -out stunnel.pem -keyout stunnel.key
把 stunnel.pem 及 stunnel.key copy 到另一台

A 要配置 Stunnel client
/etc/stunnel/stunnel.conf 內容如下
cert = /etc/stunnel/stunnel.pem
key = /etc/stunnel/stunnel.key
client = yes

[telnet]
accept = 23
connect = 12.34.56.78:2323

B 要配置 Stunnel server
/etc/stunnel/stunnel.conf 內容如下
cert = /etc/stunnel/stunnel.pem
key = /etc/stunnel/stunnel.key
client = no

[telnet]
accept = 2323
connect = 127.0.0.1:23

配置後兩邊啟動服務
systemctl enable stunnel --now

在 A 就可以 telnet localhost (取代直連 telnet 12.34.56.78),
然後封包加密,送到 12.34.56.78:2323,
B 收到封包後解密,再送給 localhost:23

沒有留言:

Update ESXi to 8.0.3d using depot file

本例是從 8.0U3 升到 8.0U3d,若從更舊的版本升級,不確定是否適用 先把所有 VM 關機,進入維護模式 把 depot 升級檔 VMware-ESXi-8.0U3d-24585383-depot.zip 放到機器內 ssh ESXi 先查看 depot 有那些 Prof...