Improve captive portal handling

This commit is contained in:
Daniel
2020-07-15 08:53:55 +02:00
parent ec637bdce8
commit e369a9484a
13 changed files with 323 additions and 31 deletions

View File

@@ -7,6 +7,8 @@ import (
"path/filepath"
"strings"
"github.com/safing/portmaster/netenv"
"github.com/safing/portbase/log"
"github.com/safing/portmaster/network"
"github.com/safing/portmaster/network/netutils"
@@ -50,6 +52,7 @@ func DecideOnConnection(ctx context.Context, conn *network.Connection, pkt packe
checkSelfCommunication,
checkProfileExists,
checkConnectionType,
checkCaptivePortal,
checkConnectionScope,
checkEndpointLists,
checkBypassPrevention,
@@ -178,6 +181,16 @@ func checkConnectionType(ctx context.Context, conn *network.Connection, _ packet
return false
}
func checkCaptivePortal(_ context.Context, conn *network.Connection, _ packet.Packet) bool {
if netenv.GetOnlineStatus() == netenv.StatusPortal &&
conn.Entity.Domain == netenv.GetCaptivePortal().Domain {
conn.Accept("captive portal access permitted")
return true
}
return false
}
func checkConnectionScope(_ context.Context, conn *network.Connection, _ packet.Packet) bool {
p := conn.Process().Profile()