From patchwork Sun Dec 27 12:30:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fischer X-Patchwork-Id: 3765 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 RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4D3g4l74d7z3wxc for ; Sun, 27 Dec 2020 12:30:31 +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 "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4D3g4j3yBkz2Z1; Sun, 27 Dec 2020 12:30:29 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4D3g4j2CTxz2ydx; Sun, 27 Dec 2020 12:30:29 +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 RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4D3g4h2JVRz2xgw for ; Sun, 27 Dec 2020 12:30:28 +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) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4D3g4h127Wzmd for ; Sun, 27 Dec 2020 12:30:28 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1609072228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=XgA5eqXeVjjxwPiuzMBnGszsTDm5B4vgyhun8kECbwM=; b=khB9u4o6ELZtrFZYisLjgbaVNtgyMieHSRR/v0gJmjvh72mDW+l72GyK2bq4Icg7DVENpP LpBPqcBfkO5p9VAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1609072228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=XgA5eqXeVjjxwPiuzMBnGszsTDm5B4vgyhun8kECbwM=; b=QwdC+OMSQo9860MpYDOhmLiTo3gvEMEp5W/mDkMM6JXqN9e6NJ8yMLEqBwLDfOGwKwnNza ByK2e2zbf/1rouflPOswJW92NBZcGG34bvZeCdQ8ug83m5xQ6roo3JP/jX+KySg5vSvQJz sG0Byzz29vli8ev0uu9MGiZ29zI3pj609fxRT4wZW4azFikLiyRAw6NsPbZtnPciXDLQfM FbmtARW5i5SsjAKKSIMvaeu3MQxRheD22EuA/UD59+A0iiz3C/I3JGhPoMKQ4meki12Sfk TEqDCYxSLHJp3jlMEX5R2+h+NqsQGOFfJxjtVy1hBeG2j8VAigGI/BtrhAIWEg== From: Matthias Fischer To: development@lists.ipfire.org Subject: [PATCH 2/2] New binary: optionsfwctrl - needed for new firewall DNS/NTP options Date: Sun, 27 Dec 2020 13:30:20 +0100 Message-Id: <20201227123020.4556-2-matthias.fischer@ipfire.org> In-Reply-To: <20201227123020.4556-1-matthias.fischer@ipfire.org> References: <20201227123020.4556-1-matthias.fischer@ipfire.org> 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" Signed-off-by: Matthias Fischer --- config/rootfiles/common/misc-progs | 1 + src/misc-progs/Makefile | 2 +- src/misc-progs/optionsfwctrl.c | 36 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/misc-progs/optionsfwctrl.c diff --git a/config/rootfiles/common/misc-progs b/config/rootfiles/common/misc-progs index c48a474b2..9d928ec72 100644 --- a/config/rootfiles/common/misc-progs +++ b/config/rootfiles/common/misc-progs @@ -18,6 +18,7 @@ usr/local/bin/launch-ether-wake usr/local/bin/logwatch #usr/local/bin/mpfirectrl usr/local/bin/openvpnctrl +usr/local/bin/optionsfwctrl usr/local/bin/pakfire usr/local/bin/qosctrl usr/local/bin/rebuildhosts diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile index bea54e773..9d8afcb3f 100644 --- a/src/misc-progs/Makefile +++ b/src/misc-progs/Makefile @@ -26,7 +26,7 @@ PROGS = iowrap SUID_PROGS = squidctrl sshctrl ipfirereboot \ ipsecctrl timectrl dhcpctrl suricatactrl \ applejuicectrl rebuildhosts backupctrl collectdctrl \ - logwatch wioscan wiohelper openvpnctrl firewallctrl \ + logwatch wioscan wiohelper openvpnctrl firewallctrl optionsfwctrl \ wirelessctrl getipstat qosctrl launch-ether-wake \ redctrl syslogdctrl extrahdctrl sambactrl upnpctrl \ smartctrl clamavctrl addonctrl pakfire mpfirectrl wlanapctrl \ diff --git a/src/misc-progs/optionsfwctrl.c b/src/misc-progs/optionsfwctrl.c new file mode 100644 index 000000000..f66b10983 --- /dev/null +++ b/src/misc-progs/optionsfwctrl.c @@ -0,0 +1,36 @@ +/* This file is part of the IPFire Firewall. + * + * This program is distributed under the terms of the GNU General Public + * Licence. See the file COPYING for details. + * + */ + +#include +#include +#include +#include +#include +#include +#include "setuid.h" + +int main(int argc, char *argv[]) { + + if (!(initsetuid())) + exit(1); + + if (argc < 2) { + fprintf(stderr, "\nNo argument given.\n\noptionsfwctrl restart|reload\n\n"); + exit(1); + } + + if (strcmp(argv[1], "restart") == 0) { + safe_system("/etc/rc.d/init.d/firewall restart"); + } else if (strcmp(argv[1], "reload") == 0) { + safe_system("/etc/rc.d/init.d/firewall reload"); + } else { + fprintf(stderr, "\nBad argument given.\n\noptionsfwctrl restart|reload\n\n"); + exit(1); + } + + return 0; +}