wrong hard-coded socket location in amavisd-release

Bug #1784625 reported by Dominic Raferd
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pkg-website
Invalid
Undecided
Unassigned

Bug Description

In amavis 2.11 the utility amavisd-release has a hard-coded location for amavisd's unix socket at line 90 as '/var/amavis/amavisd.sock' which is not aligned with the location actually set in /etc/amavis/conf.d/25-amavis_helpers where it is "/var/lib/amavis/amavisd.sock".

This causes amavisd-release to fail when trying to release a quarantined email for delivery.

Changing the hard-coded location in /usr/sbin/amavisd-release at line 90 to match the setting in /etc/amavis/conf.d/25-amavis_helpers fixes the problem.

The previous version of amavis (2.10), used with Ubuntu 16.04, did not have this problem I think. I believe it is new with the version installed (using apt-get) with Ubuntu 18.04 (i.e. 2.11). I have not tested intervening distros.

Tags: amavis
Revision history for this message
Dominic Raferd (dominic-timedicer) wrote :

This bug is an incompatibility between the setting in debian package of amavis 2.11 which has:

/etc/amavis/conf.d/25-amavis_helpers at line 25:
    $unix_socketname = "/var/lib/amavis/amavisd.sock";
/usr/sbin/amavisd-release at line 90:
    $socketname = '/var/amavis/amavisd.sock';

As directory /var/amavis does not exist, the only realistic solution is to change the setting in amavisd-release.

The problem arises because in Debian (and hence Ubuntu), $MYHOME is hard-coded to /var/lib/amavis whereas in the default installation, it is /var/amavis. And amavisd-release does not seem to use the $MYHOME setting.

Sorry this bug report needs to be passed to Debian maintainers...

Revision history for this message
Dominic Raferd (dominic-timedicer) wrote :

Here's bash code to check and if necessary fix the incorrect socket setting in amavisd-release:

#!/bin/bash
VERSION="0.1 [01 Aug 2018]"
THIS=$(basename $0)
echo -e "\n$THIS v$VERSION - by Dominic Raferd <email address hidden>\n${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)
[[ -x $AMAVISD_RELEASE ]] || { echo "Can't locate amavisd-release, aborting" >&2; exit 1; }
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 "Unable to 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 to check it is ok now"
  fi
  EXITCODE=0
 fi
fi
exit $EXITCODE

Revision history for this message
Rhonda D'Vine (rhonda) wrote :

Please file the bugreports to the corresponding package. This is not an issue with the packages website.

Thanks,
Rhonda

Changed in pkg-website:
status: New → Invalid
Revision history for this message
Dominic Raferd (dominic-timedicer) wrote :

OK I have done that now, sorry for the mistake

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.