postfix/postfix.spec

495 lines
18 KiB
RPMSpec

%define groupid 65030
%define userid 65030
%define vmail_groupid 64901
%define vmail_userid 64907
%define nobodygroupid 65013
%define nobodyuserid 65013
%define postdrop_groupid 65031
Name: postfix
Version: 2.11.8
Release: 1mamba
Summary: A fast, easy to administer, and secure mail transfer agent
Group: System/Servers
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.postfix.org
Source: ftp://ftp.porcupine.org/mirrors/postfix-release/official/%{name}-%{version}.tar.gz
Source1: postfix.service
Source2: %{name}-mysql_virtual_alias_maps.cf
Source3: %{name}-mysql_virtual_domains_maps.cf
Source4: %{name}-mysql_virtual_mailbox_maps.cf
Source5: %{name}-mysql_virtual_mailbox_limit_maps.cf
Source6: %{name}-mysql_relay_domains_maps.cf
Source7: %{name}-mysql-tables.txt
# patch path for download: http://vda.sourceforge.net/VDA/postfix-%{version}-vda-ng.patch.gz
Patch0: http://vda.sourceforge.net/VDA/postfix-vda-v13-2.11.7.patch
License: IBM Public License
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libdb51-devel
BuildRequires: libmysqlclient-devel
BuildRequires: libopenldap-devel
BuildRequires: libopenssl-devel
BuildRequires: libpcre-devel
BuildRequires: libsasl2-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
BuildRequires: libsasl2-devel >= 2.1.26
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Provides: mta
Provides: /usr/lib/sendmail
%systemd_requires
%description
Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users.
Thus, the outside has a sendmail-ish flavor, but the inside is completely different.
%package virtualdomains-mysql
Summary: virtualdomains addon package for Postfix with mysql
Group: System/Servers
Requires: mysql >= 4.1.22
Requires: mysql-client
Requires: %{name} = %{version}-%{release}
Obsoletes: postfix-mysql
%description virtualdomains-mysql
virtualdomains addon package for Postfix with mysql. This package is intended for using Postfix with mysql for managing virtual domains.
%prep
%setup -q
%patch0 -p1
%build
make CC=%{_host}-gcc makefiles \
CCARGS="-DHAS_LDAP -DHAS_MYSQL -I%{_includedir}/mysql \
-DUSE_CYRUS_SASL -DUSE_SASL_AUTH -DUSE_TLS -I%{_includedir}/sasl \
-DDEF_DAEMON_DIR=\\\"%{_libexecdir}/postfix/\\\"" \
AUXLIBS="-lldap -llber -lmysqlclient -lz -lm -lsasl2 -lssl -lcrypto"
%make
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
sh ./postfix-install \
html_directory=%{_datadir}/%{name}-%{version}/html \
manpage_directory=%{_mandir} \
install_root=%{buildroot} \
-non-interactive
install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/postfix.service
mv %{buildroot}%{_sysconfdir}/postfix/aliases %{buildroot}%{_sysconfdir}/
# create virtual users mailbox dir
install -m771 -d %{buildroot}%{_localstatedir}/spool/maildirs \
%{buildroot}%{_localstatedir}/spool/deleted-maildirs
# LSB: create symbolic link to /usr/lib/sendmail
install -d -m0755 %{buildroot}/usr/lib
ln -s /usr/sbin/sendmail %{buildroot}/usr/lib/sendmail
# configure for virtual domains and more
cat >> %{buildroot}%{_sysconfdir}/postfix/main.cf << _EOF
# use transport maps from file
transport_maps = hash:/etc/postfix/transport
# virtual domain configuration
virtual_gid_maps = static:%{vmail_groupid}
virtual_mailbox_base = %{_localstatedir}/spool/maildirs
virtual_mailbox_limit = 10000000
virtual_minimum_uid = 1001
virtual_transport = virtual
virtual_uid_maps = static:%{vmail_userid}
# virtual domain quota support
virtual_mailbox_limit_override = yes
virtual_overquota_bounce = yes
proxy_read_maps = \$local_recipient_maps \$mydestination \$virtual_alias_maps
\$virtual_alias_domains \$virtual_mailbox_maps \$virtual_mailbox_domains
\$relay_recipient_maps \$relay_domains \$canonical_maps \$sender_canonical_maps
\$recipient_canonical_maps \$relocated_maps \$transport_maps $mynetworks
\$virtual_mailbox_limit_maps
_EOF
install -m 0640 %{SOURCE2} %{buildroot}%{_sysconfdir}/postfix/mysql_virtual_alias_maps.cf
install -m 0640 %{SOURCE3} %{buildroot}%{_sysconfdir}/postfix/mysql_virtual_domains_maps.cf
install -m 0640 %{SOURCE4} %{buildroot}%{_sysconfdir}/postfix/mysql_virtual_mailbox_maps.cf
# FIXME?
install -m 0640 %{SOURCE5} %{buildroot}%{_sysconfdir}/postfix/mysql_virtual_mailbox_limits_relay_maps.cf
install -m 0640 %{SOURCE5} %{buildroot}%{_sysconfdir}/postfix/mysql_virtual_mailbox_limit_maps.cf
install -m 0640 %{SOURCE6} %{buildroot}%{_sysconfdir}/postfix/mysql_relay_domains_maps.cf
install -m 0640 %{SOURCE7} %{buildroot}%{_sysconfdir}/postfix/mysql-tables.txt
%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%pre
/usr/sbin/groupadd postfix -g %{groupid} 2>/dev/null
/usr/sbin/useradd -u %{userid} -c 'Postfix user' -d /dev/null -g postfix \
-s /bin/true postfix 2>/dev/null
/usr/sbin/groupadd postdrop -g %{postdrop_groupid} 2>/dev/null
exit 0
%post
%systemd_post postfix
if [ $1 -eq 1 ]; then
systemctl -q enable postfix
systemctl -q start postfix
fi
if [ $1 -ge 1 ]; then
/usr/sbin/groupadd nobody -g %{nobodygroupid} 2>/dev/null
/usr/sbin/useradd -c nobody -u %{nobodyuserid} -d /dev/null -g nobody \
-s /bin/false nobody 2>/dev/null
/usr/sbin/postmap /etc/postfix/transport
/sbin/chkconfig --add postfix
postalias /etc/aliases
# sysv -> systemd upgrade
if [ -L /etc/rc.d/rc5.d/S30postfix -o -L /etc/rc.d/rc3.d/S30postfix ]; then
systemctl -q enable postfix
systemctl -q restart postfix
fi
# new install
#if [ $1 -eq 1 ]; then
# sed -i "s|#myhostname .*|myhostname = `hostname -f`|;
# S|#mydomain .*|mydomain = `hostname -d`|" /etc/postfix/main.cf
#fi
fi
:
%preun
%systemd_preun postfix
# erase
if [ $1 -eq 0 ]; then
systemctl -q stop postfix
systemctl -q disable postfix
/usr/sbin/userdel postfix 2>/dev/null
/usr/sbin/groupdel %{postdrop_groupid} 2>/dev/null
fi
:
%postun
%systemd_postun_with_restart postfix
:
%posttrans
find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \;
:
%pre virtualdomains-mysql
/usr/sbin/groupadd vmail -g %{vmail_groupid} 2>/dev/null
/usr/sbin/useradd -u %{vmail_userid} -c 'Virtual Mailboxes' -d /var/spool/maildirs -g vmail \
-s /bin/false vmail 2>/dev/null
:
%post virtualdomains-mysql
eval `grep -m1 'password =' /etc/postfix/mysql_virtual_mailbox_maps.cf | sed "s|[[:space:]]||g"`
if [ ! "$password" -a "$password" != "_mydbpassword_" ]; then
# create mysql database
mysqlshow postfix >/dev/null 2>/dev/null || {
RANDOM_PASSWD=`/usr/bin/mkpasswd -l 10 -s 0`
# create mysql database
mysqladmin create postfix
cat << EOF | mysql -u root postfix
grant INSERT,SELECT on root.* to postfix@localhost;
SET PASSWORD FOR postfix@localhost=PASSWORD('$RANDOM_PASSWD');
grant CREATE,INSERT,SELECT,DELETE,UPDATE,ALTER on postfix.* to postfix@localhost;
grant CREATE,INSERT,SELECT,DELETE,UPDATE,ALTER on postfix.* to postfix;
exit
EOF
# create tables
mysql -u postfix --password=$RANDOM_PASSWD postfix < %{_sysconfdir}/postfix/mysql-tables.txt
# configure password in postfix configuration files for mysql
sed -i "s|_mydbpassword_|$RANDOM_PASSWD|" \
%{_sysconfdir}/postfix/mysql_*.cf
cat >> %{_sysconfdir}/postfix/main.cf << _EOF
# configuration for mysql maps
relay_domains = proxy:mysql:%{_sysconfdir}/postfix/mysql_relay_domains_maps.cf
virtual_alias_maps = proxy:mysql:%{_sysconfdir}/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = proxy:mysql:%{_sysconfdir}/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:%{_sysconfdir}/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = proxy:mysql:%{_sysconfdir}/postfix/mysql_virtual_mailbox_limit_maps.cf
_EOF
}
fi
exit 0
%files
%defattr(-,root,root)
%dir %{_sysconfdir}/postfix
%config(noreplace) %{_sysconfdir}/aliases
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/access
%{_sysconfdir}/postfix/bounce.cf.default
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/canonical
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/generic
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/header_checks
%{_sysconfdir}/postfix/LICENSE
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/main.cf
%{_sysconfdir}/postfix/main.cf.default
%{_sysconfdir}/postfix/makedefs.out
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/master.cf
#%{_sysconfdir}/postfix/postfix-files
#%{_sysconfdir}/postfix/postfix-script
#%{_sysconfdir}/postfix/post-install
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/relocated
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/transport
%attr(-,root,postfix) %config(noreplace) %{_sysconfdir}/postfix/virtual
%{_sysconfdir}/postfix/TLS_LICENSE
%{_bindir}/mailq
%{_bindir}/newaliases
%{_libexecdir}/postfix/*
/usr/lib/sendmail
%{_sbindir}/postalias
%{_sbindir}/postcat
%{_sbindir}/postconf
%attr(2755,root,postdrop) %{_sbindir}/postdrop
%{_sbindir}/postfix
%{_sbindir}/postkick
%{_sbindir}/postlock
%{_sbindir}/postlog
%{_sbindir}/postmap
%{_sbindir}/postmulti
%attr(2755,root,postdrop) %{_sbindir}/postqueue
%{_sbindir}/postsuper
%{_sbindir}/sendmail
%{_unitdir}/postfix.service
%{_datadir}/%{name}-%{version}/html/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*
%attr(-,postfix,root) %dir %{_localstatedir}/lib/postfix
%dir %{_localstatedir}/spool/postfix
%attr(-,postfix,root) /var/spool/postfix/active
%attr(-,postfix,root) /var/spool/postfix/bounce
%attr(-,postfix,root) /var/spool/postfix/corrupt
%attr(-,postfix,root) /var/spool/postfix/defer
%attr(-,postfix,root) /var/spool/postfix/deferred
%attr(-,postfix,root) /var/spool/postfix/flush
%attr(-,postfix,root) /var/spool/postfix/hold
%attr(-,postfix,root) /var/spool/postfix/incoming
%attr(-,postfix,postdrop) /var/spool/postfix/maildrop
%attr(-,postfix,root) /var/spool/postfix/pid
%attr(-,postfix,root) /var/spool/postfix/private
%attr(-,postfix,postdrop) /var/spool/postfix/public
%attr(-,postfix,root) /var/spool/postfix/saved
%attr(-,postfix,root) /var/spool/postfix/trace
%doc AAAREADME LICENSE RELEASE_NOTES
%files virtualdomains-mysql
%defattr(-,root,root)
%config(noreplace) %attr(640,root,postfix) %{_sysconfdir}/postfix/mysql_*.cf
%{_sysconfdir}/postfix/mysql-tables.txt
%attr(0771,vmail,vmail) %dir %{_localstatedir}/spool/maildirs
%attr(0771,vmail,vmail) %dir %{_localstatedir}/spool/deleted-maildirs
%changelog
* Mon Nov 26 2018 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.8-1mamba
- update to 2.11.8
* Fri May 15 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.5-1mamba
- update to 2.11.5
* Fri Feb 06 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.3-7mamba
- rebuilt with libsasl2 2.1.16
- support for reload in systemd service
* Thu Feb 05 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.3-6mamba
- rebuilt with vda patch updates from 2.9.1 to 2.10.0
* Thu Jan 22 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.3-5mamba
- fix permissions of postfix.service
* Sat Jan 17 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.3-4mamba
- grant ALTER permission to postifx database user required by postfixadmin
* Wed Jan 14 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.3-3mamba
- fix check for postifx installed before systemd migration
* Sun Jan 11 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.3-2mamba
- systemd switch
* Mon Oct 20 2014 Automatic Build System <autodist@mambasoft.it> 2.11.3-1mamba
- automatic version update by autodist
* Tue Oct 14 2014 Automatic Build System <autodist@mambasoft.it> 2.11.2-1mamba
- automatic version update by autodist
* Thu May 08 2014 Automatic Build System <autodist@mambasoft.it> 2.11.1-1mamba
- automatic version update by autodist
* Wed May 07 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 2.11.0-2mamba
- x86_64: provide /usr/lib/sendmail symlink, not /usr/lib64/sendmail
* Thu Jan 16 2014 Automatic Build System <autodist@mambasoft.it> 2.11.0-1mamba
- automatic version update by autodist
* Fri Sep 06 2013 Automatic Build System <autodist@mambasoft.it> 2.10.2-1mamba
- automatic version update by autodist
* Sun Jun 23 2013 Automatic Build System <autodist@mambasoft.it> 2.10.1-1mamba
- automatic version update by autodist
* Sat Mar 02 2013 Automatic Build System <autodist@mambasoft.it> 2.10.0-1mamba
- automatic version update by autodist
* Tue Feb 05 2013 Automatic Build System <autodist@mambasoft.it> 2.9.6-1mamba
- automatic version update by autodist
* Thu Dec 13 2012 Automatic Build System <autodist@mambasoft.it> 2.9.5-1mamba
- automatic version update by autodist
* Thu Aug 02 2012 Automatic Build System <autodist@mambasoft.it> 2.9.4-1mamba
- automatic version update by autodist
* Sat Jul 21 2012 Automatic Build System <autodist@mambasoft.it> 2.9.3-1mamba
- update to 2.9.3
* Wed May 09 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 2.9.1-2mamba
- virtualdomains-mysql: remove obsolete virtual_mailbox_* settings from default configuration
* Wed Apr 11 2012 Automatic Build System <autodist@mambasoft.it> 2.9.1-1mamba
- automatic version update by autodist
* Mon Apr 09 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 2.8.9-1mamba
- update to 2.8.9
* Sun Nov 06 2011 Automatic Build System <autodist@mambasoft.it> 2.8.7-1mamba
- automatic version update by autodist
* Mon Oct 24 2011 Automatic Build System <autodist@mambasoft.it> 2.8.6-1mamba
- automatic version update by autodist
* Tue Sep 06 2011 Automatic Build System <autodist@mambasoft.it> 2.8.5-1mamba
- automatic version update by autodist
* Tue Aug 23 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 2.8.4-2mamba
- create nobody user and group upon installation
* Thu Jul 07 2011 Automatic Build System <autodist@mambasoft.it> 2.8.4-1mamba
- automatic update by autodist
* Mon May 09 2011 Automatic Build System <autodist@mambasoft.it> 2.8.3-1mamba
- automatic update by autodist
* Tue Mar 22 2011 Automatic Build System <autodist@mambasoft.it> 2.8.2-1mamba
- automatic update by autodist
* Mon Mar 07 2011 Automatic Build System <autodist@mambasoft.it> 2.8.1-1mamba
- automatic update by autodist
* Fri Jan 21 2011 Automatic Build System <autodist@mambasoft.it> 2.8.0-1mamba
- automatic update by autodist
* Wed Nov 24 2010 Automatic Build System <autodist@mambasoft.it> 2.7.2-1mamba
- automatic update to 2.7.2 by autodist
* Wed Jun 09 2010 Automatic Build System <autodist@mambasoft.it> 2.7.1-1mamba
- automatic update to 2.7.1 by autodist
* Fri Apr 09 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 2.7.0-1mamba
- update to 2.7.0
* Sat Aug 29 2009 Automatic Build System <autodist@mambasoft.it> 2.6.5-1mamba
- automatic update to 2.6.5 by autodist
* Wed Aug 26 2009 Automatic Build System <autodist@mambasoft.it> 2.6.4-1mamba
- automatic update to 2.6.4 by autodist
* Mon Aug 03 2009 Automatic Build System <autodist@mambasoft.it> 2.6.3-1mamba
- automatic update to 2.6.3 by autodist
* Thu Jun 04 2009 Automatic Build System <autodist@mambasoft.it> 2.6.2-1mamba
- automatic update to 2.6.2 by autodist
* Wed May 20 2009 Automatic Build System <autodist@mambasoft.it> 2.6.1-1mamba
- automatic update to 2.6.1 by autodist
* Mon May 18 2009 Automatic Build System <autodist@mambasoft.it> 2.6.0-1mamba
- automatic update to 2.6.0 by autodist
* Tue Apr 28 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 2.5.6-3mamba
- enabled and start service by default
* Wed Mar 18 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 2.5.6-2mamba
- rebuilt with TLS support
* Sun Jan 04 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 2.5.6-1mamba
- automatic update to 2.5.6 by autodist
* Wed Sep 03 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 2.5.5-1mamba
- update to 2.5.5
* Sun Aug 31 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 2.5.4-3mamba
- remove requirement for mysql in main package; leave in virtualdomains-mysql
* Sat Aug 30 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 2.5.4-2mamba
- remove parametric version in VDA patch and add full path
- add exit 0 to post script
- add directory /var/lib/postfix with proper permissions
* Sat Aug 30 2008 Fabio Giani <fabio.giani@gmail.com> 2.5.4-1mamba
- update to 2.5.4
- update vda patch to 2.5.4
- update buildrequirements list
* Mon Feb 11 2008 Fabio Giani <fabio.giani@gmail.com> 2.5.0-1mamba
- update to 2.5.0
* Tue Apr 24 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.4.1-1mamba
- update to version 2.4.1 by autospec
* Sat Mar 17 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3.8-3qilnx
- mysql package renamed to virtualdomains-mysql
* Tue Mar 13 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3.8-2qilnx
- added with mysql map support
- added sasl support
- patch0: added VDA patch for quota support
* Sun Mar 04 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3.8-1qilnx
- update to version 2.3.8 by autospec
* Thu Mar 01 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3.7-3qilnx
- add /usr/lib/sendmail symlink
- add mta virtual provide
* Fri Feb 02 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3.7-2qilnx
- move aliases file from /etc/postfix to /etc
- don't overwrite configuration files on update
* Wed Jan 31 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3.7-1qilnx
- update to version 2.3.7 by autospec
- added initscript
* Thu Nov 09 2006 Davide Madrisan <davide.madrisan@qilinux.it> 2.3.4-1qilnx
- update to version 2.3.4 by autospec
* Wed Jan 11 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.8-1qilnx
- update to version 2.2.8 by autospec
* Wed Jun 22 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.4-1qilnx
- update to version 2.2.4 by autospec
* Sat Apr 16 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.2-1qilnx
- package created by autospec