-
Couldn't load subscription status.
- Fork 770
Description
Hi. I have a Homeassistant (HA) installation using go2rtc for cameras. This HA is exposed to the Internet with SSL but behind a firewall with the main HA port opened for access. All of that is working just fine.
When I connect to the HA instance from the HA Android app while on the Internet, everything in the app works. I see camera feeds, etc., but while I am connected from my Android phone, while on the Internet (and everything is working fine), the firewall that this HA is behind is logging a massive amount of UDP connections on random ports (>~33000) being sent between the Android phone and HA. Wireshark is telling me these are STUN requests.
Beyond those STUN requests on random UDP ports I do also see HA making (a different kind of) STUN requests to a few AWS hosts on ports 80 and 3478. These requests do get responses, describing the NAT situation that HA is behind
ec2-23-21-77-118.compute-1.amazonaws.com 62e48b77f6b84952809968f5188afb55.local STUN Binding Success Response XOR-MAPPED-ADDRESS: [redacted]:39166 MAPPED-ADDRESS: [redacted]:39166 RESPONSE-ORIGIN: 34.237.188.15:3478
I suspect these requests and responses are what are actually making the camera feeds functional between HA and the Android phone.
The barrage of the other kinds of STUN requests (none of which ever get any responses) from the Android phone to the HA address look like:
Frame 491274: 154 bytes on wire (1232 bits), 154 bytes captured (1232 bits) on interface gw:eth0.2, id 1
Ethernet II, Src: 4c:42:1e:3b:d0:19, Dst: 6c:b0:ce:f5:1e:4b
Internet Protocol Version 4, Src: [Android HA app address redacted] ([Android HA app address redacted]), Dst: [HA's public IP address redacted] ([HA's public IP address redacted])
User Datagram Protocol, Src Port: 63389 (63389), Dst Port: 44884 (44884)
Session Traversal Utilities for NAT
Message Type: 0x0001 (Binding Request)
.... ...0 ...0 .... = Message Class: 0x00 Request (0)
..00 000. 000. 0001 = Message Method: 0x0001 Binding (0x001)
..0. .... .... .... = Message Method Assignment: IETF Review (0x0)
Message Length: 92
Message Cookie: 2112a442
Message Transaction ID: 666c6475356f414f4955664b
[STUN Network Version: RFC-5389/8489 (3)]
Attributes
USERNAME: EsjgLMmhzXQJPWbP:mfPZ
Attribute Type: USERNAME
0... .... .... .... = Attribute Type Comprehension: Required (0x0)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 21
Username: EsjgLMmhzXQJPWbP:mfPZ
Padding: 3
GOOG-NETWORK-INFO
Attribute Type: GOOG-NETWORK-INFO
1... .... .... .... = Attribute Type Comprehension: Optional (0x1)
.1.. .... .... .... = Attribute Type Assignment: Designated Expert (0x1)
Attribute Length: 4
Google Network ID: 0
Google Network Cost: Max (999)
ICE-CONTROLLING
Attribute Type: ICE-CONTROLLING
1... .... .... .... = Attribute Type Comprehension: Optional (0x1)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 8
Tie breaker: 68c0d0c5f29a0537
USE-CANDIDATE
Attribute Type: USE-CANDIDATE
0... .... .... .... = Attribute Type Comprehension: Required (0x0)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 0
PRIORITY
Attribute Type: PRIORITY
0... .... .... .... = Attribute Type Comprehension: Required (0x0)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 4
Priority: 1845501695
MESSAGE-INTEGRITY
Attribute Type: MESSAGE-INTEGRITY
0... .... .... .... = Attribute Type Comprehension: Required (0x0)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 20
HMAC-SHA1: 038ed2014e8a5f4b6bf25abe456fcbd5bbf3522f
FINGERPRINT
Attribute Type: FINGERPRINT
1... .... .... .... = Attribute Type Comprehension: Optional (0x1)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 4
CRC-32: 0xc707649b [correct]
[CRC-32 Status: Good]
And similarly, HA also sends such unresponded requests:
Frame 481795: 142 bytes on wire (1136 bits), 142 bytes captured (1136 bits) on interface gw:eth0.2, id 1
Ethernet II, Src: 6c:b0:ce:f5:1e:4b, Dst: 4c:42:1e:3b:d0:19
Internet Protocol Version 4, Src: [HA's public IP address redacted] ([HA's public IP address redacted]), Dst: [Android HA app address redacted] ([Android HA app address redacted])
User Datagram Protocol, Src Port: 43173 (43173), Dst Port: 36642 (36642)
Session Traversal Utilities for NAT
Message Type: 0x0001 (Binding Request)
.... ...0 ...0 .... = Message Class: 0x00 Request (0)
..00 000. 000. 0001 = Message Method: 0x0001 Binding (0x001)
..0. .... .... .... = Message Method Assignment: IETF Review (0x0)
Message Length: 80
Message Cookie: 2112a442
Message Transaction ID: dabdfdfe74e9fef50b0a471b
[STUN Network Version: RFC-5389/8489 (3)]
Attributes
USERNAME: WVuw:mBgyoUTKOzXuOPks
Attribute Type: USERNAME
0... .... .... .... = Attribute Type Comprehension: Required (0x0)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 21
Username: WVuw:mBgyoUTKOzXuOPks
Padding: 3
ICE-CONTROLLED
Attribute Type: ICE-CONTROLLED
1... .... .... .... = Attribute Type Comprehension: Optional (0x1)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 8
Tie breaker: 806fff457b712d6b
PRIORITY
Attribute Type: PRIORITY
0... .... .... .... = Attribute Type Comprehension: Required (0x0)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 4
Priority: 1694498815
MESSAGE-INTEGRITY
Attribute Type: MESSAGE-INTEGRITY
0... .... .... .... = Attribute Type Comprehension: Required (0x0)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 20
HMAC-SHA1: 88af451e1687eb9f2206f60901f79892733a5042
FINGERPRINT
Attribute Type: FINGERPRINT
1... .... .... .... = Attribute Type Comprehension: Optional (0x1)
.0.. .... .... .... = Attribute Type Assignment: IETF Review (0x0)
Attribute Length: 4
CRC-32: 0xf823590d [correct]
[CRC-32 Status: Good]
Clearly given that neither of these are being responded to nor permitted through the firewall, they are no necessary. They are just leading to a lot of noise in the firewall logs as well as blocking of the remote/mobile users due to their activity looking like they are aggressively trying to attack the network behind the firewall.
Are these particular STUN probes necessary and if not, can they be disabled?