Staged undo, built-ins window, machine warnings; raw and dynamic set fixes
- Undo is staged like any edit: in review mode the web UI's Undo, and hc history undo with -C or HOUSECARL_CHANGESET, add a revert operation that checks, when replayed, that nothing it touches changed since; applied, History links the entries. Imports and takeovers still can't be staged. - The rules page sums up a chain's built-ins in one line; a window lists them with what they do and their hits, and switches them. - Warnings about the machine (dashboard, hc status): nftables.service enabled (it loads /etc/nftables.conf at boot and flushes every table when stopped), and the imported table still in force beside Housecarl's. The docs say to disable nftables.service but not stop it. - A raw rule with other fields set is refused (raw_conflict) instead of silently ignoring them; the rule dialog's nftables section hides what it replaces, and the importer's raw rules carry only their text. - A dynamic set with configured entries is refused (set_dynamic_entries): they were silently ignored. The set dialog shows entries or the entry timeout, as fits. - The rule dialog's chain choices are just the chains' names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d25e12995e
commit
9a165cf70b
26 files changed
+408
-58
No files matched your search
@@ -39,6 +39,8 @@ type Input struct {
|
||||
// Result is the imported configuration and what to know about it.
|
||||
type Result struct {
|
||||
State *model.State
|
||||
// Table is the table imported ("inet main").
|
||||
Table string
|
||||
Notes []string
|
||||
// Raw lists the rules that became raw rules.
|
||||
Raw []string
|
||||
@@ -206,7 +208,7 @@ func Import(in Input) (*Result, error) {
|
||||
im.run()
|
||||
im.nameForwards()
|
||||
im.st.Renumber()
|
||||
return &Result{State: im.st, Notes: im.notes, Raw: im.raw}, nil
|
||||
return &Result{State: im.st, Table: im.table.Family + " " + im.table.Name, Notes: im.notes, Raw: im.raw}, nil
|
||||
}
|
||||
|
||||
func tableList(ts []nftTable) string {
|
||||
@@ -1464,7 +1466,8 @@ func (im *importer) rawRule(r *model.Rule, p *parsed) {
|
||||
if r.Action == "" {
|
||||
r.Action = model.ActionAccept
|
||||
}
|
||||
r.Match, r.Raw = model.Match{}, text
|
||||
// Only the text counts: what was parsed of it goes.
|
||||
*r = model.Rule{ID: r.ID, Chain: r.Chain, Position: r.Position, Comment: r.Comment, Action: r.Action, Raw: text}
|
||||
im.st.Rules = append(im.st.Rules, r)
|
||||
why := strings.Join(p.unsupported, ", ")
|
||||
if why == "" {
|
||||
|
||||
Reference in new issue
Block a user