在 EC2 上面疊 IPsec

AWS 發了一篇關於在 EC2 上面疊 IPsec 的方式:「Creating an opportunistic IPSec mesh between EC2 instances」。

這個需求主要是因為 AWS 一直沒有保證在同一區的流量有加密 (包括了同一個機房的流量、同一個 AZ 但不同機房的流量,以及同一區跨 AZ 之間的流量),甚至跨帳號間的 VPC Peering 都不保證有加密,只說「跟兩台 instance 之間的溝通相同」,用詞很小心 (參考「Amazon VPC FAQs」這邊的說明):

Q. Is VPC peering traffic within the region encrypted?

No. Traffic between instances in peered VPCs remains private and isolated – similar to how traffic between two instances in the same VPC is private and isolated.

目前唯一有保證的是跨區的 Inter-Region VPC Peering 服務有加密:

Q. Is Inter-Region VPC Peering traffic encrypted?

Traffic is encrypted using modern AEAD (Authenticated Encryption with Associated Data) algorithms. Key agreement and key management is handled by AWS.

在 2013 年 Snowden 揭露的消息可以知道 GoogleYahoo! 的機房都被 NSA 盯上,截聽內部跨機房的流量:「How we know the NSA had access to internal Google and Yahoo cloud data」。

沒什麼道理 AWS 的就不被盯上,所以對於高度敏感的應用來說,還是會希望在 AWS 能對於離開建築物的流量提供加密。

但在這之前,只能透過自己補上加密機制來解決,也就是這篇在 EC2 上面疊 IPsec overlay network 的前提。

可以在文章裡看到使用了不少 AWS 自家的服務,避免需要自己架設 server 管理 (得自己處理 High Availability 的問題)。

裡面主要是用了 KMS 存放憑證,以及使用 Lambda 發每一台 EC2 instance 所需要的金鑰,這兩個都是直接拿 AWS 的服務,就省下不少事情了。

Leave a Reply

Your email address will not be published. Required fields are marked *