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

沒有留言:

Windows 10 ESU extended to 2027-10-12

微軟延長了 Windows 10 ESU 支援時間至 2027-10-12 (又加一年) 可以使用 ConsumerESU 腳本快速啟用 ESU 下載 ZIP 包解開後,以系統管理員身分執行 Consumer_ESU_Enrollment_run.cmd