local hostname domain config_new memtotal memlimit
# restore simple configs
- if pkg ntp-cn && pkg ntp lt 1:4.2.6.p2+dfsg-1+b1; then
+ if pkg ntp-cn && pkg ntp lt 1:4.2.6.p5+dfsg-2; then
if restore_file /etc/ntp.conf; then
postupgrade_reconfigure ntp-cn
fi
fi
- if pkg kernel-2.6-cn && pkg procps lt 1:3.2.8-9; then
- if restore_file /etc/sysctl.conf; then
- postupgrade_reconfigure kernel-2.6-cn
- fi
- fi
-
- if pkg kernel-2.6-cn && pkg libpam-modules lt 1.1.1-6.1; then
- if restore_file /etc/security/limits.conf; then
- postupgrade_reconfigure kernel-2.6-cn
- fi
- fi
-
- if pkg vsftpd-cn && pkg vsftpd lt 2.3.2-3+squeeze2; then
+ if pkg vsftpd-cn && pkg vsftpd lt 2.3.5-3; then
if restore_file /etc/vsftpd.conf; then
postupgrade_reconfigure vsftpd-cn
fi
fi
- if pkg squirrelmail-cn && pkg squirrelmail lt 2:1.4.21-2; then
- if restore_file /etc/squirrelmail/apache.conf; then
- postupgrade_reconfigure squirrelmail-cn
+ if pkg amavisd-cn && pkg amavisd-new lt 1:2.7.1-2; then
+ if restore_file /etc/cron.d/amavisd-new; then
+ rm -f /etc/cron.d/amavisd-new.$backup_ext
+ postupgrade_reconfigure amavisd-cn
fi
fi
- if pkg spamassassin-cn && pkg spamassassin lt 3.3.1-1; then
- if restore_file /etc/spamassassin/v310.pre; then
- postupgrade_reconfigure spamassassin-cn
+ if pkg ossec-hids lt 2.7-1; then
+ if restore_file /var/ossec/rules/local_rules.xml; then
+ postupgrade_reconfigure ossec-hids-cn
fi
fi
- if pkg amavisd-cn && pkg amavisd-new lt 1:2.6.4-3; then
- if restore_file /etc/cron.daily/amavisd-new; then
- rm -f /etc/cron.daily/amavisd-new.$backup_ext
- postupgrade_reconfigure amavisd-cn
+ if pkg sasl2-bin lt 2.1.25.dfsg1-6+deb7u1; then
+ if restore_file /etc/default/saslauthd; then
+ postupgrade_reconfigure postfix-cn
fi
-
- if restore_file /etc/amavis/conf.d/15-av_scanners; then
- rm -f /etc/amavis/conf.d/15-av_scanners.$backup_ext
- postupgrade_reconfigure amavisd-cn
- fi
- fi
-
- if pkg amavisd-cn lt 3:2.6.5; then
- restore_file /etc/init.d/amavisd-cn
- rm -f /etc/init.d/amavisd-cn.$backup_ext
fi
- if pkg console-tools lt 1:0.2.3dbs-69.1; then
- restore_file /etc/console-tools/config
- fi
-
- if pkg base-files lt 6.0squeeze2; then
+ if pkg base-files lt 7.1wheezy2; then
restore_file /etc/issue
restore_file /etc/issue.net
fi
- if pkg slapd lt 2.4.23-7.2; then
- restore_file /etc/default/slapd
- fi
-
- # dovecot won't start with these options
- if pkg dovecot-cn && pkg dovecot-common lt 1:1.2.15-7; then
- sed -i 's/^\( *\)\(sieve\(_storage\)\?=.*\)/\1#\2/' \
- /etc/dovecot/dovecot.conf
- fi
-
# check if monitrc is template based
if [ -e /etc/monit/monitrc ]; then # monit is removed at this point
# regenerate config from template
fi
}
+# upgrade the IMAP server
+upgrade_dovecot() {
+ if [ ! -f /etc/dovecot/conf.d/95-local ]; then
+ pkgrm dovecot-cn
+
+ # restore config
+ if [ ! -f /etc/dovecot/dovecot.conf.$backup_ext ]; then
+ mv /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.$backup_ext
+ cp /usr/share/dovecot/dovecot.conf /etc/dovecot/dovecot.conf
+ fi
+
+ # copy SSL certificates
+ OLD_SSL_CERT="/etc/ssl/certs/dovecot.pem"
+ OLD_SSL_KEY="/etc/ssl/private/dovecot.pem"
+ SSL_CERT="/etc/dovecot/dovecot.pem"
+ SSL_KEY="/etc/dovecot/private/dovecot.pem"
+ if [ -f $OLD_SSL_CERT -a -f $OLD_SSL_KEY -a ! -f $SSL_CERT -a ! -f $SSL_KEY ]; then
+ if [ ! -e /etc/dovecot/private ]; then
+ install -d -o root -g root -m0700 /etc/dovecot/private
+ fi
+
+ cp -av $OLD_SSL_CERT $SSL_CERT
+ cp -av $OLD_SSL_KEY $SSL_KEY
+
+ chown root:dovecot $SSL_CERT
+ chmod 0644 $SSL_CERT
+ chown root:dovecot $SSL_KEY
+ chmod 0600 $SSL_KEY
+ fi
+
+ # install new version and restore local changes
+ pkgadd dovecot-core
+ doveconf -n -c /etc/dovecot/dovecot.conf.$backup_ext > /etc/dovecot/conf.d/95-local
+
+ pkgadd dovecot-cn
+ fi
+}
+
# upgrade bind separately so DNS is not down for too long
# or breaks postinst scripts of other cn packages that depend on
# working resolver
pkgadd bind9-cn
}
+# handle fail2ban upgrade due to error:
+# trying to overwrite '/etc/fail2ban/filter.d/dovecot.conf', which is also in package fail2ban-cn
+upgrade_fail2ban() {
+ if pkg fail2ban-cn && dpkg -L fail2ban-cn | grep -qF dovecot.conf; then
+ pkgrm fail2ban-cn
+ pkgadd fail2ban
+ pkgadd fail2ban-cn
+ fi
+}
+
get_variable () {
local name=$1 file=$2 val