diff --git a/config/rootfiles/common/aarch64/initscripts b/config/rootfiles/common/aarch64/initscripts index a988b4abc..a18ce99c3 100644 --- a/config/rootfiles/common/aarch64/initscripts +++ b/config/rootfiles/common/aarch64/initscripts @@ -92,6 +92,7 @@ etc/rc.d/init.d/unbound etc/rc.d/init.d/vnstat etc/rc.d/init.d/waitdrives etc/rc.d/init.d/wlanclient +etc/rc.d/init.d/ddos #etc/rc.d/rc0.d #etc/rc.d/rc0.d/K01imspetor #etc/rc.d/rc0.d/K01motion diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts index a5e1596fb..fb472800e 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -91,6 +91,7 @@ etc/rc.d/init.d/unbound etc/rc.d/init.d/vnstat etc/rc.d/init.d/waitdrives etc/rc.d/init.d/wlanclient +etc/rc.d/init.d/ddos #etc/rc.d/rc0.d #etc/rc.d/rc0.d/K01imspetor #etc/rc.d/rc0.d/K01motion diff --git a/src/initscripts/system/ddos b/src/initscripts/system/ddos new file mode 100755 index 000000000..885bf5361 --- /dev/null +++ b/src/initscripts/system/ddos @@ -0,0 +1,64 @@ +#!/bin/sh +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2022 IPFire Team # +# Copyright (C) 2024 FireBeeOS # +# # +# 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 # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +. /etc/sysconfig/rc +. $rc_functions + +eval $(/usr/local/bin/readhash /var/ipfire/ddos/settings) + +case "$1" in + start) + if [ "$ENABLE_DDOS" == "on" ]; then + boot_mesg -n "Starting ddos..." + if [ -e /var/ipfire/red/active ]; then + boot_mesg "" + /usr/sbin/xdp-loader load red0 -m skb /usr/lib/bpf/xdp_synproxy.bpf.o + evaluate_retval + else + boot_mesg " ERROR! Red0 interface not online!" + echo_warning + fi + fi + + ;; + + stop) + boot_mesg "Stopping ddos..." + /usr/sbin/xdp-loader unload red0 -a + evaluate_retval + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + status) + /usr/sbin/xdp-loader status red0 + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac