Score:0

Redirect TLS traffic by hostname

cn flag

I have an IoT device that connects to a.iot.x.amazonaws.com at port 8883 (secure MQTT). I would instead like it to connect to my own site at b.iot.x.amazonaws.com (same port and protocol). I would like to use network tools to redirect the traffic. I do not wish to replace the firmware on the IoT device. I am using a site on the same subdomain (iot.x) to avoid TLS issues, since the certificate AWS provides covers the whole iot.x subdomain.

My trouble is, I think both domains resolve to the same IP addresses, so I can't simply use the hosts file in my OpenWRT router to redirect traffic. Shared hosting would mean that the site it connects to is determined by the domain name, not the IP address alone.

Is modifying the domain name during the connection request enough to accomplish this? Is there a tool available to do this?

Score:1
se flag

Distinguishing between different domains on the same IP address is done using the server_name extension (SNI) in the TLS handshake. Changing this information by some man-in-the-middle would lead to a failing integrity check over the TLS handshake, causing the handshake to fail. This means that this kind of approach is not possible.

cn flag
I thought the SNI extension was sent before any encryption happens, in the "client hello" packet. Where does the integrity check happen?
Steffen Ullrich avatar
se flag
@user1924347: True, the SNI extension is sent in clear during the ClientHello (unless ESNI is used). But, the integrity check is done over all messages of the handshake, including ClientHello and thus including SNI.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.