mirror of
https://github.com/open-webui/open-terminal.git
synced 2026-11-05 01:27:28 +00:00
[PR #118] fix: egress filtering when running as non-root user #128
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/open-terminal#128
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-terminal/pull/118
Author: @SoerenOestervig
Created: 5/5/2026
Status: 🔄 Open
Base:
main← Head:fix/egress-filtering-as-non-root-user📝 Commits (1)
1f18ec9fix: egress filtering when running as non-root user📊 Changes
1 file changed (+5 additions, -3 deletions)
View changed files
📝
entrypoint.sh(+5 -3)📄 Description
Summary
Egress filtering (
OPEN_TERMINAL_ALLOWED_DOMAINS) is broken in the current default image. Two bugs exist:userAddressing issue: #119
Bug 1 — Container crash on capability drop
When egress filtering is enabled, the entrypoint configures iptables rules and then attempts to permanently drop
CAP_NET_ADMINusingcapsh. However,capshis executed as the unprivilegeduser, which lacks theCAP_SETPCAPpermission required to modify the bounding set. Combined withset -e, this crashes the container immediately:Fix: Execute
capshviasudo(which theuseraccount has passwordless access to), and use--user=userto securely drop back to the unprivileged user before starting the application.Bug 2 — dnsmasq blocked from reaching upstream DNS
The iptables rules block ALL outbound port 53 traffic. This includes dnsmasq's own queries to the upstream DNS server, which it needs to resolve whitelisted domains. As a result, the
allowedipset is never populated, and all outbound connections fail — even to whitelisted domains.Fix: Explicitly allow dnsmasq to reach the captured upstream DNS server before applying the blanket port 53 block.
Test Results
v0.11.34(default, asuser)v0.11.34(forced to run asroot*)user(UID 1000)cap_net_adminpermanently droppedpypi.orgresolves via dnsmasqgoogle.comblockedpypi.orgaccessible (200)google.comblocked--user 0:0to bypass Bug 1. This is not a viable workaround because it means the AI sandbox process runs with full root privileges, defeating the container's security model.Configuration:
--cap-add NET_ADMIN,OPEN_TERMINAL_ALLOWED_DOMAINS=pypi.orgNotes
entrypoint.shis modified.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.