#! /bin/sh # postinst script for fail2ban # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # case "$1" in configure) # To fix the bug in generated by previous version files permissions # also closes #352053 LOG=/var/log/fail2ban.log touch $LOG chown root:adm ${LOG}* || true chmod 640 ${LOG}* || true ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_python3 if command -v py3compile >/dev/null 2>&1; then py3compile -p fail2ban || true fi if command -v pypy3compile >/dev/null 2>&1; then pypy3compile -p fail2ban || true fi # End automatically added section # Automatically added by dh_installdeb/14.5 dpkg-maintscript-helper rm_conffile /etc/fail2ban/filter.d/sshd-ddos.conf 1.1.1-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/fail2ban/filter.d/postfix-sasl.conf 1.1.1-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/fail2ban/filter.d/postfix-rbl.conf 1.1.1-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/fail2ban/action.d/nftables-common.conf 1.1.1-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/fail2ban/action.d/iptables-common.conf 1.1.1-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/fail2ban/action.d/badips.conf 1.1.1-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/fail2ban/action.d/badips.py 1.1.1-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/bash_completion.d/fail2ban 1.1.1-1\~ -- "$@" dpkg-maintscript-helper mv_conffile /etc/monit/monitrc.d/fail2ban /etc/monit/conf-available/fail2ban 1.1.1-1\~ -- "$@" # End automatically added section # Automatically added by dh_installinit/14.5 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$DPKG_ROOT/etc/init.d/fail2ban" ]; then update-rc.d fail2ban defaults 99 >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi if [ -z "$DPKG_ROOT" ]; then invoke-rc.d --skip-systemd-native fail2ban $_dh_action || exit 1 fi fi fi # End automatically added section # Automatically added by dh_installsystemd/14.5 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'fail2ban.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'fail2ban.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'fail2ban.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'fail2ban.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.5 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'fail2ban.service' >/dev/null || true fi fi # End automatically added section # Runs after the dpkg-maintscript-helper snippets above, which is when the # monit snippet has finished moving out of /etc/monit/monitrc.d. That # directory was only ever created by this package (see #991367). if [ "$1" = configure ]; then rmdir --ignore-fail-on-non-empty /etc/monit/monitrc.d 2>/dev/null || true fi exit 0