Skip to content

Commit

Permalink
honor remote_allow_ilst in hole punch response
Browse files Browse the repository at this point in the history
When we receive a "hole punch notification" from a Lighthouse, we send
a hole punch packet to every remote of that host, even if we don't
include those remotes in our "remote_allow_list". Change the logic here
to check if the remote IP is in our allow list before sending the hole
punch packet.
  • Loading branch information
wadey committed Jul 23, 2024
1 parent e6009b8 commit 1170ff1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lighthouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -1125,12 +1125,18 @@ func (lhh *LightHouseHandler) handleHostPunchNotification(n *NebulaMeta, vpnIp i
}
}

remoteVpnIp := iputil.VpnIp(n.Details.VpnIp)
remoteAllowList := lhh.lh.GetRemoteAllowList()
for _, a := range n.Details.Ip4AndPorts {
punch(NewUDPAddrFromLH4(a))
if remoteAllowList.AllowIpV4(remoteVpnIp, iputil.VpnIp(a.Ip)) {
punch(NewUDPAddrFromLH4(a))
}
}

for _, a := range n.Details.Ip6AndPorts {
punch(NewUDPAddrFromLH6(a))
if remoteAllowList.AllowIpV6(remoteVpnIp, a.Hi, a.Lo) {
punch(NewUDPAddrFromLH6(a))
}
}

// This sends a nebula test packet to the host trying to contact us. In the case
Expand Down

0 comments on commit 1170ff1

Please sign in to comment.