View Full Version : Trouble with Postfix setup not working
wmkconn
6th April 2008, 03:56
I am attempting to be a Windows to Ubuntu convert so please excuse my ignorance.
I have installed Postfix, Courier, etc onto UBUNTU 8.04 Beta. I used Falko's "Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 7.10)". Everything with well until I was done. It doesn't work and I am extremely frustrated. Had to make a few minor adjustments like apt-get install libdb4.6-dev instead of 4.5 and had to do a apt-get update before that.
Here is my setup and what I am trying to do:
I have 2 FQDN that I can use: example1.com and example2.com
I do not do my own DNS but setup my domains through Dotster. I generally don't use mail.example1.com but rather just use example1 as my mail server name.
I have a static IP that I think I have setup properly on the machine itself because I do have internet access.
My machine name is: Memphis. I do not have a domain setup for my machine. In the main.cf file for postfix I use myhostname=example1.com
I then setup for example1.com and example2.com in the domain table and setup several users for each domain.
Here are some of the log entries:
pop3d: chdir example1/user/: No such file or directory (Do I need to setup a directory on my drive for every user? That is what I was trying to avoid.
postfix/smtpd[12784]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <user@example1.com>: Temporary Lookup failure; from=<user@example1.com> to=<user@example1.com> proto=ESMTP helo=<ME>
I just don't even know where to start. Please help.
wmkconn
6th April 2008, 04:28
when I quit out of my telnet localhost 25 session after getting the Temporary Lookup failure, I get the following error:
virtual_alias_maps map lookup problem for postmaster@4conns.com
Thing is I don't have a postmaster account and not sure why it tries to use one.
wmkconn
6th April 2008, 07:17
OK I actually have some of this working.
I had the wrong field in one of my mysql statements which was giving me the error. Not sure how that happened because I was copying and pasting from the tutorial. Oh well.
Now I can send email from telnet. I sent a test message to my gmail account and received it fine. When I replied to the email that also worked. I have Outlook setup with POP3 and it receives fine but when I attempt to send and email using Outlook it gives me an immediate response back saying message could not be delivered
550 5.1.1 <user@example1.com> User unknown; rejecting
Any ideas?
I also changed my hosts file and my interfaces file.
interfaces was missing auto eth0
and I added my static IP into the hosts file
xx.xx.xx.xx mail mail.example1.com
falko
6th April 2008, 20:03
OK I actually have some of this working.
I had the wrong field in one of my mysql statements which was giving me the error. Not sure how that happened because I was copying and pasting from the tutorial. Oh well.
Now I can send email from telnet. I sent a test message to my gmail account and received it fine. When I replied to the email that also worked. I have Outlook setup with POP3 and it receives fine but when I attempt to send and email using Outlook it gives me an immediate response back saying message could not be delivered
550 5.1.1 <user@example1.com> User unknown; rejecting
Any ideas?
I also changed my hosts file and my interfaces file.
interfaces was missing auto eth0
and I added my static IP into the hosts file
xx.xx.xx.xx mail mail.example1.comAny errors in your mail log? What's in /etc/postfix/main.cf?
wmkconn
6th April 2008, 22:30
Current situation:
-Can send from linux machine using telnet localhost 25 without issue.
-Cannot send from another machine (i.e. Windows machine with Outlook) even with SMTP authentication enabled. Logs indicate :
Apr 6 14:07:40 memphis postfix/smtpd[16882]: connect from unknown[75.145.223.25]
Apr 6 14:07:40 memphis postfix/smtpd[16882]: warning: SASL authentication failure: cannot connect to saslauthd server: Permission denied
Apr 6 14:07:40 memphis postfix/smtpd[16882]: warning: unknown[75.145.223.25]: SASL LOGIN authentication failed: generic failure
Apr 6 14:07:40 memphis postfix/smtpd[16882]: lost connection after AUTH from unknown[75.145.223.25]
-ClamAV is showing an error everytime saying clamav.ctl can't be found. Doesn't appear to be stopping anything however. Here is the error from the logs:
Apr 6 13:59:44 memphis amavis[11472]: (11472-04) (!)ClamAV-clamd: Can't connect to UNIX socket /var/run/clamav/clamd.ctl: No such file or directory, retrying (2)
Apr 6 13:59:50 memphis amavis[11472]: (11472-04) (!)run_av (ClamAV-clamd, built-in i/f): Too many retries to talk to /var/run/clamav/clamd.ctl (Can't connect to UNIX socket /var/run/clamav/clamd.ctl: No such file or directory) at (eval 86) line 310.
Apr 6 13:59:50 memphis amavis[11472]: (11472-04) (!!)ClamAV-clamd av-scanner FAILED: CODE(0x8154570) Too many retries to talk to /var/run/clamav/clamd.ctl (Can't connect to UNIX socket /var/run/clamav/clamd.ctl: No such file or directory) at (eval 86) line 310. at (eval 86) line 511.
Apr 6 13:59:50 memphis amavis[11472]: (11472-04) (!!)WARN: all primary virus scanners failed, considering backups
Below is my main.cf file:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = /usr/share/doc/postfix
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
myhostname = 4conns.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_map$
content_filter = amavis:[127.0.0.1]:10024
MASTER.CF file
smtp inet n - - - - smtpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
-
wmkconn
7th April 2008, 03:37
I got it to work by doing the following:
chmod 777 /var/spool/postfix/var/run/saslauthd
1. Why did I have to do that?
2. Is it safe?
wmkconn
7th April 2008, 07:29
This fix works fine until you restart your computer. I would imagine it would do the same by simply restarting saslauthd.
I have looked through /etc/init.d/saslauthd to find where it changes permissions back but can't find any chmod command listed. What else should I look for?
Is there another way around this permission problem?
falko
7th April 2008, 18:50
Did you configure saslauthd exactly as shown in chapter 6 on http://www.howtoforge.com/virtual-users-and-domains-with-postfix-ubuntu-7.10-p3 ?
wmkconn
7th April 2008, 23:06
I have verified that everything is correct. I have included files below:
/etc/default/saslauthd
START=yes
DESC="SASL Authentication Daemon"
NAME="saslauthd"
MECHANISMS="pam"
MECH_OPTIONS=""
THREADS=5
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
/etc/pam.d/smtp
auth required pam_mysql.so user=mail_admin passwd=xxx host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1
account sufficient pam_mysql.so user=mail_admin passwd=xxx host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1
/etc/postfix/sasl/smtpd.conf
pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: mail_admin
sql_passwd: xxx
sql_database: mail
sql_select: select password from users where email = '%u'
ls -la on /var/spool/postfix/var/run/saslauthd
drwxrwxrwx 2 root sasl 4096 2008-04-06 23:24 .
drwxr-xr-x 3 root root 4096 2008-04-05 13:57 ..
-rw------- 1 root root 0 2008-04-06 23:24 cache.flock
-rw------- 1 root root 945152 2008-04-06 23:26 cache.mmap
srwxrwxrwx 1 root root 0 2008-04-06 23:24 mux
-rw------- 1 root root 0 2008-04-06 23:24 mux.accept
-rw------- 1 root root 5 2008-04-06 23:24 saslauthd.pid
The contents of the saslauthd.pid is 5738.
Here is ls -la on /var/spool/postfix/var/run/ after chmod 777
drwxr-xr-x 3 root root 4096 2008-04-05 13:57 .
drwxr-xr-x 3 root root 4096 2008-04-05 13:57 ..
drwxrwxrwx 2 root sasl 4096 2008-04-06 23:24 saslauthd
Keith
wmkconn
7th April 2008, 23:29
here is the ls -la of /var/spool/postfix/var/run/ after a reboot.
drwxr-xr-x 3 root root 4096 2008-04-05 13:57 .
drwxr-xr-x 3 root root 4096 2008-04-05 13:57 ..
drwx--x--- 2 root sasl 4096 2008-04-07 15:09 saslauthd
wmkconn
7th April 2008, 23:56
I found in a couple of forum articles and another Howto the following:
Add:
adduser postfix sasl
ln -s /var/spool/postfix/var/run/saslauthd /var/run/saslauthd
Are the above good fixes? Your thoughts would be appreciated.
Keith
falko
8th April 2008, 10:24
I found in a couple of forum articles and another Howto the following:
Add:
adduser postfix sasl
ln -s /var/spool/postfix/var/run/saslauthd /var/run/saslauthd
Are the above good fixes? Your thoughts would be appreciated.
Keith
Haven't tried this, but you can.
What's in /etc/init.d/saslauthd?
wmkconn
8th April 2008, 16:15
#! /bin/sh
### BEGIN INIT INFO
# Provides: saslauthd
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: saslauthd startup script
# Description: This script starts the saslauthd daemon. It is
# configured using the file /etc/default/saslauthd.
### END INIT INFO
# Author: Fabian Fagerholm <fabbe@debian.org>
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
# Global variables
DAEMON=/usr/sbin/saslauthd
DEFAULT_FILES=`find /etc/default -regex '/etc/default/saslauthd[_a-zA-Z0-9\-]*$' -print | sort`
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Function that starts all saslauthd instances
# Parameters: none
# Return value: none
do_startall()
{
for instance in $DEFAULT_FILES
do
start_instance $instance
done
}
# Function that stops all saslauthd instances
# Parameters: none
# Return value: none
do_stopall()
{
for instance in $DEFAULT_FILES
do
stop_instance $instance
done
}
# Function that sends a SIGHUP to all saslauthd instances
# Parameters: none
# Return value: none
do_reloadall()
{
for instance in $DEFAULT_FILES
do
reload_instance $instance
done
}
# Function that starts a single saslauthd instance
# Parameters:
# $1 = path of default file for this instance
# Return value:
# 0 on success (does not mean the instance started)
# 1 on failure
start_instance()
{
# Load defaults file for this instance.
. $1
# If the daemon is not enabled, give the user a warning and stop.
if [ "$START" != "yes" ]; then
log_warning_msg "To enable $NAME, edit $1 and set START=yes"
return 0
fi
# If the short name of this instance is undefined, warn the user
# but choose a default name.
if [ -z "$NAME" ]; then
log_warning_msg "Short name (NAME) undefined in $1, using default"
NAME=default
fi
log_daemon_msg "Starting $DESC" "$NAME"
# Determine run directory and pid file location by looking
# for an -m option.
RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'`
if [ -z "$RUN_DIR" ]; then
# No run directory defined in defaults file, fail.
log_failure_msg "No run directory defined for $NAME, not starting"
return 1
fi
PIDFILE=$RUN_DIR/saslauthd.pid
# If no mechanisms are defined, fail.
if [ -z "$MECHANISMS" ]; then
log_failure_msg "No mechanisms defined in $1, not starting $NAME"
return 1
fi
# If there are mechanism options defined, prepare them for use with
# the -O flag.
if [ -n "$MECH_OPTIONS" ]; then
MECH_OPTIONS="-O $MECH_OPTIONS"
fi
# If there is a threads option defined, prepare it for use with
# the -n flag.
if [ -n "$THREADS" ]; then
THREAD_OPTIONS="-n $THREADS"
fi
# Construct argument string.
DAEMON_ARGS="-a $MECHANISMS $MECH_OPTIONS $OPTIONS $THREAD_OPTIONS"
# If there is a statoverride for the run directory, then pull
# permission and ownership information from it and create the directory.
# Otherwise, we create the directory with default permissions and
# ownership (root:sasl, 710).
if dpkg-statoverride --list $RUN_DIR > /dev/null; then
createdir `dpkg-statoverride --list $RUN_DIR`
else
createdir root sasl 710 $RUN_DIR
fi
# Start the daemon, phase 1: see if it is already running.
start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME \
--exec $DAEMON --test > /dev/null
if [ "$?" != 0 ]; then
log_progress_msg "(already running)"
log_end_msg 0
return 0
fi
# Start the daemon, phase 2: it was not running, so actually start it now.
start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME \
--exec $DAEMON -- $DAEMON_ARGS
if [ "$?" -ne 0 ]; then
log_end_msg 1
return 1
fi
# Started successfully.
log_end_msg 0
return 0
}
# Function that stops a single saslauthd instance
# Parameters:
# $1 = path of default file for this instance
# Return value:
# 0 on success (daemon was stopped)
# 1 if the daemon was already stopped
# 2 if the daemon could not be stopped
stop_instance()
{
# Load defaults file for this instance.
. $1
# If the short name of this instance is undefined, warn the user
# but choose a default name.
if [ -z "$NAME" ]; then
log_warning_msg "Short name (NAME) undefined in $1, using default"
NAME=default
fi
# Determine run directory and pid file location by looking
# for an -m option.
RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'`
if [ -z "$RUN_DIR" ]; then
# No run directory defined in defaults file, fail.
log_failure_msg "No run directory defined for $NAME, cannot stop"
return 2
fi
PIDFILE=$RUN_DIR/saslauthd.pid
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile $PIDFILE --exec $DAEMON
if [ "$?" -eq 2 ]; then
# Failed to stop.
log_end_msg 1
return 2
fi
if [ "$?" -eq 1 ]; then
# Already stopped.
log_progress_msg "(not running)"
fi
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
# Stopped successfully.
log_end_msg 0
return $RETVAL
}
# Function that sends a SIGHUP to a single saslauthd instance
# Parameters:
# $1 = path of default file for this instance
# Return value:
# 0 on success (does not mean the daemon was reloaded)
# other values on failure
reload_instance()
{
# Load defaults file for this instance.
. $1
# If the short name of this instance is undefined, warn the user
# but choose a default name.
if [ -z "$NAME" ]; then
log_warning_msg "Short name (NAME) undefined in $1, using default"
NAME=default
fi
# Determine run directory and pid file location by looking
# for an -m option.
RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'`
if [ -z "$RUN_DIR" ]; then
# No run directory defined in defaults file, fail.
log_failure_msg "No run directory defined for $NAME, cannot reload"
return 2
fi
PIDFILE=$RUN_DIR/saslauthd.pid
log_daemon_msg "Reloading $DESC" "$NAME"
# Reload the daemon. First, see if it is already running.
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON --test > /dev/null
if [ "$?" -eq 0 ]; then
# Not running, signal this and stop.
log_progress_msg "(not running)"
log_end_msg 0
return 0
fi
start-stop-daemon --stop --signal 1 \
--pidfile $PIDFILE --exec $DAEMON
log_end_msg $?
}
# Function that creates a directory with the specified
# ownership and permissions
# Parameters:
# $1 = user
# $2 = group
# $3 = permissions (octal)
# $4 = path to directory
# Return value: none
createdir()
{
# In the future, use -P/-Z to have SE Linux enhancement
install -d --group="$2" --mode="$3" --owner="$1" "$4"
}
# Action switch
case "$1" in
start)
do_startall
;;
stop)
do_stopall
;;
reload|force-reload)
do_reloadall
;;
restart)
do_stopall
do_startall
;;
start-instance)
if [ -f /etc/default/$2 ]; then
start_instance /etc/default/$2
else
log_failure_msg "Instance $2 does not exist."
fi
;;
stop-instance)
if [ -f /etc/default/$2 ]; then
stop_instance /etc/default/$2
else
log_failure_msg "Instance $2 does not exist."
fi
;;
reload-instance|force-reload-instance)
if [ -f /etc/default/$2 ]; then
reload_instance /etc/default/$2
else
log_failure_msg "Instance $2 does not exist."
fi
;;
restart-instance)
if [ -f /etc/default/$2 ]; then
stop_instance /etc/default/$2
start_instance /etc/default/$2
else
log_failure_msg "Instance $2 does not exist."
fi
;;
*)
SCRIPTNAME=$0
echo -ne "Usage: $SCRIPTNAME"\
"{start|stop|restart|reload|force-reload}\n" \
" or {start-instance|stop-instance|restart-instance|\n" \
" reload-instance|force-reload-instance} <instance name>\n" \
>&2
exit 3
;;
esac
:
falko
9th April 2008, 22:45
You can try to change
createdir root sasl 710 $RUN_DIR
to
createdir root sasl 777 $RUN_DIR
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.