Import Anubis v1.28.2

Replace the tree with upstream TecharoHQ/anubis v1.28.2 (a1384fbf42e3).
Masyunis customizations are re-applied in the following commits.
This commit is contained in:
sol_bot Bot committed 2026-11-28 14:52:26 +03:00
1 parent eb3e46d8d0
commit e07de898cd
573 files changed
+35846 -6807

No files matched your search

@@ -0,0 +1,42 @@
package naive
import (
"context"
"log/slog"
"os"
"path/filepath"
"testing"
"github.com/TecharoHQ/anubis/lib/config"
"github.com/TecharoHQ/anubis/lib/store/memory"
)
func TestIPLogPermissions(t *testing.T) {
for _, existing := range []bool{false, true} {
t.Run(map[bool]string{false: "new", true: "existing"}[existing], func(t *testing.T) {
path := filepath.Join(t.TempDir(), "ips.log")
if existing {
if err := os.WriteFile(path, []byte("old"), 0644); err != nil {
t.Fatal(err)
}
}
ctx, cancel := context.WithCancel(t.Context())
defer cancel()
i, err := New(&config.Honeypot{IPLogFile: path}, memory.New(ctx), slog.Default())
if err != nil {
t.Fatal(err)
}
defer func() { _ = i.fout.Close() }()
stat, err := os.Stat(path)
if err != nil {
t.Fatal(err)
}
if stat.Size() != 0 {
t.Fatalf("existing contents remain: size=%d", stat.Size())
}
if got := stat.Mode().Perm(); got != 0600 {
t.Fatalf("mode=%o", got)
}
})
}
}