-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathufdbGuard.spec.CentOS7
386 lines (329 loc) · 14.2 KB
/
ufdbGuard.spec.CentOS7
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# ufdbGuard.spec.CentOS7
%global _hardened_build 1
%global version 1.33.7
# no stripping of the binaries
%global __os_install_post %{nil}
%define debug_package %{nil}
%define __strip /bin/true
### %__global_cflags -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags} %{_performance_cflags}
%define __global_cflags -O2 -g -pipe -Wall -grecord-gcc-switches %{_hardened_cflags} %{_performance_cflags}
Name: ufdbGuard
Version: %{version}
Release: DenyMode6.CentOS7
Summary: ufdbGuard is a URL filter for Squid
License: GNU General Public License v2.0 only
Group: Internet/Proxy
# FHS says no package may have files under /usr/local nor /opt
# Prefix: /usr/local/ufdbguard
Prefix: /usr
Provides: ufdbguardd
Provides: ufdbgclient
Provides: ufdbhttpd
Provides: ufdbsignal
Provides: ufdb-pstack
Provides: ufdbpeek
Provides: ufdbGenTable, ufdbConvertDB
Provides: ufdbUpdate
Provides: ufdbAnalyse
Provides: ufdb_analyse_urls, ufdb_analyse_users, ufdb_top_urls, ufdb_top_users
URL: http://www.urlfilterdb.com/
# The sources for many versions of ufdbGuard are on sourceforge.net (Source0)
# The latest version can also be downloaded from URLfilterDB (Source1)
Source: https://www.urlfilterdb.com/files/downloads/%{name}-%{version}.tar.gz
# Source0: http://sourceforge.net/projects/ufdbguard/
# Source1: http://www.urlfilterdb.com/en/downloads/software_doc.html
# Buildroot: /local/src/ufdbGuard-%{version}
# Buildroot: .
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot-%(%{__id_u} -n)
# required packages for ufdbguardd
Requires: glibc >= 2.17
Requires: openssl >= 1.0.1e
Requires: bzip2-libs >= 1.0.6
Requires: zlib >= 1.2.7
# required packages for ufdbUpdate
Requires: wget >= 1.14
Requires: tar, gzip
# require packages for ufdb-pstack
Requires: gdb >= 7.6.1
# Requires: yum-utils >= 1.1.31
# required packages for installation
# Requires: at
# required packages for analysis scripts
Requires: perl
%global __requires_exclude %{?__requires_exclude}|perl\\(CGI::|perl\\(FCGI::
# squid is required but may be installed from source and not using an RPM,
# or ufdbguard is used on a system where squid is not installed.
# Requires: squid
Buildrequires: openssl-devel >= 1.0.1e
Buildrequires: bzip2-devel >= 1.0.6
Buildrequires: zlib-devel >= 1.2.7
Buildrequires: make, gcc, bison, flex
Buildrequires: bind-utils
# TODO: %_initddir is macro for /etc/rc.d/init.d
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(pre): shadow-utils
%description
ufdbGuard is a free URL filter for Squid with additional features like
SafeSearch enforcement for a large number of search engines, safer HTTPS
visits and dynamic detection of proxies (URL filter circumventors).
ufdbGuard supports free and commercial URL databases that can be
downloaded from various sites and vendors.
You can also make your own URL database for ufdbGuard.
%post
echo >&2
echo "ufdbGuard is installed." >&2
echo "See the Reference Manual for further instructions and configuration." >&2
echo "Seek help at https://www.urlfilterdb.com in case you have a question or an issue." >&2
echo >&2
job=`grep ufdbUpdate /var/spool/cron/* 2>/dev/null | grep -v "^#" `
if [ "$job" = "" ]
then
echo "There is not yet a cron job for ufdbUpdate *****" >&2
echo >&2
fi
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add ufdb
#
# echo "#!/bin/sh" > /tmp/ufdb.postinstall
# echo "echo Updating debuginfo ..." >> /tmp/ufdb.postinstall
# echo "debuginfo-install -y -q glibc >/dev/null 2>&1" >> /tmp/ufdb.postinstall
# echo "debuginfo-install -y -q zlib >/dev/null 2>&1" >> /tmp/ufdb.postinstall
# echo "debuginfo-install -y -q bzip2 >/dev/null 2>&1" >> /tmp/ufdb.postinstall
# echo "debuginfo-install -y -q openssl >/dev/null 2>&1" >> /tmp/ufdb.postinstall
# chmod +x /tmp/ufdb.postinstall
# #
# echo "The installation of the ufdbGuard package is almost finished." >&2
# echo "Execute /tmp/ufdb.postinstall to update debuginfo for glibc, zlib, bzip2 and openssl. *****" >&2
# echo >&2
/usr/bin/sh >/tmp/ufdbguardd.postinstall.log 2>&1 <<EOF &
sleep 180
debuginfo-install -y -q glibc >/dev/null 2>&1
debuginfo-install -y -q zlib >/dev/null 2>&1
debuginfo-install -y -q bzip2 >/dev/null 2>&1
debuginfo-install -y -q openssl >/dev/null 2>&1
EOF
#
# TODO: run check_dns
%preun
if [ $1 = 0 ] ; then
/sbin/service ufdb stop >/dev/null 2>&1
/sbin/chkconfig --del ufdb
fi
# for pre-F13:
%clean
[ %{buildroot} != "/" ] && echo rm -rf %{buildroot}
# ufdbGuard is installed with user ufdb and group ufdb
%pre
# set -x
getent group ufdb >/dev/null || groupadd -r ufdb
getent passwd ufdb >/dev/null || \
useradd -r -g ufdb -d /var/ufdbguard -M -s /usr/bin/sh \
-c "ufdbGuard URL filter" ufdb
exit 0
%prep
# echo prep in %{buildroot}
# set -x
# TODO %setup -q
%setup -q
%build
echo build in `pwd`
%configure \
--with-ufdb-user=ufdb \
--prefix=/usr \
--with-ufdb-bindir=/usr/sbin \
--with-ufdb-piddir=/var/run/ufdbguard \
--with-ufdb-mandir=/usr/share/man \
--with-ufdb-images_dir=/var/ufdbguard/images \
--with-ufdb-logdir=/var/ufdbguard/logs \
--with-ufdb-samplesdir=/var/ufdbguard/samples \
--with-ufdb-config=/etc/ufdbguard \
--with-ufdb-dbhome=/var/ufdbguard/blacklists
%{__make} %{?_smp_mflags}
%install
# echo install
# env
[ %{buildroot} != "/" ] && rm -rf %{buildroot}
%{__make} DESTDIR=%{buildroot} mkdirsredhatcentos install
# the install makes a backup of the conf file that we do not want in the package
rm -f %{buildroot}/etc/ufdbguard/ufdbGuard.conf.pre-v1.*
# echo
# echo "The configuration file of ufdbGuard is /etc/ufdbguard/ufdbGuard.conf"
# echo "The system configuration file for the ufdbGuard Software Suite is /etc/sysconfig/ufdbguard"
# ufdbsignal is suid-root since it must be able to send a signal to ufdbguardd.
# ufdbsignal is a very simple program which checks the uid to see if the user is permitted to send a signal.
# ufdbsignal reads the pid from /var/run/ufdbguardd/ufdbguardd.pid.
%verifyscript
if [ ! -f /etc/sysconfig/ufdbguard ]
then
echo "/etc/sysconfig/ufdbguard does not exist." >&2
else
eval `grep "^DOWNLOAD_USER=" /etc/sysconfig/ufdbguard`
if [ "$DOWNLOAD_USER" = "" ]
then
echo "The username for periodical downloads of the URL database is not set." >&2
echo "Edit /etc/sysconfig/ufdbguard and set DOWNLOAD_USER and DOWNLOAD_PASSWORD." >&2
else
echo "DOWNLOAD_USER is set to $DOWNLOAD_USER in /etc/sysconfig/ufdbguard"
fi
fi
if [ ! -f /etc/ufdbguard/ufdbGuard.conf ]
then
echo "/etc/ufdbguard/ufdbGuard.conf does not exist."
else
set -- `grep ^dbhome /etc/ufdbguard/ufdbGuard.conf`
# must get rid of quotes or else "if [ ! -d $DBDIR ]" fails :-(
DBDIR=`echo ${2:-notset} | sed -e 's,",,g' `
if [ $DBDIR = notset ]
then
DBDIR=/var/ufdbguard/blacklists
echo "/etc/ufdbguard/ufdbGuard.conf: dbhome is not set" >&2
echo "Using default value for dbhome: $DBDIR" >&2
fi
if [ ! -d $DBDIR ]
then
echo "/etc/ufdbguard/ufdbGuard.conf: dbhome $DBDIR: directory does not exist" >&2
else
if [ ! -d $DBDIR/adult -o ! -d $DBDIR/checked ]
then
echo "/etc/ufdbguard/ufdbGuard.conf: dbhome $DBDIR:" >&2
echo "The directory for the URL database does not contain subdirectories for adult and/or checked." >&2
echo "This means that the URL database of URLfilterDB is not used." >&2
echo "If you intend to use the URL database of URLfilterDB, make sure that " >&2
echo "\"ufdbUpdate [-v]\" runs without errors to download the URL database." >&2
echo "See the Reference Manual for more information." >&2
fi
fi
fi
exit 0
%postun
job=`grep ufdbUpdate /var/spool/cron/* 2>/dev/null | grep -v "^#" `
if [ "$job" != "" ]
then
echo "Note: there is still a cron job for ufdbUpdate." >&2
fi
exit 0
# %config
# /etc/sysconfig/ufdbguard
# /etc/ufdbguard/ufdbGuard.conf
%files
%defattr(-,root,root,-)
/etc/init.d/ufdb
%config(noreplace) %attr(-,ufdb,ufdb) /etc/sysconfig/ufdbguard
%config(noreplace) %attr(-,ufdb,ufdb) /etc/ufdbguard/ufdbGuard.conf
/var/ufdbguard/images/default.flv
/var/ufdbguard/images/default.mp3
/var/ufdbguard/images/default.mpeg
/var/ufdbguard/images/default.wmv
/var/ufdbguard/images/forbidden-normal-de.png
/var/ufdbguard/images/forbidden-normal-en.png
/var/ufdbguard/images/forbidden-normal-es.png
/var/ufdbguard/images/forbidden-normal-fr.png
/var/ufdbguard/images/forbidden-normal-it.png
/var/ufdbguard/images/forbidden-normal-nl.png
/var/ufdbguard/images/forbidden-normal-pl.png
/var/ufdbguard/images/forbidden-normal-pt.png
/var/ufdbguard/images/forbidden-normal-sv.png
/var/ufdbguard/images/forbidden-normal-tr.png
/var/ufdbguard/images/no-ads.png
/var/ufdbguard/images/smallcross.png
/var/ufdbguard/images/square.png
/var/ufdbguard/images/transparent.png
/var/ufdbguard/samples/execdomainlist.sh
/var/ufdbguard/samples/execuserlist.sh
/var/ufdbguard/samples/URLblocked.cgi
/usr/sbin/ufdb-pstack
/usr/sbin/ufdbAnalyse
/usr/sbin/ufdbConvertDB
/usr/sbin/ufdbGenTable
/usr/sbin/ufdbUpdate
/usr/sbin/ufdb_analyse_urls
/usr/sbin/ufdb_analyse_users
/usr/sbin/ufdb_top_urls
/usr/sbin/ufdb_top_users
/usr/sbin/ufdbgclient
/usr/sbin/ufdbguardd
/usr/sbin/ufdbhttpd
%attr(4755,root,root) /usr/sbin/ufdbsignal
/usr/share/man/man1/ufdb_analyse_urls.1
/usr/share/man/man1/ufdb_analyse_users.1
/usr/share/man/man1/ufdb_top_urls.1
/usr/share/man/man1/ufdb_top_users.1
/usr/share/man/man1/ufdbAnalyse.1
/usr/share/man/man8/ufdbgclient.8
/usr/share/man/man8/ufdbguardd.8
/usr/share/man/man8/ufdbhttpd.8
/usr/share/man/man8/ufdbupdate.8
%dir %attr(-,ufdb,ufdb) /var/ufdbguard/blacklists
%dir %attr(-,ufdb,ufdb) /var/ufdbguard/blacklists/security
# The cacerts get updated by ufdbUpdate:
%verify(not md5 size mtime) %attr(644,ufdb,ufdb) /var/ufdbguard/blacklists/security/cacerts
# log files go to /var/ufdbguard/logs
%dir %attr(-,ufdb,ufdb) /var/ufdbguard/logs
# pid files go to /var/run/ufdbguard
%dir %attr(755,ufdb,ufdb) /var/run/ufdbguard
%doc README CHANGELOG
# TODO
%changelog
* Thu Dec 06 2018 Evgeny Sinelnikov <[email protected]> - 1.33.7-DenyMode6
Add: new option firewall-mode, which search acl for all sources rule by rule
* Thu Nov 29 2018 Evgeny Sinelnikov <[email protected]> - 1.33.7-DenyMode5
Fix: set redirect-https by default to: https://127.0.0.1:55555/123asd.html
* Mon Oct 15 2018 Evgeny Sinelnikov <[email protected]> - 1.33.7-DenyMode4
Add: support redirect-static-url option (enabled by default)
* Sun Oct 14 2018 Evgeny Sinelnikov <[email protected]> - 1.33.7-DenyMode3
Add: support redirect-default-url option
(as "http://cgibin.urlfilterdb.com/cgi-bin/URLblocked.cgi?" prefix for redirect)
* Wed Oct 10 2018 Evgeny Sinelnikov <[email protected]> - 1.33.7-DenyMode2
Add: support reuse-acl-names option (enabled by default)
* Mon Oct 08 2018 Evgeny Sinelnikov <[email protected]> - 1.33.7-DenyMode1
Add: support deny-mode option (enabled by default)
* Wed Jul 25 2018 Marcus Kool <[email protected]> - 1.33.7
Fix: implement workaround for fatal bug in gcc 4.x with -O3 that causes ufdbguardd to dump core
Fix: the pidfile parameter was not used and the pid was written to the default pidfile
Fix: on blocking https sites, the final block page was not shown without ssl_bump
* Mon May 28 2018 Marcus Kool <[email protected]> - 1.33.6
Fix: ufdbguardd incorrectly blocked URLs that use HTTPS
* Thu Apr 19 2018 Marcus Kool <[email protected]> - 1.33.5
Fix: ufdbguardd may crash during a database refresh
Fix: empty pass statements in acls may cause a crash.
Fix: SSH tunnels were detected but access was not blocked
Fix: sometimes the SSL/TLS certificate was not checked to be signed by a CA
Fix: skip acls with "pass any" if the source has the continue flag set
* Thu Sep 21 2017 Marcus Kool <[email protected]> - 1.33.4
Fix: URLs with very long domainnames may cause a crash if the URL is not in the URL database
Fix: ufdbguardd did not obey 'continue' inside a source
Fix: the logfile did not not contain "PASS URL" for all allowed URLs
Fix: suppress another warning by ufdbGenTable if the -q option is used
Fix: execuserlist with large arguments cannot be cached
Fix: ufdbguardd sometimes does not use the correct source for its decision
Fix: in-addr also matched URLs without an IP address
Configuration: the option squid-uses-active-bumping was missing in the default configuration file
* Tue Jun 6 2017 Marcus Kool <[email protected]> - 1.33.3
Fix: ufdbgclient truncates Squid request lines to 8K which means that very long URLs cannot be filtered
Fix: ufdbGenTable erroneously warned about URLs inside a comment
Fix: make ufdbGuard compile on FreeBSD
Fix: when evaluate-and IPv4/6 is used in a source definition, the source may not matched
Fix: ufdbguardd did not accept the IPv6 address '::'
Enhancement: several warnings for IPv4 and IPv6 addresses inside a source were implemented
* Tue May 23 2017 Marcus Kool <[email protected]> - 1.33.2
Fix: ufdbguardd may incorrectly abort with a fatal error cannot-get-rwlock-for-database-refresh-after-many-attempts
Fix: safesearch did not work in 2 out of 3 cases
Fix: ufdbguard did not compile on FreeBSD.
Fix: crash due to stack overwrite in uploadStatistics/logStatistics
Documentation: added use-ipv6-on-wan option to Reference Manual
* Wed Mar 15 2017 Marcus Kool <[email protected]> - 1.33.1
Enhancement: IPv6 support for sources with new keywords ipv6 and ipv6list
Enhancement: detect certificates of ucweb.com and uc.cn of the ucweb browser that circumvents URL filters
Enhancement: ufdbgclient has new -m parameter to use multithreading and improve performance
Enhancement: make ufdbguardd.pid world-readable
Enhancement: allow UTF8 characters in URLs
Enhancement: new keyword ufdb-log-url-details controls if URLs in the log file have parameters or not
Fix: on the ARM platform generated URL tables were corrupt
Fix: implicitly allowed URLs were logged with category "any" instead of the correct category ID
Fix: prevent false positives with Tor proxy detection on port 443
Fix: failed probes for <IP>:443 were not properly cached and resulted in too many probes for IP
Fix: when reverse IP lookups are used, the URL category was not logged correctly (was logged as "any")
Fix: ufdbGenTable uses less memory
Fix: the feature "block-bumped-connect on" never blocked a CONNECT request