Skip to content

Commit c23937a

Browse files
committed
Only allow root to send tunnel traffic
1 parent 45cf156 commit c23937a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

talpid-core/src/firewall/macos.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{FirewallArguments, FirewallPolicy, FirewallT};
22
use ipnetwork::IpNetwork;
3-
use pfctl::{DropAction, FilterRuleAction};
3+
use pfctl::{DropAction, FilterRuleAction, Uid};
44
use std::{
55
env,
66
net::{IpAddr, Ipv4Addr},
@@ -15,6 +15,8 @@ type Result<T> = std::result::Result<T, Error>;
1515
/// replaced by allowing the anchor name to be configured from the public API of this crate.
1616
const ANCHOR_NAME: &'static str = "mullvad";
1717

18+
const ROOT_UID: u32 = 0;
19+
1820
/// The macOS firewall and DNS implementation.
1921
pub struct Firewall {
2022
pf: pfctl::PfCtl,
@@ -194,6 +196,7 @@ impl Firewall {
194196
.proto(pfctl_proto)
195197
.keep_state(pfctl::StatePolicy::Keep)
196198
.tcp_flags(Self::get_tcp_flags())
199+
.user(Uid::from(ROOT_UID))
197200
.quick(true)
198201
.build()?)
199202
}

0 commit comments

Comments
 (0)