Skip to main content

EGR063 - iptables Chain Holds Another Knoc's Rules

Uploading.Agent error code #EGR063 indicates that the iptables chain an egress knoc names holds rules another knoc wrote. On iptables each knoc owns its chain, and every grant replaces the whole chain with that knoc's rules. Writing it would delete the other knoc's grants and rejects, so the agent refuses the grant instead.

A revoke still works: the agent deletes only the revoked account's rules and leaves the other knoc's.

The agent tells the knocs apart by the comment on each rule, knocknoc:<knoc id>:.... Rules with no such comment are not another knoc's, and the next write replaces them.

Common causes include:

    Two knocs on the same agent name the same chain. Knocknoc refuses to save that, but a knoc saved on another agent and then moved to this one can still arrive with a chain already in use A knoc was deleted while the agent was offline, so its rules were never removed, and a new knoc was given its chain A chain was copied from another host's saved ruleset with the agent's rules still in it

    Steps to Resolve

    Find the Other Knoc

    List the chain and read the knoc id in each comment:

    sudo iptables -S KNOCKNOC_EGRESS_1
    

    Each id is the knoc's id in Knocknoc. Search for it on the Knocs page.

    Give Each Knoc Its Own Chain

    Pick another chain for one of the knocs. knocker enable egress makes three, KNOCKNOC_EGRESS_1 to _3, and you can declare more in your ruleset.

    Remove Rules Left Behind

    If the id belongs to no knoc, delete its rules. For each line sudo iptables -S KNOCKNOC_EGRESS_1 prints with that id, run sudo iptables -D KNOCKNOC_EGRESS_1 followed by the rest of the line. The agent writes the chain again within about 10 seconds. Also check OUTPUT for a jump commented with the same id: sudo iptables -S OUTPUT.

    Do the same in ip6tables when the chain is in the IPv6 filter table.