Skip to content

modified disable internet function, allows for container specific blockers#62

Merged
ryanka-openai merged 2 commits intomainfrom
disable-internet-changes
Aug 14, 2025
Merged

modified disable internet function, allows for container specific blockers#62
ryanka-openai merged 2 commits intomainfrom
disable-internet-changes

Conversation

@ryanka-openai
Copy link
Copy Markdown
Contributor

Changed how disable_internet works.
When a container is created, a new chain is made with the container id, and a jump rule is added to DOCKER-USER. Requests from this container then jump to this new chain, where specific rule blockers can be added. Upon teardown both the jump rule and the new chain are completely cleared. If somehow they are not cleared, functionality of any other container shouldn't change, since both the bridge_id and the ctr_ip have to match for a packet to be jumped.
When disable_internet is called, the rules originally created by add_weak_network_block_via_ip_tables are now spread across both _populate_ctr_chain and _ensure_input_block. The function _populate_ctr_chain adds rules to the container id specific chain, while _ensure_input_block applies the same INPUT rules as add_weak_network_block_via_ip_tables, except it has been modified to do the same bridge_id and ctr_ip matching (which allows for differing internet blocking rules between containers).
Calling disable_internet is the same on a specific container basis, but these changes allow multiple containers to be run in parallel or sequence on the same host machine without conflicting rules.

@ryanka-openai ryanka-openai merged commit 1291ba6 into main Aug 14, 2025
2 checks passed
@thesofakillers thesofakillers deleted the disable-internet-changes branch December 1, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant