-
Notifications
You must be signed in to change notification settings - Fork 1
/
greensql.spec
113 lines (92 loc) · 3.48 KB
/
greensql.spec
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
Summary: GreenSQL open source database firewall solution.
Name: greensql-fw
Version: 1.0.0
Release: 1%{dist}
License: GPL
Group: Applications/Databases
URL: http://www.greensql.net/
Source: http://easynews.dl.sourceforge.net/sourceforge/greensql/%{name}-%{version}.tar.gz
#Source: http://www.greensql.net/download/get?os=Source_Code&platform=Any&filename=greensql-fw-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildRequires: mysql-devel, pcre-devel, flex, bison, gcc-c++
%if "%{_vendor}" == "redhat"
BuildRequires: libevent-devel
%endif
%if "%{_vendor}" == "MandrakeSoft" || "%{_vendor}" == "Mandrakesoft" || "%{_vendor}" == "Mandriva" || "%{_vendor}" == "mandriva"
BuildRequires: libevent-devel
%else
BuildRequires: libevent
%endif
%if %{_vendor} == "suse"
%if %{suse_version} == 1110
BuildRequires: libevent-devel
%endif
%endif
%description
GreenSQL is an Open Source database firewall used to protect
databases from SQL injection attacks. GreenSQL works in a
proxy mode and has built in support for MySQL. The logic is
based on evaluation of SQL commands using a risk scoring
matrix as well as blocking known db administrative commands
(DROP, CREATE, etc).
%prep
%setup -q
%{?el4: perl -pi -e "s|<pcre.h>|<pcre\/pcre.h>|g" src/patterns.hpp}
%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/greensql
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
mkdir -p $RPM_BUILD_ROOT/usr/sbin
install -s -m 0755 greensql-fw $RPM_BUILD_ROOT/usr/sbin/greensql-fw
install -m 0755 scripts/greensql-create-db.sh $RPM_BUILD_ROOT/usr/sbin/
install -m 0644 conf/greensql.conf $RPM_BUILD_ROOT/etc/greensql/greensql.conf
install -m 0644 conf/mysql.conf $RPM_BUILD_ROOT/etc/greensql/mysql.conf
install -m 0644 scripts/greensql.rotate $RPM_BUILD_ROOT/etc/logrotate.d/greensql
%if "%{_vendor}" == "redhat"
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
install -m 0755 rpm/greensql-fw.redhat.init $RPM_BUILD_ROOT/etc/rc.d/init.d/greensql-fw
%endif
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
install -m 0755 rpm/greensql-fw.suse.init $RPM_BUILD_ROOT/etc/init.d/greensql-fw
#make DESTDIR=$RPM_BUILD_ROOT
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc license.txt readme.txt docs/greensql-mysql-db.txt docs/tautology.txt
%config /etc/greensql/greensql.conf
%config /etc/greensql/mysql.conf
%config /etc/logrotate.d/greensql
/usr/sbin/greensql-fw
/usr/sbin/greensql-create-db.sh
%if "%{_vendor}" == "redhat"
/etc/rc.d/init.d/greensql-fw
%endif
/etc/init.d/greensql-fw
%post
/sbin/chkconfig --add greensql-fw > /dev/null 2>&1 || true
/sbin/chkconfig greensql-fw on || true
groupadd greensql > /dev/null 2>&1 || true
if ! /usr/bin/id greensql > /dev/null 2>&1 ; then
useradd -g greensql -s /dev/null greensql > /dev/null 2>&1 || true
fi
touch /var/log/greensql.log || true
chown greensql:greensql /var/log/greensql.log || true
chown greensql:greensql -R /etc/greensql || true
#echo
#echo "Now, you need to create database used to store GreenSQL configuration.
%preun
/sbin/chkconfig --del greensql-fw > /dev/null 2>&1 || true
%postun
chmod 0600 /var/log/greensql.log > /dev/null 2>&1
chown root:root /var/log/greensql.log > /dev/null 2>&1
chmod 0700 /etc/greensql > /dev/null 2>&1
chown root:root /etc/greensql > /dev/null 2>&1
/usr/sbin/userdel -f greensql > /dev/null 2>&1
/usr/sbin/groupdel greensql > /dev/null 2>&1
true
%changelog
* Tue Oct 13 2009 David Hrbáč <[email protected]> - 1.0.0-1
- initial build