[PR #6797] [CLOSED] Let Xray write rp_filter: set ProtectKernelTunables=no #6457

Closed
opened 2026-11-02 04:08:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6797
Author: @freeb5d
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: fix/kernel-tunables-tun


📝 Commits (2)

  • 421a24a fix(systemd): let Xray write rp_filter so tun inbounds start
  • 7b1d84d fix(systemd): name the real writer and drop the stale hardening warning

📊 Changes

5 files changed (+11 additions, -7 deletions)

View changed files

📝 install.sh (+1 -2)
📝 update.sh (+1 -2)
📝 x-ui.service.arch (+3 -1)
📝 x-ui.service.debian (+3 -1)
📝 x-ui.service.rhel (+3 -1)

📄 Description

Fixes #6796

Problem

The hardened systemd units set ProtectKernelTunables=yes, which mounts /proc/sys read-only for the service. A WireGuard outbound in kernel-TUN mode (the default for a hand-added WireGuard outbound) writes rp_filter under /proc/sys at startup, so Xray fails with failed to disable ipv4 rp_filter for all: open /proc/sys/net/ipv4/conf/all/rp_filter: read-only file system. The unit file is replaced on every update, so a manual edit is lost each time.

Change

  • ProtectKernelTunables=no in the arch, debian and rhel units, with a two-line comment naming the WireGuard outbound as the writer.
  • Removed ProtectKernelTunables:232 from the "not applied on old systemd" list in install.sh and update.sh, since it is no longer a hardening option.

Notes

  • This gives up one hardening option; the maintainer should decide if that is acceptable.
  • Not tested on a real systemd host. (The first commit's title says "tun inbounds"; the cause is the WireGuard outbound, as above.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6797 **Author:** [@freeb5d](https://github.com/freeb5d) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/kernel-tunables-tun` --- ### 📝 Commits (2) - [`421a24a`](https://github.com/MHSanaei/3x-ui/commit/421a24a89f5fff05b1d5bbf368b8fea39478cabc) fix(systemd): let Xray write rp_filter so tun inbounds start - [`7b1d84d`](https://github.com/MHSanaei/3x-ui/commit/7b1d84dac46c7ff941d15aa613eb313dda9f35ff) fix(systemd): name the real writer and drop the stale hardening warning ### 📊 Changes **5 files changed** (+11 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `install.sh` (+1 -2) 📝 `update.sh` (+1 -2) 📝 `x-ui.service.arch` (+3 -1) 📝 `x-ui.service.debian` (+3 -1) 📝 `x-ui.service.rhel` (+3 -1) </details> ### 📄 Description Fixes #6796 ## Problem The hardened systemd units set `ProtectKernelTunables=yes`, which mounts `/proc/sys` read-only for the service. A WireGuard outbound in kernel-TUN mode (the default for a hand-added WireGuard outbound) writes `rp_filter` under `/proc/sys` at startup, so Xray fails with `failed to disable ipv4 rp_filter for all: open /proc/sys/net/ipv4/conf/all/rp_filter: read-only file system`. The unit file is replaced on every update, so a manual edit is lost each time. ## Change - `ProtectKernelTunables=no` in the arch, debian and rhel units, with a two-line comment naming the WireGuard outbound as the writer. - Removed `ProtectKernelTunables:232` from the "not applied on old systemd" list in `install.sh` and `update.sh`, since it is no longer a hardening option. ## Notes - This gives up one hardening option; the maintainer should decide if that is acceptable. - Not tested on a real systemd host. (The first commit's title says "tun inbounds"; the cause is the WireGuard outbound, as above.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6457
No description provided.