cluebringer.spec 4.75 KB
Newer Older
Nigel Kukard's avatar
Nigel Kukard committed
1
%global apacheconfdir %{_sysconfdir}/httpd/conf.d
2
# this path is hardcoded
Nigel Kukard's avatar
Nigel Kukard committed
3
4
%global cblibdir %{_libdir}/cbpolicyd-2.1
%global awitptlibdir %{_libdir}/cbpolicyd-2.1
5
6
7

Summary: Postfix Policy Daemon
Name: cluebringer
Nigel Kukard's avatar
Nigel Kukard committed
8
9
Version: @PKG_VER_MAIN@
Release: @PKG_VER_REL@
10
License: GPLv2
Nigel Kukard's avatar
Nigel Kukard committed
11
Group: System Environment/Daemons
12
URL: http://www.policyd.org
Nigel Kukard's avatar
Nigel Kukard committed
13
Source0: http://downloads.policyd.org/%{version}/%{name}-%{version}-%{release}.tar.xz
14
15
16
17

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch

Nigel Kukard's avatar
Nigel Kukard committed
18
19
20
21
22
# Provide policyd
Provides: cbpolicyd = %{version}-%{release}
Provides: policyd = %{version}-%{release}
# Obsolete old policyd
Obsoletes: policyd < %{version}
23

Nigel Kukard's avatar
Nigel Kukard committed
24
25
26
27
28
29
30
Requires: perl(Cache::FastMmap)
Requires: perl(Config::IniFiles)
Requires: perl(Date::Parse)
Requires: perl(DBI)
Requires: perl(Net::CIDR)
Requires: perl(Net::DNS)
Requires: perl(Net::Server)
31

Nigel Kukard's avatar
Nigel Kukard committed
32
33
34
35
36
Requires: httpd
Requires: mysql-server

AutoReq: no
AutoProv: no
37
38
39


%description
Nigel Kukard's avatar
Nigel Kukard committed
40
PolicyD v2 (codenamed "cluebringer") is a multi-platform policy server
41
42
43
44
45
for popular MTAs. This policy daemon is designed mostly for large
scale mail hosting environments. The main goal is to implement as many
spam combating and email compliance features as possible while at the
same time maintaining the portability, stability and performance
required for mission critical email hosting of today. Most of the
Nigel Kukard's avatar
Nigel Kukard committed
46
ideas and methods implemented in PolicyD v2 stem from PolicyD v1
47
48
49
50
51
as well as the authors' long time involvement in large scale mail
hosting industry.


%prep
Nigel Kukard's avatar
Nigel Kukard committed
52
%setup -q -n @PKG_DIR_RPM@
53
54
55
56
57


%build
cd database
for db_type in mysql4 mysql pgsql sqlite; do
Nigel Kukard's avatar
Nigel Kukard committed
58
	./convert-tsql ${db_type} core.tsql > cbpolicyd.${db_type}.sql
59
60
	for file in `find . -name \*.tsql -and -not -name core.tsql`; do
		./convert-tsql ${db_type} ${file}
Nigel Kukard's avatar
Nigel Kukard committed
61
	done >> cbpolicyd.${db_type}.sql
62
	cd whitelists
Nigel Kukard's avatar
Nigel Kukard committed
63
64
		./parse-checkhelo-whitelist >> cbpolicyd.${db_type}.sql
		./parse-greylisting-whitelist >> cbpolicyd.${db_type}.sql
65
66
67
68
69
70
71
72
	cd ..
done


%install
rm -rf $RPM_BUILD_ROOT


Nigel Kukard's avatar
Nigel Kukard committed
73
# cbpolicyd
74
mkdir -p $RPM_BUILD_ROOT%{cblibdir}
75
mkdir -p $RPM_BUILD_ROOT%{awitptlibdir}
76
77
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
Nigel Kukard's avatar
Nigel Kukard committed
78
79
80
81
82
83
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cbpolicyd
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/cbpolicyd
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/cbpolicyd

