aboutsummaryrefslogtreecommitdiff
path: root/base/firewall/firewall.build
blob: 3216c74c7d35fbd2d42e75928ebf9cb6506eda2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=firewall
VERSION=$(date '+%Y%m%d')
BUILD=1

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: firewall
${NAME}:
${NAME}: Tools and libraries for network firewalls.
${NAME}:
${NAME}: Homepage: http://www.netfilter.org
${NAME}:
${NAME}:
${NAME}:
${NAME}:
${NAME}:
${NAME}:
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

config etc/iptables/conntrackd.conf.new
config etc/iptables/ipset.conf.new
config etc/iptables/arptables.conf.new
EOF

# Sources

SRCNAME[0]=libmnl
SRCVERS[0]=1.0.3
SRCPACK[0]=http://ftp.netfilter.org/pub/${SRCNAME[0]}/${SRCNAME[0]}-${SRCVERS[0]}.tar.bz2
SRCCOPY[0]="LGPL21"

configure()
{
sed -i 's|$(libdir)/pkgconfig|$(datarootdir)/pkgconfig|g' Makefile.in
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --disable-dependency-tracking \
 --disable-silent-rules \
 --enable-static=no \
 --enable-shared=yes \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}/iptables" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}" \
 ${*}
}

build0()
{
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[1]=libnfnetlink
SRCVERS[1]=1.0.1
SRCPACK[1]=http://ftp.netfilter.org/pub/${SRCNAME[1]}/${SRCNAME[1]}-${SRCVERS[1]}.tar.bz2
SRCCOPY[1]="GPL2"

build1()
{
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[2]=libnetfilter_log
SRCVERS[2]=1.0.1
SRCPACK[2]=http://ftp.netfilter.org/pub/${SRCNAME[2]}/${SRCNAME[2]}-${SRCVERS[2]}.tar.bz2
SRCCOPY[2]="GPL2"

build2()
{
LIBNFNETLINK_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNFNETLINK_LIBS="-L${PKG}${SYS_DIR[lib]} -lnfnetlink" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[3]=libnetfilter_conntrack
SRCVERS[3]=1.0.3
SRCPACK[3]=http://ftp.netfilter.org/pub/${SRCNAME[3]}/${SRCNAME[3]}-${SRCVERS[3]}.tar.bz2
SRCCOPY[3]="GPL2"

build3()
{
LIBMNL_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBMNL_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
LIBNFNETLINK_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNFNETLINK_LIBS="-L${PKG}${SYS_DIR[lib]} -lnfnetlink" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[4]=libnetfilter_queue
SRCVERS[4]=1.0.2
SRCPACK[4]=http://ftp.netfilter.org/pub/${SRCNAME[4]}/${SRCNAME[4]}-${SRCVERS[4]}.tar.bz2
SRCCOPY[4]="GPL2"

build4()
{
LIBMNL_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBMNL_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
LIBNFNETLINK_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNFNETLINK_LIBS="-L${PKG}${SYS_DIR[lib]} -lnfnetlink" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[5]=libnetfilter_acct
SRCVERS[5]=1.0.2
SRCPACK[5]=http://ftp.netfilter.org/pub/${SRCNAME[5]}/${SRCNAME[5]}-${SRCVERS[5]}.tar.bz2
SRCCOPY[5]="GPL2"

build5()
{
LIBMNL_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBMNL_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[6]=libnetfilter_cthelper
SRCVERS[6]=1.0.0
SRCPACK[6]=http://ftp.netfilter.org/pub/${SRCNAME[6]}/${SRCNAME[6]}-${SRCVERS[6]}.tar.bz2
SRCCOPY[6]="GPL2"

build6()
{
LIBMNL_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBMNL_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[7]=libnetfilter_cttimeout
SRCVERS[7]=1.0.0
SRCPACK[7]=http://ftp.netfilter.org/pub/${SRCNAME[7]}/${SRCNAME[7]}-${SRCVERS[7]}.tar.bz2
SRCCOPY[7]="GPL2"

build7()
{
LIBMNL_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBMNL_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[8]=nfacct
SRCVERS[8]=1.0.1
SRCPACK[8]=http://ftp.netfilter.org/pub/${SRCNAME[8]}/${SRCNAME[8]}-${SRCVERS[8]}.tar.bz2
SRCCOPY[8]="GPL2"

build8()
{
LIBMNL_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBMNL_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
LIBNETFILTER_ACCT_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNETFILTER_ACCT_LIBS="-L${PKG}${SYS_DIR[lib]} -lnetfilter_acct" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
}

SRCNAME[9]=conntrack-tools
SRCVERS[9]=1.4.1
SRCPACK[9]=http://ftp.netfilter.org/pub/${SRCNAME[9]}/${SRCNAME[9]}-${SRCVERS[9]}.tar.bz2
SRCCOPY[9]="GPL2"

build9()
{
rm -f ${PKG}${SYS_DIR[lib]}/*.la
LIBMNL_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBMNL_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
LIBNFNETLINK_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNFNETLINK_LIBS="-L${PKG}${SYS_DIR[lib]} -lnfnetlink" \
LIBNETFILTER_CONNTRACK_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNETFILTER_CONNTRACK_LIBS="-L${PKG}${SYS_DIR[lib]} -lnetfilter_conntrack" \
LIBNETFILTER_CTTIMEOUT_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNETFILTER_CTTIMEOUT_LIBS="-L${PKG}${SYS_DIR[lib]} -lnetfilter_cttimeout" \
LIBNETFILTER_CTHELPER_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNETFILTER_CTHELPER_LIBS="-L${PKG}${SYS_DIR[lib]} -lnetfilter_cthelper" \
LIBNETFILTER_QUEUE_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
LIBNETFILTER_QUEUE_LIBS="-L${PKG}${SYS_DIR[lib]} -lnetfilter_queue" \
configure
make ${JOBS} V=1
make install DESTDIR="${PKG}"
doc AUTHORS
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat conntrackd.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dir ${PKG}${SYS_DIR[etc]}/iptables
install.cfg doc/helper/conntrackd.conf ${PKG}${SYS_DIR[etc]}/iptables/conntrackd.conf.new
install.dir ${PKG}${SYS_DIR[etc]}/tmpfiles.d
install.dat conntrackd.conf.tmpfiles ${PKG}${SYS_DIR[etc]}/tmpfiles.d/conntrackd.conf
}

SRCNAME[10]=iptables
SRCVERS[10]=1.4.18
SRCPACK[10]=http://ftp.netfilter.org/pub/${SRCNAME[10]}/${SRCNAME[10]}-${SRCVERS[10]}.tar.bz2
SRCCOPY[10]="GPL2"

build10()
{
sed -i 's|${libdir}/pkgconfig|${datarootdir}/pkgconfig|g' configure
sed -i 's|${datadir}/xtables|${datadir}/net|g' configure
rm include/linux/types.h
libnfnetlink_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
libnfnetlink_LIBS="-L${PKG}${SYS_DIR[lib]} -lnfnetlink" \
LDFLAGS="-L${PKG}${SYS_DIR[lib]}" \
configure \
 --enable-devel \
 --enable-libipq \
 --with-xtlibdir=${SYS_DIR[lib]}/plugins/xtables
make ${JOBS} V=1
make install DESTDIR="${PKG}"
sed -i "s|@SYSTEMDSYSTEMSCRIPTDIR@|${SYS_DIR[systemdsystemscriptdir]}|g" ip{,6}tables.service
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat ip{,6}tables.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dir ${PKG}${SYS_DIR[systemdsystemscriptdir]}
install.bin iptables-flush ${PKG}${SYS_DIR[systemdsystemscriptdir]}
install.dir ${PKG}${SYS_DIR[etc]}/iptables
install.dat rules/{empty,simple_firewall}.rules ${PKG}${SYS_DIR[etc]}/iptables
install.dir ${PKG}${SYS_DIR[var]}/lib/ip{,6}tables
install.dat rules/empty-{filter,mangle,nat,raw,security}.rules ${PKG}${SYS_DIR[var]}/lib/iptables
install.dat rules/empty-{filter,mangle,nat,raw,security}.rules ${PKG}${SYS_DIR[var]}/lib/ip6tables
}

SRCNAME[11]=ipset
SRCVERS[11]=6.17
SRCPACK[11]=http://ftp.netfilter.org/pub/${SRCNAME[11]}/${SRCNAME[11]}-${SRCVERS[11]}.tar.bz2
SRCCOPY[11]="GPL2"

build11()
{
libmnl_CFLAGS="-I${PKG}${SYS_DIR[include]}" \
libmnl_LIBS="-L${PKG}${SYS_DIR[lib]} -lmnl" \
LDFLAGS="-L${PKG}${SYS_DIR[lib]}" \
configure \
 --with-kmod=no
make ${JOBS} V=1
make install DESTDIR="${PKG}"
changelog ChangeLog
sed -i "s|@SYSTEMDSYSTEMSCRIPTDIR@|${SYS_DIR[systemdsystemscriptdir]}|g" ipset.service
install.dir ${PKG}${SYS_DIR[etc]}/iptables
touch ${PKG}${SYS_DIR[etc]}/iptables/ipset.conf.new
install.dir ${PKG}${SYS_DIR[share]}/pkgconfig
install.dat lib/libipset.pc ${PKG}${SYS_DIR[share]}/pkgconfig
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat ipset.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dir ${PKG}${SYS_DIR[systemdsystemscriptdir]}
install.bin ipset-systemd ${PKG}${SYS_DIR[systemdsystemscriptdir]}/ipset
install.dir ${PKG}${SYS_DIR[bashcompletiondir]}
install.dat utils/ipset_bash_completion/ipset_bash_completion \
 ${PKG}${SYS_DIR[bashcompletiondir]}/ipset
}

SRCNAME[12]=arptables
SRCVERS[12]=v0.0.4
SRCPACK[12]=${URL[sf]}/ebtables/arptables/${SRCNAME[12]}-${SRCVERS[12]}/${SRCNAME[12]}-${SRCVERS[12]}.tar.gz
SRCCOPY[12]="GPL2"

build12()
{
make ${JOBS}
make install DESTDIR="${PKG}" \
 PREFIX="${SYS_DIR[usr]}" MANDIR="${SYS_DIR[man]}"
sed -i "s|@SYSTEMDSYSTEMSCRIPTDIR@|${SYS_DIR[systemdsystemscriptdir]}|g" arptables.service
install.dir ${PKG}${SYS_DIR[etc]}/iptables
touch ${PKG}${SYS_DIR[etc]}/iptables/arptables.conf.new
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat arptables.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dir ${PKG}${SYS_DIR[systemdsystemscriptdir]}
install.bin arptables.systemd ${PKG}${SYS_DIR[systemdsystemscriptdir]}/arptables
rm -rf ${PKG}${SYS_DIR[etc]}/rc.d
}