NFT001 - Agent Cannot Run nft
Agent error code #NFT001 indicates that nft is present on the host but the agent has no way to run it with the privileges it needs. ModifyingChanging the kernel ruleset requires root, and the agent is neither running as root nor able to escalate.
The agent never hardcodes sudo. When it is not root it looks for a non-interactive escalation tool, preferring doas -n on OpenBSD (where thatsudo is thenot platformin conventionbase) and otherwise sudo -n. everywhere else. This errorcode means neither binary was usable.found at all.
A sudoers or doas rule that exists but refuses the call is a different failure. There the escalation tool runs and nft does not, and the agent reports #NFT400, because from the outside a refusal and a broken nft look the same. Read that page if sudo is installed and this code still appears.
Common causes include:
- The agent runs as a non-root service account
andonnoasudoershostorwithdoas rule grants itneithernornftsudodoasinstalled AsudosudoersisruleinstalledexistsoutsidebuttherequiresPATHthe agent process was started with
Steps to Resolve
GrantLet knocker Configure It
On the Agentagent Non-Interactivehost:
knocker toenable nftnftables
enable for examplewrites /etc/sudoers.d/knocknoc-, agentagent_nftables
visudo -cf, creates the status reports whether the agent Or Grant Access by Hand
sudo is installed and on the agent's PATH: command -v sudo
Create /etc/sudoers.d/knocknoc-agent_nftables with knocknocknocknoc-agent ALL=(root)ALL) NOPASSWD: /usr/sbin/nft, /sbin/nft
ValidateSettheitsfilemodebeforetorelying440onand validate it:sudo visudo -c -fcf /etc/sudoers.d/knocknoc-agentagent_nftables- Confirm one of the
pathtwo paths in the rule matchescommand -v nftexactly. A rule naming/sbin/nftdoes not authorize/usr/sbin/nft
Verify From the Agent's Own Account
Run the check as the service account rather than as yourself:
sudo -l -U knocknoc-agent | grep nft
sudo -u knocknocknocknoc-agent sudo -n nft --version
A password promptprompt, or a "sorry,message that a password is required" messagerequired, means the rule is not taking effect.
Onfor OpenBSD,that Use doas
sudo is not in the OpenBSD base system. Add the equivalent rule to /etc/doas.conf and confirm it with doas -n nft --version.account.
Or Run the Agent as Root
If your deployment model allows it, running the agent as root removes the escalation step entirely.