Skip to content
Snippets Groups Projects
Commit 2a886773 authored by ale's avatar ale
Browse files

Run update-ipset before load_firewall

The ipsets must already exist when they are referenced in iptables
rules.
parent 925efac2
No related branches found
No related tags found
1 merge request!5Call update-ipset from update-firewall
Pipeline #57656 passed
...@@ -7,11 +7,12 @@ sharedir = $(prefix)/share/firewall ...@@ -7,11 +7,12 @@ sharedir = $(prefix)/share/firewall
INSTALL = install INSTALL = install
TABLES = filter nat mangle raw TABLES = filter nat mangle raw
all: all: update-firewall
clean: clean:
-rm -f update-firewall
install: install: all
$(INSTALL) -d $(DESTDIR)$(sbindir) $(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) -d $(DESTDIR)$(sharedir) $(INSTALL) -d $(DESTDIR)$(sharedir)
$(INSTALL) -d $(DESTDIR)$(fwconfdir) $(INSTALL) -d $(DESTDIR)$(fwconfdir)
...@@ -34,3 +35,6 @@ install: ...@@ -34,3 +35,6 @@ install:
$(INSTALL) -d $(DESTDIR)$(fwconfdir)/blocked/$$type/$$proto ; \ $(INSTALL) -d $(DESTDIR)$(fwconfdir)/blocked/$$type/$$proto ; \
done ; \ done ; \
done) done)
%: %.in
sed -e s,@PREFIX@,$(prefix),g -e s,@FWCONFDIR@,$(fwconfdir),g $< > $@
#!/bin/bash #!/bin/bash
# Directory containing the configuration snippets. # Directory containing the configuration snippets.
CONFIG_DIR="${CONFIG_DIR:-/etc/firewall}" CONFIG_DIR="${CONFIG_DIR:-@FWCONFDIR@}"
# List of tables to manage. # List of tables to manage.
TABLES="filter nat mangle raw" TABLES="filter nat mangle raw"
...@@ -238,7 +238,16 @@ while [ $# -gt 0 ]; do ...@@ -238,7 +238,16 @@ while [ $# -gt 0 ]; do
shift shift
done done
# We need to run update-ipset first, so that we can reference the sets
# from iptables "-m set" rules.
if [ -x @PREFIX@/sbin/update-ipset ]; then
@PREFIX@/sbin/update-ipset
if [ $? -gt 0 ]; then
echo "update-ipset failed, aborting..." >&2
exit 1
fi
fi
load_firewall load_firewall
# Execute update-ipset next. exit 0
exec /usr/sbin/update-ipset
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment