There is a bug in the latest amavisd-release as found in Debian sid and
carried into Ubuntu 18.04 (bionic): the unix socket is incorrectly defined.
The effect is that amavisd-release will not release quarantined emails
because it can't find the unix socket. You can fix it manually or use the
attached bash script which checks it and offers a fix if required.

The reason for the problem is that Debian's packaged amavis uses
non-standard $MYHOME '/var/lib/amavis' instead of '/var/amavis' and this
has not (yet) been corrected in the packaged version of amavisd-release (it
was corrected in the previously-packaged 2.10).

(I've submitted a bug report for Ubuntu and hopefully it will make its way
back to the Debian maintainers.)
#!/bin/bash
VERSION="0.2 [01 Aug 2018]"
THIS=$(basename $0)
echo -e "\n$THIS v$VERSION - by Dominic Raferd [email protected]
${THIS//?/=}\n"
echo -e "This checks and can fix amavisd-release to use \
the correct unix socket for amavisd-new\n"
AMAVISD_RELEASE=$(whereis amavisd-release|cut -d" " -f2)
if [[ ! -x $AMAVISD_RELEASE ]]; then
  echo "Can't find amavisd-release, aborting" >&2
  exit 1
fi
echo -e "Found amavisd-release at '$AMAVISD_RELEASE'\n"
# SOCKETDATA[0]: line number containing the definition in amavisd-release
# SOCKETDATA[1]: the socket address defined in amavisd-release
SOCKETDATA=( $(grep -n '^\s*$socketname =' $AMAVISD_RELEASE|\
awk -F"[\"':]" '{print $1,$3}') )
[[ -n ${SOCKETDATA[0]} && -n ${SOCKETDATA[1]} ]] || { echo "Can't locate \
\$socketname in $AMAVISD_RELEASE, aborting" >&2; exit 1; }
TRUESOCKET=$(grep -r "^\$unix_socketname =" /etc/amavis/conf.d\
|awk -F"['\"]" '{print $2}')
if [[ -z $TRUESOCKET ]]; then
  echo "Can't find \$unix_socketname in /etc/amavis/conf.d, aborting">&2
  EXITCODE=1
elif [[ ${SOCKETDATA[1]} == $TRUESOCKET ]]; then
  echo "$AMAVISD_RELEASE already has correct socket address 
'$TRUESOCKET', no change required"
  EXITCODE=0
else
  echo -e "$AMAVISD_RELEASE has wrong socket address \
${SOCKETDATA[1]} at line ${SOCKETDATA[0]}"
  if [[ $(id -u) != 0 ]]; then
    echo "You must be root to fix this, aborting now" >&2
    EXITCODE=1
  else
    read -t 30 -p "Change it now to $TRUESOCKET (y/-)? "
    if [[ $REPLY != y ]]; then
      echo "No changes made"
    else
      sed -i "${SOCKETDATA[0]}{s~=.*~= \"$TRUESOCKET\"~}" $AMAVISD_RELEASE
      echo "Change was attempted, please re-run $THIS to check it is now ok"
    fi
    EXITCODE=0
  fi
fi
exit $EXITCODE

Reply via email to