From patchwork Mon May 17 19:04:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 4310 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4FkT7n0xz2z3wbb for ; Mon, 17 May 2021 19:04:05 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4FkT7m5GDVz1Yb; Mon, 17 May 2021 19:04:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4FkT7m4l2xz2xjj; Mon, 17 May 2021 19:04:04 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4FkT7k6531z2xPC for ; Mon, 17 May 2021 19:04:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4FkT7j6h9czcb for ; Mon, 17 May 2021 19:04:01 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1621278242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Whf4He2Yj+9COT7y0Ox/9J93y0WIn29KWIITH24TKms=; b=0fVzQrfCmZAoCLjY/Id+f1a8ULtL5OTlCVZ13PNmNZgWhxf1ziVJ3WVpLRYd+c1b3HoGUD HaMSKS0WOxPGe4DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1621278242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Whf4He2Yj+9COT7y0Ox/9J93y0WIn29KWIITH24TKms=; b=lEExhRUYEiUwDKRywB0OU6ZdL6X+kJl/WYb+OejYGweQtHQnDPz4HdXcPxlK8QWlzXtxen St1I4hg3rl+YRgFmhVGwzA+V5XwR9WWR3K03/ewZzjh2Hm8DGX4lru3IKEvdlmiXT1ELVj XtRgk0YrMDeWlLMCBygLohDJh3EdiyHGYlWPoeNmajrv6cvve8bFBGdU4hhYf/YMbOElMd rFIDMnhE1kOLKTVa1QJ0jZBmWciO0+yhm77HjeWNUK8T3iW/MsfrlpzkLS7Yz8TafLD/Iv 4kprKqvVSojM4cdI6wvIrfTAiCNntb042uDyjQ+bIEI2IGywEqGwBjftvDV/Rw== Subject: [PATCH 09/20] backup: prevent /var/ipfire/backup/bin/backup.pl from being owned by nobody To: development@lists.ipfire.org References: <7b61506c-84b9-f4e8-7a5f-5a8e8a39f795@ipfire.org> <4924bc88-655d-2a81-96de-000a7362bece@ipfire.org> <6a4b79d4-6fdd-612f-36d4-e7614f1164be@ipfire.org> <2fb1ab47-34a4-f58d-93a8-3e2f79f122ff@ipfire.org> <0bd0080a-d095-5028-22fa-7d5436b9baf3@ipfire.org> From: =?utf-8?q?Peter_M=C3=BCller?= Message-ID: Date: Mon, 17 May 2021 21:04:00 +0200 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This is dangerous as nobody could write arbitrary contents to this file and execute it afterwards. Partially fixes: #12619 Signed-off-by: Peter Müller --- lfs/backup | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lfs/backup b/lfs/backup index 791d87adb..9d3e05735 100644 --- a/lfs/backup +++ b/lfs/backup @@ -1,7 +1,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2018 IPFire Team # +# Copyright (C) 2007-2021 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -30,7 +30,7 @@ THISAPP = backup-$(VER) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) PROG = backup -PAK_VER = 1 +PAK_VER = 2 DEPS = @@ -56,10 +56,11 @@ dist: $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) -mkdir -p /var/ipfire/backup/bin - install -v -m 755 $(DIR_SRC)/config/backup/backup.pl /var/ipfire/backup/bin + install -v -m 755 -o root $(DIR_SRC)/config/backup/backup.pl /var/ipfire/backup/bin install -v -m 644 $(DIR_SRC)/config/backup/include /var/ipfire/backup/ install -v -m 644 $(DIR_SRC)/config/backup/exclude /var/ipfire/backup/ chown nobody:nobody -R /var/ipfire/backup/ + chown root:root -R /var/ipfire/backup/bin/ -mkdir -p /var/ipfire/backup/addons -mkdir -p /var/ipfire/backup/addons/includes -mkdir -p /var/ipfire/backup/addons/backup