Gentoo Archives: gentoo-commits

From: "Constanze Hausner (constanze)" <constanze@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-firewall/shorewall-init/files/4.5.21.4: shorewallrc 01_Remove-ipset-functionality.patch shorewall-init.initd shorewall-init.systemd shorewall-init.confd README.Gentoo.txt
Date: Mon, 02 Dec 2013 19:58:51
Message-Id: 20131202195843.0B6AB2004B@flycatcher.gentoo.org
1 constanze 13/12/02 19:58:42
2
3 Added: shorewallrc 01_Remove-ipset-functionality.patch
4 shorewall-init.initd shorewall-init.systemd
5 shorewall-init.confd README.Gentoo.txt
6 Log:
7 Version Bump; Thanks to Thomas D.
8
9 (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key BB80F419010E3EC3)
10
11 Revision Changes Path
12 1.1 net-firewall/shorewall-init/files/4.5.21.4/shorewallrc
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewallrc?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewallrc?rev=1.1&content-type=text/plain
16
17 Index: shorewallrc
18 ===================================================================
19 #
20 # Gentoo Shorewall 4.5 rc file
21 #
22 BUILD= #Default is to detect the build system
23 HOST=gentoo #Gentoo GNU Linux
24 PREFIX=@GENTOO_PORTAGE_EPREFIX@/usr #Top-level directory for shared files, libraries, etc.
25 SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
26 LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
27 PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
28 CONFDIR=@GENTOO_PORTAGE_EPREFIX@/etc #Directory where subsystem configurations are installed
29 SBINDIR=@GENTOO_PORTAGE_EPREFIX@/sbin #Directory where system administration programs are installed
30 MANDIR=${PREFIX}/share/man #Directory where manpages are installed.
31 INITDIR=${CONFDIR}/init.d #Directory where SysV init scripts are installed.
32 INITFILE=${PRODUCT} #Name of the product's installed SysV init script
33 INITSOURCE=init.gentoo.sh #Name of the distributed file to be installed as the SysV init script
34 ANNOTATED= #If non-zero, annotated configuration files are installed
35 SYSTEMD=@GENTOO_PORTAGE_EPREFIX@/usr/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
36 SERVICEFILE=gentoo.service #Name of the distributed file to be installed as systemd service file
37 SYSCONFFILE=default.gentoo #Name of the distributed file to be installed in $SYSCONFDIR
38 SYSCONFDIR=${CONFDIR}/conf.d #Directory where SysV init parameter files are installed
39 SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
40 VARLIB=@GENTOO_PORTAGE_EPREFIX@/var/lib #Directory where product variable data is stored.
41 VARDIR=${VARLIB}/${PRODUCT} #Directory where product variable data is stored.
42
43
44
45 1.1 net-firewall/shorewall-init/files/4.5.21.4/01_Remove-ipset-functionality.patch
46
47 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/01_Remove-ipset-functionality.patch?rev=1.1&view=markup
48 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/01_Remove-ipset-functionality.patch?rev=1.1&content-type=text/plain
49
50 Index: 01_Remove-ipset-functionality.patch
51 ===================================================================
52 --- shorewall-init.old 2013-09-08 23:25:36.364924304 +0200
53 +++ shorewall-init 2013-09-08 23:29:27.418736392 +0200
54 @@ -79,10 +79,6 @@
55 fi
56 done
57
58 - if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
59 - ipset -R < "$SAVE_IPSETS"
60 - fi
61 -
62 return 0
63 }
64
65 @@ -100,13 +96,6 @@
66 fi
67 done
68
69 - if [ -n "$SAVE_IPSETS" ]; then
70 - mkdir -p $(dirname "$SAVE_IPSETS")
71 - if ipset -S > "${SAVE_IPSETS}.tmp"; then
72 - grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
73 - fi
74 - fi
75 -
76 return 0
77 }
78
79
80
81
82 1.1 net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.initd
83
84 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.initd?rev=1.1&view=markup
85 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.initd?rev=1.1&content-type=text/plain
86
87 Index: shorewall-init.initd
88 ===================================================================
89 #!/sbin/runscript
90 # Copyright 1999-2013 Gentoo Foundation
91 # Distributed under the terms of the GNU General Public License v2
92 # $Header: /var/cvsroot/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.initd,v 1.1 2013/12/02 19:58:42 constanze Exp $
93
94 SHOREWALLRC_FILE="@GENTOO_PORTAGE_EPREFIX@/usr/share/shorewall/shorewallrc"
95 CONFIG_FILE="@GENTOO_PORTAGE_EPREFIX@/etc/conf.d/${SVCNAME}"
96
97 description="Puts Shorewall in a safe state at boot time"
98 description="${description} prior to bringing up the network."
99
100 required_files="$SHOREWALLRC_FILE"
101
102 depend() {
103 need localmount
104 before net
105 after bootmisc ipset tmpfiles.setup ulogd
106 }
107
108
109 . $SHOREWALLRC_FILE
110
111 checkconfig() {
112 local PRODUCT=
113
114 if [ -z "${VARLIB}" ]; then
115 eerror "\"VARLIB\" isn't defined or empty! Please check" \
116 "\"${SHOREWALLRC_FILE}\"."
117
118
119 return 1
120 fi
121
122 if [ -z "${PRODUCTS}" ]; then
123 eerror "${SVCNAME} isn't configured! Please check" \
124 "\"${CONFIG_FILE}\"."
125
126
127 return 1
128 fi
129
130 for PRODUCT in ${PRODUCTS}; do
131 if [ ! -x ${SBINDIR}/${PRODUCT} ]; then
132 eerror "Invalid product \"${PRODUCT}\" specified" \
133 "in \"${CONFIG_FILE}\"!"
134 eerror "Maybe \"${PRODUCT}\" isn't installed?"
135
136
137 return 1
138 fi
139 done
140
141
142 return 0
143 }
144
145 check_firewall_script() {
146 if [ ! -x ${STATEDIR}/firewall ]; then
147 if [ ${PRODUCT} = shorewall -o ${PRODUCT} = shorewall6 ]; then
148 ebegin "Creating \"${STATEDIR}/firewall\""
149 ${SBINDIR}/${PRODUCT} compile 1>/dev/null
150 eend $?
151 else
152 eerror "\"${PRODUCT}\" isn't configured!"
153 eerror "Please go to your 'administrative system'" \
154 "and deploy the compiled firewall" \
155 "configuration for this system."
156
157
158 return 1
159 fi
160 fi
161
162
163 return 0
164 }
165
166 is_allowed_to_be_executed() {
167 # This is not a real service. shorewall-init is an intermediate
168 # script to put your Shorewall-based firewall into a safe state
169 # at boot time prior to bringing up the network.
170 # Please read /usr/share/doc/shorewall-init-*/README.gentoo.gz
171 # for more information.
172 # When your system is up, there is no need to call shorewall-init.
173 # Please call shorewall{,6,-lite,6-lite} directly. That's the
174 # reason why we are preventing start, stop or restart here.
175
176 local PRODUCT=
177
178 if [ "${RC_RUNLEVEL}" != "boot" -a "${RC_CMD}" = "start" ]; then
179 # Starting shorewall-init is only allowed at boot time
180 eerror "This is a boot service, which can only be started" \
181 "at boot."
182 eerror "If you want to get your shorewall-based firewall" \
183 "into the same safe boot state again, run"
184 eerror ""
185 eindent
186 for PRODUCT in ${PRODUCTS}; do
187 eerror "/etc/init.d/${PRODUCT} stop"
188 done
189 eoutdent
190 eerror ""
191 eerror "Yes, \"stop\" and not start."
192 eerror ""
193 return 1
194 fi
195
196 if [ "${RC_RUNLEVEL}" != "shutdown" -a "${RC_CMD}" = "stop" ]; then
197 # Stopping shorewall-init is only allowed at shutdown
198 eerror "This is a boot service, which cannot be stopped."
199 eerror "If you really want to stop your Shorewall-based" \
200 "firewall the same way this service would stop" \
201 "Shorewall at shutdown, please run"
202 eerror ""
203 eindent
204 for PRODUCT in ${PRODUCTS}; do
205 eerror "/etc/init.d/${PRODUCT} clear"
206 done
207 eoutdent
208 eerror ""
209 eerror "Keep in mind that this will clear (=bring down)" \
210 "your firewall!"
211 eerror ""
212 return 1
213 fi
214
215 if [ "${RC_CMD}" = "restart" ]; then
216 eerror "This is a boot service, which cannot be restarted."
217 eerror "If you want to restart any of your Shorewall-based" \
218 "firewalls, run"
219 eerror ""
220 eindent
221 for PRODUCT in ${PRODUCTS}; do
222 eerror "/etc/init.d/${PRODUCT} restart"
223 done
224 eoutdent
225 eerror ""
226 return 1
227 fi
228
229
230 return 0
231 }
232
233 set_statedir() {
234 STATEDIR=
235 local VARDIR=
236
237 if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
238 STATEDIR=$( . ${CONFDIR}/${PRODUCT}/vardir && echo ${VARDIR} )
239 fi
240
241 [ ! -n "${STATEDIR}" ] && STATEDIR=${VARLIB}/${PRODUCT}
242 }
243
244 start_pre() {
245 checkconfig || return 1
246
247 is_allowed_to_be_executed || return 1
248 }
249
250 start() {
251 local PRODUCT=
252 local STATEDIR=
253
254 for PRODUCT in ${PRODUCTS}; do
255 set_statedir
256
257 check_firewall_script || return 1
258
259 ebegin "Initializing \"${PRODUCT}\""
260 ${STATEDIR}/firewall stop 1>/dev/null
261 eend $?
262 done
263 }
264
265 stop_pre() {
266 checkconfig || return 1
267
268 is_allowed_to_be_executed || return 1
269 }
270
271 stop() {
272 local PRODUCT=
273 local STATEDIR=
274
275 for PRODUCT in ${PRODUCTS}; do
276 set_statedir
277
278 check_firewall_script || return 1
279
280 ebegin "Clearing \"${PRODUCT}\""
281 ${STATEDIR}/firewall clear 1>/dev/null
282 eend $?
283 done
284 }
285
286
287
288 1.1 net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.systemd
289
290 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.systemd?rev=1.1&view=markup
291 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.systemd?rev=1.1&content-type=text/plain
292
293 Index: shorewall-init.systemd
294 ===================================================================
295 #
296 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
297 #
298 [Unit]
299 Description=shorewall-init
300 Documentation=http://www.shorewall.net/Shorewall-init.html
301 Before=network.target
302
303 [Service]
304 Type=oneshot
305 RemainAfterExit=yes
306 ExecStart=/sbin/shorewall-init start
307 ExecStop=/sbin/shorewall-init stop
308
309 [Install]
310 WantedBy=multi-user.target
311
312
313
314 1.1 net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.confd
315
316 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.confd?rev=1.1&view=markup
317 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/shorewall-init.confd?rev=1.1&content-type=text/plain
318
319 Index: shorewall-init.confd
320 ===================================================================
321 # List the Shorewall products that Shorewall-init is to
322 # initialize (space-separated list).
323 #
324 # Sample: PRODUCTS="shorewall shorewall6-lite"
325 #
326 PRODUCTS=""
327
328 # Startup options - set verbosity to 0 (minimal reporting)
329 OPTIONS="-V0"
330
331
332
333 1.1 net-firewall/shorewall-init/files/4.5.21.4/README.Gentoo.txt
334
335 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/README.Gentoo.txt?rev=1.1&view=markup
336 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.4/README.Gentoo.txt?rev=1.1&content-type=text/plain
337
338 Index: README.Gentoo.txt
339 ===================================================================
340 shorewall-init from upstream offers two features (taken from [1]):
341
342 1. It can 'close' the firewall before the network interfaces are
343 brought up during boot.
344
345 2. It can change the firewall state as the result of interfaces
346 being brought up or taken down.
347
348 On Gentoo we only support the first feature -- the firewall lockdown during
349 boot.
350
351 We do not support the second feature, because Gentoo doesn't support a
352 if-{up,down}.d folder like other distributions do. If you would want to use
353 such a feature, you would have to add a custom action to /etc/conf.d/net
354 (please refer to the Gentoo Linux Handbook [2] for more information).
355 If you are able to add your custom {pre,post}{up,down} action, your are
356 also able to specify what shorewall{6,-lite,6-lite} should do, so there is
357 no need for upstream's scripts in Gentoo.
358
359 If you disagree with us, feel free to open a bug [3] and contribute your
360 solution for Gentoo.
361
362 Upstream's original init script also supports saving and restoring of
363 ipsets. Please use the init script from net-firewall/ipset if you need
364 such a feature.
365
366
367 [1] http://www.shorewall.net/Shorewall-init.html
368 [2] http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=5
369 [3] https://bugs.gentoo.org