feat: add simple setup func to blockerengine, fix init and db, version for realease v0.2.0
All checks were successful
CD - BanForge Release / release (push) Successful in 20s
CI.yml / build (push) Successful in 2m1s
CD - BanForge Release / build (amd64, linux) (push) Successful in 3m3s
CD - BanForge Release / build (arm64, linux) (push) Successful in 2m52s

This commit is contained in:
d3m0k1d
2026-01-15 19:14:44 +03:00
parent bbb152dfb8
commit 1603fbee35
6 changed files with 53 additions and 1 deletions

View File

@@ -55,3 +55,28 @@ func (u *Ufw) Unban(ip string) error {
u.logger.Info("IP unbanned", "ip", ip, "output", string(output))
return nil
}
func (u *Ufw) Setup(config string) error {
if config != "" {
fmt.Printf("Ufw dont support config file\n")
cmd := exec.Command("sudo", "ufw", "enable")
output, err := cmd.CombinedOutput()
if err != nil {
u.logger.Error("failed to enable ufw",
"error", err.Error(),
"output", string(output))
return fmt.Errorf("failed to enable ufw: %w", err)
}
}
if config == "" {
cmd := exec.Command("sudo", "ufw", "enable")
output, err := cmd.CombinedOutput()
if err != nil {
u.logger.Error("failed to enable ufw",
"error", err.Error(),
"output", string(output))
return fmt.Errorf("failed to enable ufw: %w", err)
}
}
return nil
}