From a5152a058a748e96dfa9f8fffb0f2d50908d170857f81db11cc5b8bea8890bba Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Tue, 9 Sep 2014 18:02:38 +0000 Subject: [PATCH] Accepting request 248225 from home:darix:dovecot - also needed OBS-URL: https://build.opensuse.org/request/show/248225 OBS-URL: https://build.opensuse.org/package/show/server:mail/dovecot?expand=0&rev=1 --- .gitattributes | 23 ++++++ .gitignore | 1 + dovecot-2.0.configfiles | 28 +++++++ dovecot-2.1.configfiles | 31 ++++++++ dovecot-2.2.configfiles | 31 ++++++++ dovecot-fw | 17 +++++ dovecot.README.SUSE | 44 +++++++++++ dovecot.changes | 57 ++++++++++++++ dovecot.init | 94 +++++++++++++++++++++++ dovecot.pam | 6 ++ dovecot.service | 11 +++ dovecot.socket | 15 ++++ dovecot.spec | 162 ++++++++++++++++++++++++++++++++++++++++ dovecot.tmpfiles.d | 3 + 14 files changed, 523 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 dovecot-2.0.configfiles create mode 100644 dovecot-2.1.configfiles create mode 100644 dovecot-2.2.configfiles create mode 100644 dovecot-fw create mode 100644 dovecot.README.SUSE create mode 100644 dovecot.changes create mode 100644 dovecot.init create mode 100644 dovecot.pam create mode 100644 dovecot.service create mode 100644 dovecot.socket create mode 100644 dovecot.spec create mode 100644 dovecot.tmpfiles.d diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/dovecot-2.0.configfiles b/dovecot-2.0.configfiles new file mode 100644 index 0000000..fe6613d --- /dev/null +++ b/dovecot-2.0.configfiles @@ -0,0 +1,28 @@ +/etc/dovecot/README +/etc/dovecot/conf.d/10-auth.conf +/etc/dovecot/conf.d/10-director.conf +/etc/dovecot/conf.d/10-logging.conf +/etc/dovecot/conf.d/10-mail.conf +/etc/dovecot/conf.d/10-master.conf +/etc/dovecot/conf.d/10-ssl.conf +/etc/dovecot/conf.d/15-lda.conf +/etc/dovecot/conf.d/20-imap.conf +/etc/dovecot/conf.d/20-lmtp.conf +/etc/dovecot/conf.d/20-pop3.conf +/etc/dovecot/conf.d/90-acl.conf +/etc/dovecot/conf.d/90-plugin.conf +/etc/dovecot/conf.d/90-quota.conf +/etc/dovecot/conf.d/auth-checkpassword.conf.ext +/etc/dovecot/conf.d/auth-deny.conf.ext +/etc/dovecot/conf.d/auth-ldap.conf.ext +/etc/dovecot/conf.d/auth-master.conf.ext +/etc/dovecot/conf.d/auth-passwdfile.conf.ext +/etc/dovecot/conf.d/auth-sql.conf.ext +/etc/dovecot/conf.d/auth-static.conf.ext +/etc/dovecot/conf.d/auth-system.conf.ext +/etc/dovecot/conf.d/auth-vpopmail.conf.ext +/etc/dovecot/dovecot-db.conf.ext +/etc/dovecot/dovecot-dict-sql.conf.ext +/etc/dovecot/dovecot-ldap.conf.ext +/etc/dovecot/dovecot-sql.conf.ext +/etc/dovecot/dovecot.conf diff --git a/dovecot-2.1.configfiles b/dovecot-2.1.configfiles new file mode 100644 index 0000000..9c55da3 --- /dev/null +++ b/dovecot-2.1.configfiles @@ -0,0 +1,31 @@ +/etc/dovecot/README +/etc/dovecot/conf.d/10-auth.conf +/etc/dovecot/conf.d/10-director.conf +/etc/dovecot/conf.d/10-logging.conf +/etc/dovecot/conf.d/10-mail.conf +/etc/dovecot/conf.d/10-master.conf +/etc/dovecot/conf.d/10-ssl.conf +/etc/dovecot/conf.d/15-lda.conf +/etc/dovecot/conf.d/15-mailboxes.conf +/etc/dovecot/conf.d/20-imap.conf +/etc/dovecot/conf.d/20-lmtp.conf +/etc/dovecot/conf.d/20-pop3.conf +/etc/dovecot/conf.d/90-acl.conf +/etc/dovecot/conf.d/90-plugin.conf +/etc/dovecot/conf.d/90-quota.conf +/etc/dovecot/conf.d/auth-checkpassword.conf.ext +/etc/dovecot/conf.d/auth-deny.conf.ext +/etc/dovecot/conf.d/auth-dict.conf.ext +/etc/dovecot/conf.d/auth-ldap.conf.ext +/etc/dovecot/conf.d/auth-master.conf.ext +/etc/dovecot/conf.d/auth-passwdfile.conf.ext +/etc/dovecot/conf.d/auth-sql.conf.ext +/etc/dovecot/conf.d/auth-static.conf.ext +/etc/dovecot/conf.d/auth-system.conf.ext +/etc/dovecot/conf.d/auth-vpopmail.conf.ext +/etc/dovecot/dovecot-db.conf.ext +/etc/dovecot/dovecot-dict-auth.conf.ext +/etc/dovecot/dovecot-dict-sql.conf.ext +/etc/dovecot/dovecot-ldap.conf.ext +/etc/dovecot/dovecot-sql.conf.ext +/etc/dovecot/dovecot.conf diff --git a/dovecot-2.2.configfiles b/dovecot-2.2.configfiles new file mode 100644 index 0000000..dda6680 --- /dev/null +++ b/dovecot-2.2.configfiles @@ -0,0 +1,31 @@ +/etc/dovecot/README +/etc/dovecot/conf.d/10-auth.conf +/etc/dovecot/conf.d/10-director.conf +/etc/dovecot/conf.d/10-logging.conf +/etc/dovecot/conf.d/10-mail.conf +/etc/dovecot/conf.d/10-master.conf +/etc/dovecot/conf.d/10-ssl.conf +/etc/dovecot/conf.d/11-object-storage.conf +/etc/dovecot/conf.d/15-lda.conf +/etc/dovecot/conf.d/15-mailboxes.conf +/etc/dovecot/conf.d/20-imap.conf +/etc/dovecot/conf.d/20-lmtp.conf +/etc/dovecot/conf.d/20-pop3.conf +/etc/dovecot/conf.d/90-acl.conf +/etc/dovecot/conf.d/90-plugin.conf +/etc/dovecot/conf.d/90-quota.conf +/etc/dovecot/conf.d/auth-checkpassword.conf.ext +/etc/dovecot/conf.d/auth-deny.conf.ext +/etc/dovecot/conf.d/auth-dict.conf.ext +/etc/dovecot/conf.d/auth-ldap.conf.ext +/etc/dovecot/conf.d/auth-master.conf.ext +/etc/dovecot/conf.d/auth-passwdfile.conf.ext +/etc/dovecot/conf.d/auth-sql.conf.ext +/etc/dovecot/conf.d/auth-static.conf.ext +/etc/dovecot/conf.d/auth-system.conf.ext +/etc/dovecot/conf.d/auth-vpopmail.conf.ext +/etc/dovecot/dovecot-dict-auth.conf.ext +/etc/dovecot/dovecot-dict-sql.conf.ext +/etc/dovecot/dovecot-ldap.conf.ext +/etc/dovecot/dovecot-sql.conf.ext +/etc/dovecot/dovecot.conf diff --git a/dovecot-fw b/dovecot-fw new file mode 100644 index 0000000..bc0eda9 --- /dev/null +++ b/dovecot-fw @@ -0,0 +1,17 @@ +## Name: Dovecot Server +## Description: Opens ports for the Dovecot Server + +# space separated list of allowed TCP ports +TCP="imap imaps pop3 pop3s sieve 4190" + +# space separated list of allowed UDP ports +UDP="" + +# space separated list of allowed RPC services +RPC="" + +# space separated list of allowed IP protocols +IP="" + +# space separated list of allowed UDP broadcast ports +BROADCAST="" diff --git a/dovecot.README.SUSE b/dovecot.README.SUSE new file mode 100644 index 0000000..3d0686e --- /dev/null +++ b/dovecot.README.SUSE @@ -0,0 +1,44 @@ +SSL support in dovecot: +----------------------- + +SSL is disabled pr. default, to enable create an SSL certificate, and modify +the dovecot configuration file accordingly. + +The easiest way to generate certificates is editing + +"/usr/share/doc/packages/dovecot/dovecot-openssl.cnf" + +and running + +"/usr/share/doc/packages/dovecot/mkcert.sh" + +to create the needed SSL certificate. afterwards set "ssl_disable" +in "/etc/dovecot/dovecot.conf" to "no". + +Modules location: +----------------- + +Since the libexec dir is /usr/lib(64) when conforming to FHS as SUSE LINUX +does, the modules should go to /usr/lib(64)/dovecot/modules/{imap,pop3}. + + +Configuration: +-------------- +Since SLE12 there is no cyrus-imap support. The new imap server is dovecot. + +Changes in autoyast. + may have following values: "local" | "procmail" + +There is no yast support for dovecot configuration. + +If you want to deliver local mails to dovecot follow this steps: +1. Set MAIL_CREATE_CONFIG to "no" in /etc/sysconfig/mail to prohibit yast2 to override your configuration. +2. Set mailbox_command = /usr/lib/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT" in /etc/postfix/main.cf +3. Set mail_location = maildir:~/Maildir or to your prefered value in /etc/dovecot/conf.d/10-mail.conf +4. Set a normal user as alias for root in /etc/aliases +5. Execute following comands: + postalias /etc/aliases + systemctl restart postfix + systemctl enable dovecot + systemctl start dovecot + diff --git a/dovecot.changes b/dovecot.changes new file mode 100644 index 0000000..c0ca003 --- /dev/null +++ b/dovecot.changes @@ -0,0 +1,57 @@ +------------------------------------------------------------------- +Mon Sep 8 23:16:05 UTC 2014 - mrueckert@suse.de + +- copy the correct file as init script in the non systemd case +- remove %buildroot from %pre script just in case we uncomment that + part at some point +- only have %post in the systemd case + +------------------------------------------------------------------- +Mon Sep 8 23:00:14 UTC 2014 - mrueckert@suse.de + +- we dont need a dovecot implementation at build time just at + install time. add BuildIgnore to get around the loop. + +------------------------------------------------------------------- +Fri Sep 5 15:56:35 UTC 2014 - mrueckert@suse.de + +- remove triggers again. when we handle the dovecot update problems + by manually stopping in %pre and manually starting up again in + %postun we dont need them anymore. + +------------------------------------------------------------------- +Fri Sep 5 13:03:30 UTC 2014 - mrueckert@suse.de + +- as we cant use service_del_preun we should still check if it is + the last package that we install otherwise we kill it + unconditionally + +------------------------------------------------------------------- +Fri Sep 5 12:51:40 UTC 2014 - mrueckert@suse.de + +- no longer restart the socket activation. this seems to kill the + dovecot. + +------------------------------------------------------------------- +Fri Sep 5 11:35:37 UTC 2014 - mrueckert@suse.de + +- move ldconfig to the versioned packages +- own the shared var directories. +- kick out the triggerin script as we dont need it. +- restart dovecot also when the module packages are updated + +------------------------------------------------------------------- +Fri Sep 5 11:18:40 UTC 2014 - mrueckert@suse.de + +- added trigger scripts + +------------------------------------------------------------------- +Fri Sep 5 10:59:11 UTC 2014 - mrueckert@suse.de + +- make the dovecot implementation a prereq + +------------------------------------------------------------------- +Thu Sep 4 13:44:06 UTC 2014 - mrueckert@suse.de + +- start an unversioned wrapper package again + diff --git a/dovecot.init b/dovecot.init new file mode 100644 index 0000000..417a24b --- /dev/null +++ b/dovecot.init @@ -0,0 +1,94 @@ +#! /bin/sh +# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany. +# 2005-2007 SUSE / Novell Inc. +# All rights reserved. +# +# Author: Mads Martin Joergensen +# Marcus Rueckert +# Please send feedback to http://www.suse.de/feedback/ +# +# /etc/init.d/dovecot +# and its symbolic link +# /usr/sbin/rcdovecot +# +### BEGIN INIT INFO +# Provides: dovecot +# Required-Start: $remote_fs $syslog $network +# Required-Stop: $remote_fs $syslog $network +# Should-Start: $named $time postgresql mysql ldap +# Should-Stop: postgresql mysql ldap +# X-Start-Before: exim postfix +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Dovecot IMAP/POP3/SASL server +# Description: Dovecot IMAP/POP3/SASL server +### END INIT INFO + +. /etc/rc.status + +# Reset status of this service +rc_reset + +DOVECOT_BIN=/usr/sbin/dovecot +test -x $DOVECOT_BIN || { + echo "$DOVECOT_BIN not installed"; + if [ "$1" = "stop" ] ; then + exit 0 + else + exit 5 + fi + } + +case "$1" in + start) + echo -n "Starting dovecot " + startproc $DOVECOT_BIN + rc_status -v + ;; + stop) + echo -n "Stopping dovecot " + killproc -TERM $DOVECOT_BIN + rc_status -v + ;; + try-restart|condrestart) + $0 status + if test $? = 0; then + $0 restart + else + rc_reset + fi + rc_status + ;; + restart) + $0 stop + $0 start + rc_status + ;; + force-reload) + # dovecot has support for reloading it's config when + # recieving signal 1 (SIGHUP). There's still some + # issues noticed in the dovecot-TODO though so restart + # for now. + echo -n "Reload service dovecot " + # killproc -HUP $DOVECOT_BIN + # rc_status -v + + $0 try-restart + rc_status + ;; + reload) + echo -n "Reload service dovecot " + killproc -HUP $DOVECOT_BIN + rc_status -v + ;; + status) + echo -n "Checking for service dovecot " + checkproc $DOVECOT_BIN + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 1 + ;; +esac +rc_exit diff --git a/dovecot.pam b/dovecot.pam new file mode 100644 index 0000000..02eb463 --- /dev/null +++ b/dovecot.pam @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth include common-auth +account include common-account +password include common-password +session include common-session + diff --git a/dovecot.service b/dovecot.service new file mode 100644 index 0000000..796e241 --- /dev/null +++ b/dovecot.service @@ -0,0 +1,11 @@ +[Unit] +Description=Dovecot IMAP/POP3 email server +After=local-fs.target network.target + +[Service] +Type=simple +ExecStart=/usr/sbin/dovecot -F +NonBlocking=yes + +[Install] +WantedBy=multi-user.target diff --git a/dovecot.socket b/dovecot.socket new file mode 100644 index 0000000..a6bf420 --- /dev/null +++ b/dovecot.socket @@ -0,0 +1,15 @@ +[Unit] +Description=Dovecot IMAP/POP3 email server activation socket + +[Socket] +#dovecot expects separate IPv4 and IPv6 sockets +BindIPv6Only=ipv6-only +ListenStream=0.0.0.0:143 +ListenStream=[::]:143 +ListenStream=0.0.0.0:993 +ListenStream=[::]:993 +KeepAlive=true + +[Install] +WantedBy=sockets.target + diff --git a/dovecot.spec b/dovecot.spec new file mode 100644 index 0000000..4616984 --- /dev/null +++ b/dovecot.spec @@ -0,0 +1,162 @@ +# +# spec file for package dovecot +# +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +%if 0%{?suse_version} > 1230 +%bcond_without systemd +%else +%bcond_with systemd +%endif + +Name: dovecot +Version: 2.2 +Release: 0 +Summary: IMAP and POP3 Server Written Primarily with Security in Mind +License: BSD-3-Clause and LGPL-2.1+ and MIT +Group: Productivity/Networking/Email/Servers +Url: http://www.dovecot.org/ +PreReq: dovecot-implementation +Recommends: dovecot22 +#!BuildIgnore: dovecot-implementation +%if %{with systemd} +BuildRequires: pkgconfig(systemd) +%{?systemd_requires} +%define has_systemd 1 +%endif +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch +Source0: dovecot-2.0.configfiles +Source1: dovecot-2.1.configfiles +Source2: dovecot-2.2.configfiles +Source3: %{name}.init +Source4: %{name}.pam +Source5: %{name}.README.SUSE +Source6: %{name}-fw +Source7: dovecot.tmpfiles.d +Source8: dovecot.service +Source9: dovecot.socket + +%description +Dovecot is an IMAP and POP3 server for Linux and UNIX-like systems, +written primarily with security in mind. Although it is written in C, +it uses several coding techniques to avoid most of the common pitfalls. + +Dovecot can work with standard mbox and maildir formats and is fully +compatible with UW-IMAP and Courier IMAP servers as well as mail +clients accessing the mailboxes directly. + +This is a wrapper package that will just handle common things for all +versioned dovecot packages. + +%prep + +%build + +%install +for i in $RPM_SOURCE_DIR/*.configfiles ; do + echo "Creating ghost files for '$i'" + for j in $(<$i) ; do + install -D -m 0644 /dev/null %{buildroot}$j + done +done + +install -D -m 0644 %{S:5} %{buildroot}%{_datadir}/doc/packages/dovecot/README.SUSE +install -d %{buildroot}%{_sbindir} +# install the init script +%if %{with systemd} +%{__install} -D -m 644 %{S:7} %{buildroot}/usr/lib/tmpfiles.d/dovecot.conf +%{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} +install -D -m 0644 %{S:8} %{buildroot}%{_unitdir}/dovecot.service +install -D -m 0644 %{S:9} %{buildroot}%{_unitdir}/dovecot.socket +%else +%{__install} -D -m 0755 %{S:3} %{buildroot}%{_sysconfdir}/init.d/%{name} +%{__ln_s} -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name} +%endif + +# install pam config +%{__install} -D -m 0644 %{S:4} %{buildroot}%{_sysconfdir}/pam.d/%{name} +# install firewall services +%{__install} -D -m 644 %{S:6} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name} +# create /var directories +%{__install} -m 0755 -Dd \ + %{buildroot}%{_var}/run/%{name}/login/ \ + %{buildroot}%{_var}/lib/%{name}/ + + +%pre +/usr/sbin/groupadd -r %{name} &>/dev/null || : +/usr/sbin/useradd -g %{name} -s /bin/false -r -c "User for Dovecot imapd" -d %{_var}/run/%{name} %{name} &>/dev/null || : +/usr/sbin/useradd -g %{name} -s /bin/false -r -c "User for Dovecot login" -d %{_var}/run/%{name} dovenull &>/dev/null || : +# try to copy the default configuration. +# +# we fail silently if the dovecot-implementation package is not +# installed yet. This allows us to break a little build loop between +# dovecot and dovecotXY. +if [ ! -e /etc/dovecot/dovecot.conf -a -e /usr/share/doc/packages/dovecot/example-config/dovecot.conf ] ; then + # install default config + echo "Did not find a /etc/dovecot/dovecot.conf. copying default configuration" + cp -na %{_docdir}/%{name}/example-config/* %{_sysconfdir}/%{name}/ + # the chmod breaks the lda. lets use the more open permissions + #chmod -Rv o= %{_sysconfdir}/%{name}/ +fi +%if %{with systemd} +%service_add_pre %{name}.service %{name}.socket +%endif + +%preun +%if %{with systemd} +%service_del_preun %{name}.service %{name}.socket +%else +%stop_on_removal %{name} +%endif + +%if %{with systemd} +%post +systemd-tmpfiles --create /usr/lib/tmpfiles.d/dovecot.conf || true +%service_add_post %{name}.service %{name}.socket +%endif + +%postun +%if %{with systemd} +%service_del_postun %{name}.service +%else +%restart_on_update %{name} +%insserv_cleanup +%endif + +%files +%defattr(-,root,root) +%doc %{_datadir}/doc/packages/dovecot/ +# conf +%ghost %config(noreplace) /etc/dovecot/ +%config(noreplace) %{_sysconfdir}/pam.d/%{name} +%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name} +%{_sbindir}/rc%{name} +%if %{with systemd} +/usr/lib/tmpfiles.d/dovecot.conf +%{_unitdir}/dovecot.service +%{_unitdir}/dovecot.socket +%else +%{_sysconfdir}/init.d/%{name} +%endif +# setting up permissions +%if ! %{with systemd} +%dir %attr(0755,root,root) %ghost %{_var}/run/%{name}/ +%dir %attr(0750,root,%{name}) %ghost %{_var}/run/%{name}/login/ +%endif +%dir %attr(0750,root,root) %{_var}/lib/%{name}/ + +%changelog diff --git a/dovecot.tmpfiles.d b/dovecot.tmpfiles.d new file mode 100644 index 0000000..c6b1e38 --- /dev/null +++ b/dovecot.tmpfiles.d @@ -0,0 +1,3 @@ +# Type Path Mode UID GID Age Argument +d /var/run/dovecot/ 0755 root root - - +d /var/run/dovecot/login/ 0750 root dovecot - -