View | Details | Raw Unified
Collapse All | Expand All

(-) /usr/portage/mail-filter/postgrey/files/postgrey.conf (+12 lines)
 Lines 4-18    Link Here 
# Config file for /etc/init.d/postgrey
# Config file for /etc/init.d/postgrey
# TYPE
#  Do you want inet or unix socket version ?
POSTGREY_TYPE="unix"
# SOCKET
#  Which socket do you want to bind ?
#  (ignored if inet type)
#
POSTGREY_SOCKET="/var/spool/postfix/private/postgrey"
# HOST
# HOST
#  What IP to listen to?
#  What IP to listen to?
#  Leave to localhost unless you know what you do.
#  Leave to localhost unless you know what you do.
#  (ignored if socket type)
#
POSTGREY_HOST="127.0.0.1"
POSTGREY_HOST="127.0.0.1"
# PORT
# PORT
#  What PORT to listen to?
#  What PORT to listen to?
#  (ignored if socket type)
#
#
POSTGREY_PORT="10030"
POSTGREY_PORT="10030"
(-) /usr/portage/mail-filter/postgrey/files/postgrey.rc (-6 / +39 lines)
 Lines 9-31    Link Here 
	provide postfix_greylist
	provide postfix_greylist
}
}
conf_error() {
	eerror "You need to setup variables in /etc/conf.d/postgrey first"
	return 1
}
checkconfig() {
checkconfig() {
if [ -z "${POSTGREY_PORT}" ] || [ -z "${POSTGREY_HOST}" ] || [ -z "${POSTGREY_PID}" ]
if [ -z "${POSTGREY_TYPE}" ]
	then
	then
		einfo "You need to choose the server type you want"
		einfo "by setting the TYPE variable."
	else
	if [ "x${POSTGREY_TYPE}" = "xinet" ]
		then
			if [ -z "${POSTGREY_PORT}" ] || [ -z "${POSTGREY_HOST}" ]
				then
					einfo "The following entries are missing in /etc/conf.d/postgrey:"
					[ -z "${POSTGREY_HOST}" ] && einfo "  - POSTGREY_HOST"
					[ -z "${POSTGREY_PORT}" ] && einfo "  - POSTGREY_PORT"
					conf_error
			fi
			POSTGREY_CONF="${POSTGREY_TYPE}=${POSTGREY_HOST}:${POSTGREY_PORT}"
		else
			if [ -z "${POSTGREY_SOCKET}" ]
			then
				einfo "The following entries are missing in /etc/conf.d/postgrey: POSTGREY_SOCKET"
				conf_error
			fi
			POSTGREY_CONF="${POSTGREY_TYPE}=${POSTGREY_SOCKET}"
	fi
fi
	if [ -z "${POSTGREY_PID}" ]
		then
		einfo "The following entries are missing in /etc/conf.d/postgrey:"
		einfo "The following entries are missing in /etc/conf.d/postgrey:"
		[ -z "${POSTGREY_HOST}" ] && einfo "  - POSTGREY_HOST"
		[ -z "${POSTGREY_PORT}" ] && einfo "  - POSTGREY_PORT"
		[ -z "${POSTGREY_PID}" ] && einfo "  - POSTGREY_PID"
		[ -z "${POSTGREY_PID}" ] && einfo "  - POSTGREY_PID"
		eerror "You need to setup variables in /etc/conf.d/postgrey first"
		conf_error
		return 1
	fi
	fi
}
}
start() {
start() {
	checkconfig || return 1
	checkconfig || return 1
	ebegin "Starting Postgrey"
	ebegin "Starting Postgrey"
	
	# HACK -- start a subshell and corrects perms on the socket...
	( if [ "x${POSTGREY_TYPE}" = "xunix" ]; then
	sleep 2 && chmod a+rw,a-x ${POSTGREY_SOCKET}; fi ) &
	start-stop-daemon --start --quiet --background \
	start-stop-daemon --start --quiet --background \
		--exec /usr/sbin/postgrey -- \
		--exec /usr/sbin/postgrey -- \
		--inet=${POSTGREY_HOST}:${POSTGREY_PORT} \
		--${POSTGREY_CONF} \
		--daemonize \
		--daemonize \
		--pidfile=${POSTGREY_PID} \
		--pidfile=${POSTGREY_PID} \
		${POSTGREY_OPTS}
		${POSTGREY_OPTS}