Update iptables esvm service
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
name: iptables
|
name: iptables
|
||||||
description: userspace CLI program used to configure the Linux packet filtering ruleset
|
description: userspace CLI program used to configure the Linux packet filtering ruleset
|
||||||
version: 1.8.11
|
version: 1.8.11
|
||||||
|
revision: 2
|
||||||
url: https://www.netfilter.org/projects/iptables/index.html
|
url: https://www.netfilter.org/projects/iptables/index.html
|
||||||
license: GPL2-only
|
license: GPL2-only
|
||||||
architecture: any
|
architecture: any
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Flush iptables (Code from archlinux)
|
||||||
|
iptables=ip$1tables
|
||||||
|
if ! type -p "$iptables" &>/dev/null; then
|
||||||
|
echo "error: invalid argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r table; do
|
||||||
|
tables+=("/usr/share/iptables/empty-$table.rules")
|
||||||
|
done <"/proc/net/ip$1_tables_names"
|
||||||
|
|
||||||
|
if (( ${#tables[*]} )); then
|
||||||
|
cat "${tables[@]}" | "$iptables-restore"
|
||||||
|
fi
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
name: iptables
|
name: iptables
|
||||||
description: IPv4 Packet Filtering Framework
|
description: IPv4 Packet Filtering Framework
|
||||||
type: background
|
type: simple
|
||||||
start_cmd: /etc/esvm/scripts/iptables.sh
|
start_cmd: /usr/sbin/iptables-restore /etc/iptables/iptables.rules
|
||||||
exit_method: kill
|
stop_cmd: /etc/esvm/scripts/iptables-flush.sh
|
||||||
|
exit_method: stop_command
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
# Flush iptables (Code from archlinux)
|
|
||||||
iptables=ip$1tables
|
|
||||||
if ! type -p "$iptables" &>/dev/null; then
|
|
||||||
echo "error: invalid argument"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
while read -r table; do
|
|
||||||
tables+=("/usr/share/iptables/empty-$table.rules")
|
|
||||||
done <"/proc/net/ip$1_tables_names"
|
|
||||||
|
|
||||||
if (( ${#tables[*]} )); then
|
|
||||||
cat "${tables[@]}" | "$iptables-restore"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clear the trap
|
|
||||||
trap - SIGINT SIGTERM
|
|
||||||
kill -- -$(pgrep iptables.sh)
|
|
||||||
}
|
|
||||||
|
|
||||||
/usr/sbin/iptables-restore /etc/iptables/iptables.rules
|
|
||||||
|
|
||||||
# Run stop function when SIGINT or SIGTERM signals are caught
|
|
||||||
trap "stop $1" SIGINT SIGTERM
|
|
||||||
sleep infinity
|
|
||||||
|
|
||||||
|
|
||||||
@@ -27,8 +27,8 @@ package() {
|
|||||||
make DESTDIR="$BPM_OUTPUT" install
|
make DESTDIR="$BPM_OUTPUT" install
|
||||||
|
|
||||||
# Install esvm service
|
# Install esvm service
|
||||||
|
install -Dm755 "$BPM_WORKDIR"/iptables-flush.sh "$BPM_OUTPUT"/etc/esvm/scripts/iptables-flush.sh
|
||||||
install -Dm644 "$BPM_WORKDIR"/iptables.esv "$BPM_OUTPUT"/etc/esvm/services/iptables.esv
|
install -Dm644 "$BPM_WORKDIR"/iptables.esv "$BPM_OUTPUT"/etc/esvm/services/iptables.esv
|
||||||
install -Dm755 "$BPM_WORKDIR"/iptables.sh "$BPM_OUTPUT"/etc/esvm/scripts/iptables.sh
|
|
||||||
|
|
||||||
# Rules from Arch Linux
|
# Rules from Arch Linux
|
||||||
install -Dm644 "$BPM_WORKDIR"/rules/empty.rules "$BPM_OUTPUT"/etc/iptables/iptables.rules
|
install -Dm644 "$BPM_WORKDIR"/rules/empty.rules "$BPM_OUTPUT"/etc/iptables/iptables.rules
|
||||||
|
|||||||
Reference in New Issue
Block a user