authority

package
v1.79.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

============================================================================= NFTBan v1.73 - Installer Authority Classification ============================================================================= SPDX-License-Identifier: MPL-2.0 meta:name="installer-authority-classify" meta:type="lib" meta:owner="Antonios Voulvoulis <contact@nftban.com>" meta:created_date="2026-04-04" meta:description="Authority decision tree: UPDATE/TAKEOVER/FRESH/ABORT" meta:inventory.files="internal/installer/authority/classify.go" meta:inventory.binaries="" meta:inventory.env_vars="NFTBAN_TAKEOVER" meta:inventory.config_files="" meta:inventory.systemd_units="" meta:inventory.network="" meta:inventory.privileges="root" =============================================================================

============================================================================= NFTBan v1.73 - Installer Authority Types ============================================================================= SPDX-License-Identifier: MPL-2.0 meta:name="installer-authority-types" meta:type="lib" meta:owner="Antonios Voulvoulis <contact@nftban.com>" meta:created_date="2026-04-04" meta:description="Authority decision enum and types" meta:inventory.files="internal/installer/authority/types.go" meta:inventory.binaries="" meta:inventory.env_vars="NFTBAN_TAKEOVER" meta:inventory.config_files="" meta:inventory.systemd_units="" meta:inventory.network="" meta:inventory.privileges="none" =============================================================================

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decision

type Decision string

Decision represents the authority classification for the install.

const (
	// Update means NFTBan already owns the firewall (table + chain exist).
	Update Decision = "UPDATE"

	// Fresh means no conflicting firewalls — clean slate.
	Fresh Decision = "FRESH"

	// Takeover means conflicts exist but takeover is approved
	// (via env var, panel auto-approve, or user confirmation).
	Takeover Decision = "TAKEOVER"

	// Abort means conflicts exist and takeover is not approved.
	Abort Decision = "ABORT"
)

func Classify

func Classify(
	exec executor.Executor,
	conflicts []detect.Conflict,
	panel detect.PanelType,
	forceApprove bool,
	log *logging.Logger,
) Decision

Classify determines the installation authority based on the current system state.

Decision tree (matches shell %post _check_authority exactly):

  1. UPDATE — NFTBan already owns the firewall: nft list table ip nftban succeeds AND nft list chain ip nftban input succeeds

  2. FRESH — No conflicting firewalls detected (conflicts slice is empty)

  3. TAKEOVER — Conflicts exist, but takeover is approved: a. NFTBAN_TAKEOVER=1 environment variable, OR b. Panel is detected (auto-approve for managed hosting), OR c. forceApprove flag is true (from --takeover CLI flag)

  4. ABORT — Conflicts exist, no approval granted

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL