diff --git a/CHANGELOG.md b/CHANGELOG.md index db532b5..8408011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio ## [Unreleased] +## [1.4.7] - 2026-11-15 + +### Fixed + +- The unban file now defaults to `unban.log` next to `--enforce-log` (the default was lost, so the Unban button reported the file as not writable). +- Second firewall: the 24 h rules also count from the persistent day counters, so they work when the event registry does not cover the whole day (after a reset or upgrade). + ## [1.4.6] - 2026-11-15 ### Added diff --git a/CHANGELOG.pt-BR.md b/CHANGELOG.pt-BR.md index 7c12c62..479e70a 100644 --- a/CHANGELOG.pt-BR.md +++ b/CHANGELOG.pt-BR.md @@ -6,6 +6,13 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/); ## [Unreleased] +## [1.4.7] - 2026-11-15 + +### Corrigido + +- O arquivo de desban agora tem como padrão `unban.log` ao lado de `--enforce-log` (o padrão se perdia, e o botão Desbanir dizia que o arquivo não era gravável). +- Segundo firewall: as regras de 24 h também contam pelos contadores diários persistentes, então funcionam quando o registro de eventos não cobre o dia inteiro (após um reset ou atualização). + ## [1.4.6] - 2026-11-15 ### Adicionado diff --git a/internal/app/enforce.go b/internal/app/enforce.go index 2e0645f..27d9b86 100644 --- a/internal/app/enforce.go +++ b/internal/app/enforce.go @@ -35,7 +35,7 @@ func newEnforce(c Config, st *store.Store, peers []fed.Peer, en enricher, ready } } e := enforce.New(enforce.Config{ - Mode: mode, Path: c.EnforceLog, UnbanPath: c.EnforceUnbanLog, StatePath: filepath.Join(c.DataDir, "enforce.json"), Host: c.Name, + Mode: mode, Path: c.EnforceLog, UnbanPath: unbanLogPath(c), StatePath: filepath.Join(c.DataDir, "enforce.json"), Host: c.Name, Threshold: c.EnforceThreshold, MaxPerMin: c.EnforceMaxPerMin, Share: strings.EqualFold(c.EnforceShare, "on"), Trusted: trusted, PeerHosts: hosts, InfraHosts: hosts, Resolve: resolveHost, Crawler: func(ip string, uas []string) bool { v := st.FCrDNS(ip, uas); return v != nil && *v }, @@ -192,3 +192,14 @@ func cloudflareClients(path string) (cf, total int) { } return cf, total } + +// unbanLogPath is --enforce-unban-log, or unban.log next to --enforce-log. +func unbanLogPath(c Config) string { + if c.EnforceUnbanLog != "" { + return c.EnforceUnbanLog + } + if c.EnforceLog == "" { + return "" + } + return filepath.Join(filepath.Dir(c.EnforceLog), "unban.log") +} diff --git a/internal/app/v4_test.go b/internal/app/v4_test.go index 722de9d..e91eb75 100644 --- a/internal/app/v4_test.go +++ b/internal/app/v4_test.go @@ -279,3 +279,12 @@ func TestSourceDegradedWindow(t *testing.T) { t.Fatal("window must recover") } } + +func TestUnbanLogPathDefault(t *testing.T) { + if got := unbanLogPath(Config{EnforceLog: "/logs/enforce/decisions.log"}); got != "/logs/enforce/unban.log" { + t.Fatalf("default unban log = %q", got) + } + if got := unbanLogPath(Config{EnforceLog: "/a/d.log", EnforceUnbanLog: "/b/u.log"}); got != "/b/u.log" { + t.Fatalf("explicit unban log = %q", got) + } +} diff --git a/internal/app/version.go b/internal/app/version.go index 79b2380..c307b69 100644 --- a/internal/app/version.go +++ b/internal/app/version.go @@ -2,4 +2,4 @@ package app // Version is the release version (SemVer). Release builds may override it with // -ldflags "-X .../internal/app.Version=...". -var Version = "1.4.6" +var Version = "1.4.7"