Custom filter list:

subdomain and cname cheks
Automatic realod when settings is changed
periodicly check for file changes
This commit is contained in:
Vladimir Stoilov
2022-07-26 17:18:58 +02:00
committed by Daniel
parent 35697989e5
commit 62c100714a
5 changed files with 126 additions and 16 deletions

View File

@@ -616,14 +616,24 @@ matchLoop:
}
func checkCustomFilterList(_ context.Context, conn *network.Connection, p *profile.LayeredProfile, _ packet.Packet) bool {
// block if the domain name appears in the custom filter list
// block if the domain name appears in the custom filter list (check for subdomains if enabled)
if conn.Entity.Domain != "" {
if customlists.LookupDomain(conn.Entity.Domain) {
if customlists.LookupDomain(conn.Entity.Domain, p.FilterSubDomains()) {
conn.Block("Domains appears in the custom user list", customlists.CfgOptionCustomListBlockingKey)
return true
}
}
// block if any of the CNAME appears in the custom filter list (check for subdomains if enabled)
if len(conn.Entity.CNAME) > 0 && p.FilterCNAMEs() {
for _, cname := range conn.Entity.CNAME {
if customlists.LookupDomain(cname, p.FilterSubDomains()) {
conn.Block("CNAME appears in the custom user list", customlists.CfgOptionCustomListBlockingKey)
return true
}
}
}
// block if ip addresses appears in the custom filter list
if conn.Entity.IP != nil {
if customlists.LookupIP(&conn.Entity.IP) {