dovecot/dovecot.spec

Mon, 20 Apr 2009 19:22:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 20 Apr 2009 19:22:00 +0200
changeset 178
0ba300bdf30a
parent 161
79e49c6c1eb1
child 187
0cbfb8a2de97
permissions
-rw-r--r--

Change unfortunate but partly useful overreaching security tradeoff.
The principle of allocating each running process an individual system
user and group can have security benefits, however maintining a plethora
of users, groups, processes, file modes, file permissions, and even
nonportable file ACLs on a host serving from a hundred processes has
some security disadvantages. This tradeoff is even worse for systems
like OpenPKG which benefit from administration transparency through the
use of minimal system intrusion and only three usage privilege levels.

michael@148 1 ##
michael@148 2 ## dovecot.spec -- OpenPKG RPM Package Specification
michael@148 3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@148 4 ##
michael@148 5 ## Permission to use, copy, modify, and distribute this software for
michael@148 6 ## any purpose with or without fee is hereby granted, provided that
michael@148 7 ## the above copyright notice and this permission notice appear in all
michael@148 8 ## copies.
michael@148 9 ##
michael@148 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@148 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@148 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@148 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@148 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@148 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@148 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@148 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@148 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@148 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@148 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@148 21 ## SUCH DAMAGE.
michael@148 22 ##
michael@148 23
michael@148 24 # package version
michael@148 25 %define V_major 1.1
michael@148 26 %define V_minor 13
michael@148 27 %define V_minor_sieve 6
michael@148 28 %define V_minor_managesieve 1
michael@148 29 %define V_managesieve 0.10.3
michael@148 30
michael@148 31 # package information
michael@148 32 Name: dovecot
michael@148 33 Summary: IMAP4 & POP3 Server
michael@148 34 URL: http://www.dovecot.org/
michael@148 35 Vendor: Timo Sirainen et al.
michael@148 36 Packager: OpenPKG Foundation e.V.
michael@148 37 Distribution: OpenPKG Community
michael@148 38 Class: EVAL
michael@148 39 Group: Mail
michael@148 40 License: MIT+LGPL
michael@148 41 Version: %{V_major}.%{V_minor}
michael@168 42 Release: 20090416
michael@148 43
michael@148 44 # package options
michael@148 45 %option with_fsl yes
michael@148 46 %option with_pam yes
michael@148 47 %option with_ldap no
michael@148 48 %option with_mysql no
michael@148 49 %option with_pgsql no
michael@148 50 %option with_sqlite no
michael@148 51 %option with_pop3d no
michael@148 52 %option with_managesieve no
michael@148 53 %option with_sieve yes
michael@148 54
michael@148 55 # list of sources
michael@148 56 Source0: http://www.dovecot.org/releases/%{V_major}/dovecot-%{V_major}.%{V_minor}.tar.gz
michael@148 57 Source1: http://www.dovecot.org/releases/sieve/dovecot-sieve-%{V_major}.%{V_minor_sieve}.tar.gz
michael@148 58 Source2: fsl.dovecot
michael@148 59 Source3: rc.dovecot
michael@148 60 Patch0: dovecot.patch
michael@148 61 Patch1: http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}.%{V_minor_managesieve}-managesieve-%{V_managesieve}.diff.gz
michael@148 62
michael@148 63 # build information
michael@148 64 Prefix: %{l_prefix}
michael@148 65 BuildRoot: %{l_buildroot}
michael@148 66 BuildPreReq: OpenPKG, openpkg >= 20060823
michael@148 67 PreReq: OpenPKG, openpkg >= 20060823, MTA
michael@148 68 BuildPreReq: libiconv, openssl
michael@148 69 PreReq: libiconv, openssl
michael@148 70 %if "%{with_fsl}" == "yes"
michael@148 71 BuildPreReq: fsl
michael@148 72 PreReq: fsl
michael@148 73 %endif
michael@148 74 %if "%{with_ldap}" == "yes"
michael@148 75 BuildPreReq: openldap
michael@148 76 PreReq: openldap
michael@148 77 %endif
michael@148 78 %if "%{with_managesieve}" == "yes"
michael@148 79 BuildPreReq: autoconf, automake, pkgconfig, libtool
michael@148 80 BuildPreReq: gettext
michael@148 81 PreReq: gettext
michael@148 82 %endif
michael@148 83 %if "%{with_pam}" == "yes"
michael@148 84 BuildPreReq: PAM
michael@148 85 PreReq: PAM
michael@148 86 %endif
michael@148 87 %if "%{with_mysql}" == "yes"
michael@148 88 BuildPreReq: mysql, zlib
michael@148 89 PreReq: mysql, zlib
michael@148 90 %endif
michael@148 91 %if "%{with_pgsql}" == "yes"
michael@148 92 BuildPreReq: postgresql
michael@148 93 PreReq: postgresql
michael@148 94 %endif
michael@148 95 %if "%{with_sqlite}" == "yes"
michael@148 96 BuildPreReq: sqlite
michael@148 97 PreReq: sqlite
michael@148 98 %endif
michael@148 99 AutoReq: no
michael@148 100 AutoReqProv: no
michael@148 101
michael@148 102 %description
michael@148 103 Dovecot is an Open Source IMAP and POP3 server, written with
michael@148 104 security primarily in mind. Dovecot is an excellent choice for both
michael@148 105 small and large installations. It's fast, simple to set up, requires
michael@148 106 no special administration and it uses very little memory.
michael@148 107
michael@148 108 %track
michael@148 109 prog dovecot = {
michael@148 110 version = %{V_major}.%{V_minor}
michael@148 111 url = http://www.dovecot.org/download.html
michael@148 112 regex = dovecot-(1\.1(\.\d+)+)\.tar\.gz
michael@148 113 }
michael@148 114 prog dovecot:sieve = {
michael@148 115 version = %{V_major}.%{V_minor_sieve}
michael@148 116 url = http://www.dovecot.org/download.html
michael@148 117 regex = dovecot-sieve-(%{V_major}(\.\d+)+)\.tar\.gz
michael@148 118 }
michael@148 119 prog dovecot:managesieve = {
michael@148 120 version = %{V_managesieve}
michael@148 121 url = http://www.rename-it.nl/dovecot/%{V_major}/
michael@148 122 regex = dovecot-%{V_major}\.%{V_minor_managesieve}-managesieve-(__VER__)\.diff\.gz
michael@148 123 }
michael@148 124
michael@148 125 %prep
michael@148 126 %setup -q
michael@148 127 %if "%{with_sieve}" == "yes"
michael@148 128 %setup -q -T -D -a 1
michael@148 129 %endif
michael@148 130 %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b
michael@148 131 %if "%{with_managesieve}" == "yes"
michael@148 132 sleep 1
michael@148 133 %{l_gzip} -dc <%{PATCH1} | %{l_patch} -p1 -b
michael@148 134 sleep 1
michael@148 135 autoreconf -i --force || true
michael@148 136 %endif
michael@148 137
michael@148 138 %build
michael@148 139 cppflags="%{l_cppflags}"
michael@148 140 ldflags="%{l_ldflags} %{l_fsl_ldflags}"
michael@148 141 libs="%{l_fsl_libs}"
michael@148 142 sql_drivers=""
michael@148 143 %if "%{with_ldap}" == "yes"
michael@148 144 libs="$libs -llber -lssl -lcrypto"
michael@148 145 %endif
michael@148 146 %if "%{with_mysql}" == "yes"
michael@148 147 cppflags="$cppflags %{l_cppflags mysql}"
michael@148 148 ldflags="$ldflags %{l_ldflags mysql}"
michael@148 149 sql_drivers="$sql_drivers,mysql"
michael@148 150 %endif
michael@148 151 %if "%{with_pgsql}" == "yes"
michael@148 152 libs="$libs -lssl -lcrypto -lcrypt"
michael@148 153 sql_drivers="$sql_drivers,pgsql"
michael@148 154 %endif
michael@148 155 %if "%{with_sqlite}" == "yes"
michael@148 156 sql_drivers="$sql_drivers,sqlite"
michael@148 157 %endif
michael@148 158 sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'`
michael@148 159
michael@148 160 CC="%{l_cc}" \
michael@148 161 CFLAGS="%{l_cflags -O}" \
michael@148 162 CPPFLAGS="$cppflags" \
michael@148 163 LDFLAGS="$ldflags" \
michael@148 164 LIBS="$libs" \
michael@149 165 GREP="grep" \
michael@148 166 ./configure \
michael@148 167 --prefix=%{l_prefix} \
michael@148 168 --sysconfdir=%{l_prefix}/etc/dovecot \
michael@148 169 --with-ssldir=%{l_prefix}/etc/dovecot/ssl \
michael@148 170 --datadir=%{l_prefix}/share/dovecot \
michael@148 171 --docdir=%{l_prefix}/share/dovecot/doc \
michael@148 172 --with-rundir=%{l_prefix}/var/dovecot/run \
michael@150 173 --with-statedir=%{l_prefix}/var/dovecot/dat \
michael@148 174 --with-libiconv-prefix=%{l_prefix} \
michael@148 175 --with-ssl=openssl \
michael@148 176 --with-deliver \
michael@148 177 --with-docs \
michael@148 178 %if "%{with_ldap}" == "yes"
michael@148 179 --with-ldap \
michael@148 180 %else
michael@148 181 --without-ldap \
michael@148 182 %endif
michael@148 183 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
michael@148 184 --with-sql \
michael@148 185 --with-sql-drivers="$sql_drivers" \
michael@148 186 %if "%{with_mysql}" == "yes"
michael@148 187 --with-mysql \
michael@148 188 %else
michael@148 189 --without-mysql \
michael@148 190 %endif
michael@148 191 %if "%{with_pgsql}" == "yes"
michael@148 192 --with-pgsql \
michael@148 193 %else
michael@148 194 --without-pgsql \
michael@148 195 %endif
michael@148 196 %if "%{with_sqlite}" == "yes"
michael@148 197 --with-sqlite \
michael@148 198 %else
michael@148 199 --without-sqlite \
michael@148 200 %endif
michael@148 201 %else
michael@148 202 --without-sql \
michael@148 203 --without-sql-drivers \
michael@148 204 --without-mysql \
michael@148 205 --without-pgsql \
michael@148 206 --without-sqlite \
michael@148 207 %endif
michael@148 208 %if "%{with_pam}" == "yes"
michael@148 209 --with-pam \
michael@148 210 %else
michael@148 211 --without-pam \
michael@148 212 %endif
michael@148 213 %if "%{with_pop3d}" == "yes"
michael@148 214 --with-pop3d \
michael@148 215 %else
michael@148 216 --without-pop3d \
michael@148 217 %endif
michael@148 218 --without-gc \
michael@148 219 --without-gssapi \
michael@148 220 --without-lucene \
michael@148 221 --without-vpopmail \
michael@148 222 --enable-shared \
michael@148 223 --disable-static
michael@148 224 %{l_make} %{l_mflags -O}
michael@148 225
michael@148 226 %if "%{with_sieve}" == "yes"
michael@148 227 # build optional Dovecot LDA sieve plugin
michael@148 228 ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
michael@148 229 CC="%{l_cc}" \
michael@148 230 CFLAGS="%{l_cflags -O}" \
michael@148 231 CPPFLAGS="%{l_cppflags}" \
michael@148 232 LDFLAGS="%{l_ldflags}" \
michael@149 233 GREP="grep" \
michael@148 234 ./configure \
michael@148 235 --prefix=%{l_prefix} \
michael@148 236 --with-dovecot=..
michael@148 237 %{l_make} %{l_mflags -O}
michael@148 238 ) || exit $?
michael@148 239 %endif
michael@148 240
michael@148 241 %install
michael@148 242 rm -rf $RPM_BUILD_ROOT
michael@161 243 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@148 244
michael@148 245 %if "%{with_sieve}" == "yes"
michael@148 246 # install optional Dovecot LDA sieve plugin
michael@148 247 ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
michael@161 248 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@148 249 ) || exit $?
michael@148 250 %endif
michael@148 251
michael@148 252 # adjust file names of configuration files
michael@148 253 ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot
michael@150 254 for i in dovecot dovecot-db dovecot-ldap dovecot-sql; do
michael@148 255 mv ${i}{-example,}.conf
michael@148 256 done
michael@148 257 ) || exit $?
michael@148 258
michael@148 259 # create additional dirctories
michael@148 260 %{l_shtool} mkdir -f -p -m 755 \
michael@148 261 $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \
michael@150 262 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/dat \
michael@148 263 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \
michael@148 264 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login
michael@148 265
michael@150 266 # install runcommand script
michael@148 267 %{l_shtool} mkdir -f -p -m 755 \
michael@148 268 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@148 269 %if "%{with_pop3d}" == "yes"
michael@148 270 cmd='/<\/\{0,1\}with_pop3d>/d'
michael@148 271 %else
michael@148 272 cmd='/<with_pop3d>/,/<\/with_pop3d>/d'
michael@148 273 %endif
michael@148 274 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@148 275 -e "$cmd" \
michael@148 276 %{SOURCE rc.dovecot} \
michael@148 277 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@148 278
michael@148 279 # install OSSP fsl configuration
michael@148 280 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@148 281 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@148 282 %{SOURCE fsl.dovecot} \
michael@148 283 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@148 284
michael@148 285 # strip installation
michael@148 286 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la \
michael@148 287 >/dev/null 2>&1 || true
michael@150 288 rmdir $RPM_BUILD_ROOT%{l_prefix}/include/dovecot \
michael@150 289 $RPM_BUILD_ROOT%{l_prefix}/include \
michael@150 290 >/dev/null 2>&1 || true
michael@148 291 strip \
michael@148 292 $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
michael@148 293 $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \
michael@148 294 >/dev/null 2>&1 || true
michael@148 295
michael@148 296 # generate file list
michael@148 297 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
michael@148 298 '%not %dir %{l_prefix}/etc/fsl' \
michael@148 299 '%config %{l_prefix}/etc/fsl/fsl.dovecot' \
michael@148 300 '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \
michael@148 301 '%config %attr(0640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \
michael@148 302 '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \
michael@148 303 '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot' \
michael@150 304 '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/dat' \
michael@148 305 '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \
michael@150 306 '%dir %attr(0755,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/run' \
michael@150 307 '%dir %attr(0750,%{l_susr},%{l_ngrp}) %{l_prefix}/var/dovecot/run/login' \
michael@148 308 '%doc %{l_prefix}/share/dovecot/doc' \
michael@148 309 '%doc %{l_prefix}/share/dovecot/doc/wiki'
michael@148 310
michael@148 311 %files -f files
michael@148 312
michael@148 313 %clean
michael@148 314 rm -rf $RPM_BUILD_ROOT
michael@148 315
michael@148 316 %post
michael@148 317 # after upgrade, restart service
michael@148 318 [ $1 -eq 2 ] || exit 0
michael@148 319 eval `%{l_rc} dovecot status 2>/dev/null`
michael@148 320 [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart
michael@148 321 exit 0
michael@148 322
michael@148 323 %preun
michael@148 324 # before erase, stop service and remove log files
michael@148 325 [ $1 -eq 0 ] || exit 0
michael@148 326 %{l_rc} dovecot stop 2>/dev/null
michael@148 327 rm -f $RPM_INSTALL_PREFIX/var/dovecot/* >/dev/null 2>&1 || true
michael@150 328 rm -f $RPM_INSTALL_PREFIX/var/dovecot/dat/* >/dev/null 2>&1 || true
michael@148 329 rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/* >/dev/null 2>&1 || true
michael@148 330 rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/* >/dev/null 2>&1 || true
michael@148 331 rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true
michael@148 332 exit 0
michael@148 333

mercurial