84
cp -R cbp $RPM_BUILD_ROOT%{cblibdir}
Nigel Kukard's avatar
Nigel Kukard committed
85
cp -R awitpt/awitpt $RPM_BUILD_ROOT%{awitptlibdir}
86
install -m 755 cbpolicyd cbpadmin database/convert-tsql $RPM_BUILD_ROOT%{_sbindir}
Nigel Kukard's avatar
Nigel Kukard committed
87
88
install -m 644 cluebringer.conf $RPM_BUILD_ROOT%{_sysconfdir}/cbpolicyd/cluebringer.conf
install -m 644 contrib/cluebringer.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/cluebringer
89
install -m 755 contrib/initscripts/Fedora/cbpolicyd $RPM_BUILD_ROOT%{_initrddir}
Nigel Kukard's avatar
Nigel Kukard committed
90
91
install -m 755 contrib/cluebringer.cron $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/cluebringer

92
93

# Webui
Nigel Kukard's avatar
Nigel Kukard committed
94
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/webui
95
mkdir -p $RPM_BUILD_ROOT%{apacheconfdir}
Nigel Kukard's avatar
Nigel Kukard committed
96
cp -R webui/* $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/
97
install -m 644 contrib/httpd/cluebringer-httpd.conf $RPM_BUILD_ROOT%{apacheconfdir}/cluebringer.conf
98
# Move config into /etc
Nigel Kukard's avatar
Nigel Kukard committed
99
100
101
mv $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/includes/config.php $RPM_BUILD_ROOT%{_sysconfdir}/cbpolicyd/webui.conf
ln -s %{_sysconfdir}/cbpolicyd/webui.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/includes/config.php
chmod 0640 $RPM_BUILD_ROOT%{_sysconfdir}/cbpolicyd/webui.conf
102
103
104

# Docdir
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/database
Nigel Kukard's avatar
Nigel Kukard committed
105
install -m 644 AUTHORS INSTALL LICENSE TODO ChangeLog WISHLIST $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
Nigel Kukard's avatar
Nigel Kukard committed
106
107
108
109
110
111
112
cp -R contrib $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/
cp -R database $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/


%pre
/usr/sbin/groupadd cbpolicyd 2>/dev/null || :
/usr/sbin/useradd -d / -s /sbin/nologin -c "PolicyD User" -g cbpolicyd cbpolicyd 2>/dev/null || :
113
114
115
116
117


%post
/sbin/chkconfig --add cbpolicyd

Nigel Kukard's avatar
Nigel Kukard committed
118
119
120
121
%preun
/sbin/service cbpolicyd stop
/sbin/chkconfig --del cbpolicyd

122
123
124
125
126
127
128

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
129
%doc %{_docdir}/%{name}-%{version}
130
131
132
133
134
%{cblibdir}/
%{_sbindir}/cbpolicyd
%{_sbindir}/cbpadmin
%{_sbindir}/convert-tsql
%{_initrddir}/cbpolicyd
Nigel Kukard's avatar
Nigel Kukard committed
135
136
%dir %attr(0700,cbpolicyd,cbpolicyd) %{_localstatedir}/run/cbpolicyd
%dir %attr(0700,cbpolicyd,cbpolicyd) %{_localstatedir}/log/cbpolicyd
Nigel Kukard's avatar
Nigel Kukard committed
137
138
139
140

%dir %{_datadir}/%{name}
%attr(-,root,apache) %{_datadir}/%{name}/webui/

Nigel Kukard's avatar
Nigel Kukard committed
141
142
143
144
145
%dir %{_sysconfdir}/cbpolicyd
%config(noreplace) %{_sysconfdir}/logrotate.d/cluebringer
%config(noreplace) %{_sysconfdir}/cron.daily/cluebringer
%config(noreplace) %attr(0600,cbpolicyd,cbpolicyd) %{_sysconfdir}/cbpolicyd/cluebringer.conf
%config(noreplace) %attr(0640,cbpolicyd,apache) %{_sysconfdir}/cbpolicyd/webui.conf
Nigel Kukard's avatar
Nigel Kukard committed
146

147
148
149
150
%config(noreplace) %{apacheconfdir}/cluebringer.conf


%changelog