diff --git a/firewall/config.go b/firewall/config.go index 2e283a49..702b6c95 100644 --- a/firewall/config.go +++ b/firewall/config.go @@ -23,6 +23,10 @@ var ( cfgOptionPermanentVerdictsOrder = 96 permanentVerdicts config.BoolOption + CfgOptionDNSQueryInterceptionKey = "filter/dnsQueryInterception" + cfgOptionDNSQueryInterceptionOrder = 97 + dnsQueryInterception config.BoolOption + devMode config.BoolOption apiListenAddress config.StringOption ) @@ -46,6 +50,24 @@ func registerConfig() error { } permanentVerdicts = config.Concurrent.GetAsBool(CfgOptionPermanentVerdictsKey, true) + err = config.Register(&config.Option{ + Name: "Seamless DNS Integration", + Key: CfgOptionDNSQueryInterceptionKey, + Description: "Intercept and redirect astray DNS queries to the Portmaster's internal DNS server. This enables seamless DNS integration without having to configure the system or other software. However, this may lead to compatibility issues with other software that attempts the same.", + OptType: config.OptTypeBool, + ExpertiseLevel: config.ExpertiseLevelDeveloper, + ReleaseLevel: config.ReleaseLevelExperimental, + DefaultValue: true, + Annotations: config.Annotations{ + config.DisplayOrderAnnotation: cfgOptionDNSQueryInterceptionOrder, + config.CategoryAnnotation: "Advanced", + }, + }) + if err != nil { + return err + } + dnsQueryInterception = config.Concurrent.GetAsBool(CfgOptionDNSQueryInterceptionKey, true) + err = config.Register(&config.Option{ Name: "Prompt Desktop Notifications", Key: CfgOptionAskWithSystemNotificationsKey, diff --git a/firewall/filter.go b/firewall/filter.go index cb7dc3aa..58a24737 100644 --- a/firewall/filter.go +++ b/firewall/filter.go @@ -4,8 +4,6 @@ import ( "github.com/safing/portbase/config" "github.com/safing/portbase/modules" "github.com/safing/portbase/modules/subsystems" - - // Dependency. _ "github.com/safing/portmaster/core" "github.com/safing/spn/captain" ) diff --git a/firewall/interception.go b/firewall/interception.go index 25e0354b..ed582ba1 100644 --- a/firewall/interception.go +++ b/firewall/interception.go @@ -16,8 +16,6 @@ import ( "github.com/safing/portbase/log" "github.com/safing/portbase/modules" "github.com/safing/portmaster/compat" - - // Dependency. _ "github.com/safing/portmaster/core/base" "github.com/safing/portmaster/firewall/inspection" "github.com/safing/portmaster/firewall/interception" @@ -332,8 +330,9 @@ func initialHandler(conn *network.Connection, pkt packet.Packet) { conn.Accept("connection by Portmaster", noReasonOptionKey) conn.Internal = true - // Redirect outbound DNS packests, - case pkt.IsOutbound() && + // Redirect outbound DNS packets if enabled, + case dnsQueryInterception() && + pkt.IsOutbound() && pkt.Info().DstPort == 53 && // that don't match the address of our nameserver, nameserverIPMatcherReady.IsSet() && @@ -341,7 +340,7 @@ func initialHandler(conn *network.Connection, pkt packet.Packet) { // and are not broadcast queries by us. // Context: // - Unicast queries by the resolver are pre-authenticated. - // - Unicast qeries by the compat self-check should be redirected. + // - Unicast queries by the compat self-check should be redirected. !(conn.Process().Pid == ownPID && conn.Entity.IPScope == netutils.LocalMulticast): diff --git a/go.mod b/go.mod index cff7a842..b128b856 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/safing/portmaster -go 1.15 +go 1.18 require ( github.com/agext/levenshtein v1.2.3