Skip to content

Commit cc45262

Browse files
committed
fix(ie-sandbox): add missing landlock rules for DNS resolution #75
Add /etc/host.conf, /etc/gai.conf, /etc/ld.so.cache to landlock whitelist for network profile. Add /usr/lib, /lib, /lib64 for read access to glibc NSS modules (libnss_dns.so etc.) needed by getaddrinfo(). This fixes DNS resolution in the sandboxed network child process. External HTTPS connections still fail (tracked in #75) — use --single-process as workaround.
1 parent ab2bebb commit cc45262

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

crates/ie-sandbox/src/sandbox_linux.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,26 @@ fn apply_landlock(profile: SandboxProfile) -> Result<bool> {
7373
}
7474
}
7575
// Allow read on DNS/network config files
76-
for path in ["/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/hosts"] {
76+
for path in [
77+
"/etc/resolv.conf",
78+
"/etc/nsswitch.conf",
79+
"/etc/hosts",
80+
"/etc/gai.conf",
81+
"/etc/host.conf",
82+
"/etc/ld.so.cache",
83+
] {
7784
if let Ok(fd) = PathFd::new(path) {
7885
rs = rs.add_rule(PathBeneath::new(fd, AccessFs::from_read(abi)))?;
7986
}
8087
}
88+
// Allow read on system libraries (glibc NSS modules for DNS resolution)
89+
for path in ["/usr/lib", "/lib", "/lib64"] {
90+
if std::path::Path::new(path).exists()
91+
&& let Ok(fd) = PathFd::new(path)
92+
{
93+
rs = rs.add_rule(PathBeneath::new(fd, AccessFs::from_read(abi)))?;
94+
}
95+
}
8196
rs
8297
}
8398
SandboxProfile::Renderer => {

0 commit comments

Comments
 (0)