Pro-Domain-Flag crowdsec_trusted (Migration 0048). Ist es gesetzt, rendert der neue crowdsec-whitelist-Generator den Hostname host-genau in /etc/crowdsec/parsers/s02-enrich/edgeguard-admin-hosts-whitelist.yaml (evt.Parsed.http_host) und reloadet crowdsec. Löst das Problem, dass Admin-SPAs (viele /api/-Requests pro Aktion) http-crawl-non_statics triggern und die Admin-IP bannen — jetzt im Frontend steuerbar statt manueller Node-Datei. - Generator internal/crowdsec/whitelist.go (configgen.Generator, no-op ohne CrowdSec), registriert in edgeguard-ctl render-config + in den Domains-Reloader komponiert (Domain-Edit → Whitelist re-render). Aus der replizierten DB gerendert → überlebt Node-Neuaufbau (Ersatz für die manuelle Node-Datei). - postinst: sudoers reload crowdsec + edgeguard-owned Whitelist-Datei anlegen (dir root-owned → Generator überschreibt nur die vorab-chownte Datei) + Initial-Render. - UI: Switch „Vertrauenswürdiges Admin-Panel" im Domain-Detail. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
2.0 KiB
Go
31 lines
2.0 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Domain struct {
|
|
ID int64 `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"column:name;uniqueIndex" json:"name"`
|
|
Active bool `gorm:"column:active" json:"active"`
|
|
PrimaryBackendID *int64 `gorm:"column:primary_backend_id" json:"primary_backend_id,omitempty"`
|
|
HTTPToHTTPS bool `gorm:"column:http_to_https" json:"http_to_https"`
|
|
HSTSEnabled bool `gorm:"column:hsts_enabled" json:"hsts_enabled"`
|
|
HSTSMaxAge int `gorm:"column:hsts_max_age" json:"hsts_max_age"`
|
|
HSTSSubdomains bool `gorm:"column:hsts_subdomains" json:"hsts_subdomains"`
|
|
HSTSPreload bool `gorm:"column:hsts_preload" json:"hsts_preload"`
|
|
MaintenanceMode bool `gorm:"column:maintenance_mode" json:"maintenance_mode"`
|
|
MaintenanceMessage *string `gorm:"column:maintenance_message" json:"maintenance_message,omitempty"`
|
|
WWWRedirect string `gorm:"column:www_redirect" json:"www_redirect"` // ""|"to-naked"|"to-www"
|
|
RateLimitRPS int `gorm:"column:rate_limit_rps" json:"rate_limit_rps"`
|
|
MaxBodyKB int `gorm:"column:max_body_kb" json:"max_body_kb"`
|
|
DisableH3 bool `gorm:"column:disable_h3" json:"disable_h3"`
|
|
Notes *string `gorm:"column:notes" json:"notes,omitempty"`
|
|
RedirectTo string `gorm:"column:redirect_to" json:"redirect_to"` // ""=aus; sonst 301-Ziel-URL (Domain→Domain)
|
|
// CrowdSecTrusted: vertrauenswürdiges Admin-Panel → dessen Hostname wird in
|
|
// die CrowdSec-Whitelist gerendert (Admin-SPA-Traffic ist kein Crawl).
|
|
CrowdSecTrusted bool `gorm:"column:crowdsec_trusted" json:"crowdsec_trusted"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
|
}
|
|
|
|
func (Domain) TableName() string { return "domains" }
|