windows: the kill switch
Upstream's killSwitch, on the Windows Filtering Platform: while the TUN or a system-wide AmneziaWG profile is on, connections that would leave past it are blocked at the ALE connect layers, while the tunnel runs, restarts or has failed. Open: loopback, the private and reserved networks with allowedSubnets, what leaves from the tunnels' own addresses, the tunnel's own programs (the backend, its helpers, awg-tunnel; the service with directFallbacks), NTP with allowTimeSync. Turning a tunnel off, or proxy-ctl killswitch off / the Overview's Lift, lifts it until a tunnel is turned on again. The filters live in a dynamic WFP session of the service's: they go with it, so stopping the service always gets the network back. Upstream holds from boot; that needs persistent filters, for once these are seen to work on real Windows (Wine has no WFP). A changed plan goes in under the other of two sublayers before the old one goes, so nothing leaks between. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ddc1bbe686
commit
32ff264c81
12 files changed
+557
-9
No files matched your search
@@ -69,6 +69,12 @@ enum Cmd {
|
||||
#[command(subcommand)]
|
||||
verb: Option<ComponentsVerb>,
|
||||
},
|
||||
/// The kill switch: what it holds back, or lift it (off) until a tunnel is turned on, or
|
||||
/// hold it again (on).
|
||||
Killswitch {
|
||||
#[command(subcommand)]
|
||||
verb: Option<KillswitchVerb>,
|
||||
},
|
||||
/// Proxy Suite itself: whether a newer release is out, and installing it.
|
||||
Update {
|
||||
#[command(subcommand)]
|
||||
@@ -76,6 +82,13 @@ enum Cmd {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum KillswitchVerb {
|
||||
Status,
|
||||
On,
|
||||
Off,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum UpdateVerb {
|
||||
/// This version, and a newer release if there is one.
|
||||
@@ -1006,6 +1019,25 @@ async fn real_main() -> Result<()> {
|
||||
Cmd::Wl { verb } => wl(&ctl, verb).await?,
|
||||
Cmd::Awg { verb } => awg(&ctl, verb).await?,
|
||||
Cmd::Update { verb } => update(&ctl, verb).await?,
|
||||
Cmd::Killswitch { verb } => {
|
||||
let on = match verb.unwrap_or(KillswitchVerb::Status) {
|
||||
KillswitchVerb::Status => None,
|
||||
KillswitchVerb::On => Some(true),
|
||||
KillswitchVerb::Off => Some(false),
|
||||
};
|
||||
let r = ctl.call(Request::KillSwitch { on }).await?;
|
||||
if ctl.json {
|
||||
ctl.print(&r);
|
||||
} else if r["enabled"] != true {
|
||||
println!("The kill switch is off (killSwitch.enable).");
|
||||
} else if r["holding"] == true {
|
||||
println!("The kill switch holds: what would leave past the tunnel is blocked.");
|
||||
} else if r["lifted"] == true {
|
||||
println!("The kill switch is lifted until a tunnel is turned on (proxy-ctl killswitch on holds it again).");
|
||||
} else {
|
||||
println!("The kill switch holds nothing back: no global tunnel is on.");
|
||||
}
|
||||
}
|
||||
Cmd::Tg { verb: TgVerb::Link } => {
|
||||
let r = ctl.call(Request::TgLinks).await?;
|
||||
for l in r["links"].as_array().into_iter().flatten().filter_map(Value::as_str) {
|
||||
|
||||
Reference in new issue
Block a user