Improve secure DNS bypass notification
This commit is contained in:
@@ -42,9 +42,10 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
secureDNSBypassIssue = &appIssue{
|
secureDNSBypassIssue = &appIssue{
|
||||||
id: "compat:secure-dns-bypass-%s",
|
id: "compat:secure-dns-bypass-%s",
|
||||||
title: "Detected %s Bypass Attempt",
|
title: "Detected %s Bypass Attempt",
|
||||||
message: "Portmaster detected that %s is trying to use a secure DNS resolver. While this is a good thing, the Portmaster already handles secure DNS for your whole device. Please disable the secure DNS resolver within the app.",
|
message: `%s is bypassing Portmaster's firewall functions through its Secure DNS resolver. Portmaster can no longer protect or filter connections coming from %s. Disable Secure DNS within %s to restore functionality.
|
||||||
|
Rest assured that Portmaster already handles Secure DNS for your whole device.`,
|
||||||
// TODO: Add this when the new docs page is finished:
|
// TODO: Add this when the new docs page is finished:
|
||||||
// , or [find out about other options](link to new docs page)
|
// , or [find out about other options](link to new docs page)
|
||||||
level: notifications.Warning,
|
level: notifications.Warning,
|
||||||
@@ -123,6 +124,13 @@ func (issue *appIssue) notify(proc *process.Process) {
|
|||||||
proc.Path,
|
proc.Path,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Build message.
|
||||||
|
messageAppNameReplaces := make([]interface{}, strings.Count(issue.message, "%s"))
|
||||||
|
for i := range messageAppNameReplaces {
|
||||||
|
messageAppNameReplaces[i] = p.Name
|
||||||
|
}
|
||||||
|
message := fmt.Sprintf(issue.message, messageAppNameReplaces...)
|
||||||
|
|
||||||
// Check if we already have this notification.
|
// Check if we already have this notification.
|
||||||
eventID := fmt.Sprintf(issue.id, p.ID)
|
eventID := fmt.Sprintf(issue.id, p.ID)
|
||||||
n := notifications.Get(eventID)
|
n := notifications.Get(eventID)
|
||||||
@@ -135,7 +143,7 @@ func (issue *appIssue) notify(proc *process.Process) {
|
|||||||
EventID: eventID,
|
EventID: eventID,
|
||||||
Type: issue.level,
|
Type: issue.level,
|
||||||
Title: fmt.Sprintf(issue.title, p.Name),
|
Title: fmt.Sprintf(issue.title, p.Name),
|
||||||
Message: fmt.Sprintf(issue.message, p.Name),
|
Message: message,
|
||||||
ShowOnSystem: true,
|
ShowOnSystem: true,
|
||||||
AvailableActions: []*notifications.Action{
|
AvailableActions: []*notifications.Action{
|
||||||
{
|
{
|
||||||
@@ -154,9 +162,8 @@ func (issue *appIssue) notify(proc *process.Process) {
|
|||||||
p.Lock()
|
p.Lock()
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
warningMsg := fmt.Sprintf(issue.message, p.Name)
|
if p.Warning != message || time.Now().Add(-1*time.Hour).After(p.WarningLastUpdated) {
|
||||||
if p.Warning != warningMsg || time.Now().Add(-1*time.Hour).After(p.WarningLastUpdated) {
|
p.Warning = message
|
||||||
p.Warning = warningMsg
|
|
||||||
p.WarningLastUpdated = time.Now()
|
p.WarningLastUpdated = time.Now()
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user