-
Notifications
You must be signed in to change notification settings - Fork 62
[LXC] Address network policy gaps - model 2 (deny-all-except-proxy) #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5f5ae13
64c072e
6425119
775dc87
9648284
3fd32ed
f22f839
80fb608
4c71e2e
7389263
81362b6
8df9dff
84ac24c
29cf20e
ed6ee5b
a273708
7c4e03b
c5484b1
f276fb2
815758a
fff3c93
c917434
a7a6194
6e7591c
1ed2ae6
63578db
d563cbb
c3af5f3
6756a3b
6c52d93
17ea610
96042f4
10f0599
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,13 +192,14 @@ impl LxcScriptRunner { | |
| let _ = writeln!(logger, "Container already running."); | ||
| } | ||
|
|
||
| // Wait for network only when the config uses network features (firewall rules | ||
| // or allowed/blocked hosts). | ||
| // Wait for network only when the config uses network features | ||
| // (firewall rules, allowed/blocked hosts, or proxy enforcement). | ||
| let needs_network = matches!( | ||
| request.policy.network_enforcement_mode, | ||
| NetworkEnforcementMode::Firewall | NetworkEnforcementMode::Both | ||
| ) || !request.policy.allowed_hosts.is_empty() | ||
| || !request.policy.blocked_hosts.is_empty(); | ||
| || !request.policy.blocked_hosts.is_empty() | ||
| || request.policy.network_proxy.is_enabled(); | ||
|
|
||
| if needs_network { | ||
| Self::wait_for_network(&container_name, Duration::from_secs(10), logger); | ||
|
Comment on lines
+355
to
358
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we address this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed, and it is not fixed in this PR. Closing it properly needs a veth-scoped quarantine chain installed the moment the interface exists and then atomically swapped for the real policy, which is a new enforcement stage with its own rollback and teardown semantics rather than a reordering. I filed #764 for it rather than growing this PR further. The window is established by reading the call ordering, not by observing a packet escape. |
||
|
|
@@ -242,10 +243,14 @@ impl LxcScriptRunner { | |
| Some(Duration::from_millis(u64::from(request.script_timeout))) | ||
| }; | ||
| let _ = writeln!(logger, "Executing script inside container..."); | ||
| let mut exec_env = request.env.clone(); | ||
| let force_clear_env = | ||
| wxc_common::proxy_env::apply_proxy_env(&mut exec_env, &request.policy.network_proxy); | ||
| let result = container.attach_run( | ||
| &request.script_code, | ||
| &request.working_directory, | ||
| &request.env, | ||
| &exec_env, | ||
| force_clear_env, | ||
| timeout, | ||
| ); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.