2023年1月6日 星期五

Detect if a VM is running in Google Compute Engine

Detect if a VM is running in Compute Engine

sudo dmidecode -s system-product-name | grep "Google Compute Engine"
這個需要 root 權限,實際上是去讀取 /sys/firmware/dmi/tables/DMI
用 strings /sys/firmware/dmi/tables/DMI | grep "Google Compute Engine" 也行

若程式沒有 root 權限,可以去讀取 /etc/hosts 有沒有包含 Added by Google 字樣
grep "Added by Google" /etc/hosts

沒有留言:

Stunnel

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