public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: "Peter Müller" <peter.mueller@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] sysctl: Disable bpf() calls from unprivileged users without toggle option
Date: Sun, 16 Jun 2024 14:02:00 +0000	[thread overview]
Message-ID: <fd80daa9-6a34-425e-9b86-cab27aa6ce0a@ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

According to the Linux kernel documentation, enabling BPF_UNPRIV_DEFAULT_OFF
(which was done in 69dde418f11dc0085cbe061b90f6c002d6d6cce2) will cause
the sysctl kernel.unprivileged_bpf_disabled to default to 2. This
prohibits calls to bpf() from unprivileged users by default, but allows
for such calls to be allowed again during runtime, by setting
kernel.unprivileged_bpf_disabled to 0.

There is no legitimate reason why this should be possible on IPFire,
which is why this patch sets kernel.unprivileged_bpf_disabled to 1
during startup, causing the same effect as 2, but without any option to
revert this setting during runtime. This fixes a Lynis warning.

Signed-off-by: Peter Müller <peter.mueller(a)ipfire.org>
---
 config/etc/sysctl.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/config/etc/sysctl.conf b/config/etc/sysctl.conf
index 31a220e38..51a804043 100644
--- a/config/etc/sysctl.conf
+++ b/config/etc/sysctl.conf
@@ -111,3 +111,6 @@ kernel.perf_event_paranoid = 3
 
 # Only processes with CAP_SYS_PTRACE may use ptrace
 kernel.yama.ptrace_scope = 2
+
+# Disable unprivileged calls to bpf() without option to enable during runtime
+kernel.unprivileged_bpf_disabled = 1
-- 
2.35.3

                 reply	other threads:[~2024-06-16 14:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd80daa9-6a34-425e-9b86-cab27aa6ce0a@ipfire.org \
    --to=peter.mueller@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox