Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Elide PSL wildcard records from purge set
Browse files Browse the repository at this point in the history
Prevent records for "_psl.$BASE" from being deleted.

Signed-off-by: Nick Hale <[email protected]>
  • Loading branch information
njhale committed Sep 7, 2023
1 parent 39afca9 commit 983f603
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/backend/purger.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ func (b *backend) purge() {
return
}

// Elide records for "local" FQDNs, these won't exist in the database but shouldn't be deleted.
localSuffix := ".local." + b.baseDomain
// Ensure we don't remove records with the following suffixes.
exceptionSuffixes := []string{
".local." + b.baseDomain, // "local" FQDNs
"_psl." + b.baseDomain, // public suffix list
}
for pair := range recordsToDelete {
if strings.HasSuffix(pair.FQDN, localSuffix) {
delete(recordsToDelete, pair)
for _, exception := range exceptionSuffixes {
if strings.HasSuffix(pair.FQDN, exception) {
delete(recordsToDelete, pair)
}
}
}

Expand Down

0 comments on commit 983f603

Please sign in to comment.