aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile.am8
-rw-r--r--acinclude.m413
-rw-r--r--src/openrc/bbfw.firewall.in82
3 files changed, 100 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index c095072..99585e9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -106,6 +106,7 @@ EXTRA_DIST = \
106 src/firewall.d/rules-example \ 106 src/firewall.d/rules-example \
107 src/firewall.d/rules4-example \ 107 src/firewall.d/rules4-example \
108 src/firewall.d/rules6-example \ 108 src/firewall.d/rules6-example \
109 src/openrc/bbfw.firewall.in \
109 src/rc.firewall.in \ 110 src/rc.firewall.in \
110 src/firewall.bbfw.service.in 111 src/firewall.bbfw.service.in
111CLEANFILES = \ 112CLEANFILES = \
@@ -120,6 +121,7 @@ CLEANFILES = \
120 $(slackrcd_SCRIPTS) \ 121 $(slackrcd_SCRIPTS) \
121 src/firewall.bbfw \ 122 src/firewall.bbfw \
122 src/firewall.bbfw.service \ 123 src/firewall.bbfw.service \
124 src/openrc/bbfw.firewall \
123 src/rc.firewall \ 125 src/rc.firewall \
124 src/rc.firewall.new \ 126 src/rc.firewall.new \
125 @PACKAGE_TARNAME@-*.tar.* \ 127 @PACKAGE_TARNAME@-*.tar.* \
@@ -147,6 +149,9 @@ endif
147if ENABLE_SLACKWARE 149if ENABLE_SLACKWARE
148slackrcd_SCRIPTS = src/rc.firewall.new 150slackrcd_SCRIPTS = src/rc.firewall.new
149endif 151endif
152if ENABLE_OPENRC
153initd_SCRIPTS = src/openrc/bbfw.firewall
154endif
150if ENABLE_INITD 155if ENABLE_INITD
151initd_SCRIPTS = src/firewall.bbfw 156initd_SCRIPTS = src/firewall.bbfw
152endif 157endif
@@ -188,6 +193,9 @@ src/firewall.bbfw: src/rc.firewall
188src/firewall.bbfw.service: Makefile src/firewall.bbfw.service.in 193src/firewall.bbfw.service: Makefile src/firewall.bbfw.service.in
189 @$(do_subst_fn) 194 @$(do_subst_fn)
190 195
196src/openrc/bbfw.firewall: Makefile src/openrc/bbfw.firewall.in
197 @$(do_subst_fn)
198
191 199
192# local targets 200# local targets
193install-exec-local: 201install-exec-local:
diff --git a/acinclude.m4 b/acinclude.m4
index 5ef1d60..3813ed8 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -65,7 +65,7 @@ AC_DEFUN([AC_BBFW_INIT],[dnl
65 withval="" 65 withval=""
66 AC_ARG_WITH( 66 AC_ARG_WITH(
67 init, 67 init,
68 [AS_HELP_STRING([--with-init=type], [init system type of slackware, systemd, or init.d [default=auto]])], 68 [AS_HELP_STRING([--with-init=type], [init system type of init.d, openrc, slackware, or systemd [default=auto]])],
69 [ WINIT=$withval ], 69 [ WINIT=$withval ],
70 [ WINIT=$withval ] 70 [ WINIT=$withval ]
71 ) 71 )
@@ -84,6 +84,9 @@ AC_DEFUN([AC_BBFW_INIT],[dnl
84 elif test "x${WINIT}" == "xinit.d";then 84 elif test "x${WINIT}" == "xinit.d";then
85 ENABLE_INIT=init.d 85 ENABLE_INIT=init.d
86 ENABLE_INITD=yes 86 ENABLE_INITD=yes
87 elif test "x${WINIT}" == "xopenrc";then
88 ENABLE_INIT=OpenRC
89 ENABLE_OPENRC=yes
87 elif test "x${WINIT}" == "xslackware";then 90 elif test "x${WINIT}" == "xslackware";then
88 ENABLE_INIT=slackware 91 ENABLE_INIT=slackware
89 ENABLE_SLACKWARE=yes 92 ENABLE_SLACKWARE=yes
@@ -91,7 +94,7 @@ AC_DEFUN([AC_BBFW_INIT],[dnl
91 ENABLE_INIT=systemd 94 ENABLE_INIT=systemd
92 ENABLE_SYSTEMD=yes 95 ENABLE_SYSTEMD=yes
93 elif test ""x${WINIT}" != "xno" && test ""x${WINIT}" != "xyes" && test "x${WINIT}" != "x";then 96 elif test ""x${WINIT}" != "xno" && test ""x${WINIT}" != "xyes" && test "x${WINIT}" != "x";then
94 AC_MSG_ERROR([unknown init system, must be slackware, systemd, or init.d.]) 97 AC_MSG_ERROR([unknown init system, must be init.d, openrc, slackware, or systemd.])
95 fi 98 fi
96 99
97 # auto detects init system 100 # auto detects init system
@@ -99,6 +102,9 @@ AC_DEFUN([AC_BBFW_INIT],[dnl
99 if test -f /etc/slackware-version;then 102 if test -f /etc/slackware-version;then
100 ENABLE_INIT=slackware 103 ENABLE_INIT=slackware
101 ENABLE_SLACKWARE=yes 104 ENABLE_SLACKWARE=yes
105 elif test -f /sbin/openrc;then
106 ENABLE_INIT=OpenRC
107 ENABLE_OPENRC=yes
102 elif test -d "/etc/systemd/system/";then 108 elif test -d "/etc/systemd/system/";then
103 ENABLE_INIT=systemd 109 ENABLE_INIT=systemd
104 ENABLE_SYSTEMD=yes 110 ENABLE_SYSTEMD=yes
@@ -112,8 +118,9 @@ AC_DEFUN([AC_BBFW_INIT],[dnl
112 fi 118 fi
113 fi 119 fi
114 120
115 AM_CONDITIONAL([ENABLE_SLACKWARE], [test "x${ENABLE_SLACKWARE}" == "xyes"])
116 AM_CONDITIONAL([ENABLE_INITD], [test "x${ENABLE_INITD}" == "xyes"]) 121 AM_CONDITIONAL([ENABLE_INITD], [test "x${ENABLE_INITD}" == "xyes"])
122 AM_CONDITIONAL([ENABLE_OPENRC], [test "x${ENABLE_OPENRC}" == "xyes"])
123 AM_CONDITIONAL([ENABLE_SLACKWARE], [test "x${ENABLE_SLACKWARE}" == "xyes"])
117 AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x${ENABLE_SYSTEMD}" == "xyes"]) 124 AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x${ENABLE_SYSTEMD}" == "xyes"])
118])dnl 125])dnl
119 126
diff --git a/src/openrc/bbfw.firewall.in b/src/openrc/bbfw.firewall.in
new file mode 100644
index 0000000..dc78f1e
--- /dev/null
+++ b/src/openrc/bbfw.firewall.in
@@ -0,0 +1,82 @@
1#!/sbin/openrc-run
2#
3# Bindle Binaries Linux Firewall
4# Copyright (c) 2021 David M. Syzdek <david@syzdek.net>.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met:
9#
10# * Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# * Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution.
15# * Neither the name of David M. Syzdek nor the
16# names of its contributors may be used to endorse or promote products
17# derived from this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR
23# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29# SUCH DAMAGE.
30#
31# OpenRC init script
32#
33
34description="Bindle Binaries Linux Firewall"
35description_reload="Reload configuration"
36
37extra_commands="sync"
38extra_started_commands="dump log reload"
39
40bbfw_bin="@sbindir@/bbfw"
41bbfw_log_bin="@sbindir@/bbfw-log"
42
43depend() {
44 before net
45 use logger
46 provide firewall
47}
48
49dump() {
50 $bbfw_bin dump
51 return 0
52}
53
54log() {
55 $bbfw_log_bin
56 return 0
57}
58
59reload() {
60 ebegin "Reloading firewall via bbfw"
61 $bbfw_bin restart
62 eend $?
63}
64
65start() {
66 ebegin "Loading firewall via bbfw"
67 $bbfw_bin start
68 eend $?
69}
70
71sync() {
72 ebegin "Syncing firewall rules via bbfw"
73 eend 0
74}
75
76stop() {
77 ebegin "Flushing firewall via bbfw"
78 $bbfw_bin start
79 eend $?
80}
81
82# end of init file