0

I'm trying to setup a postifix server with virtualmin and while doing so I ran into a SASL error that said "No such file or directory". So I tried testing it with "testsaslauthd -u username -p password", but this also gave me the "No such file or directory" error. The postfix installation seems chrooted, but the /var/spool/postfix/var/run/saslauthd/ directory is empty. Looking at the numerous articles I found while googling there should be a mux file and some other ones in that directory when postfix is chrooted. My guess is that this is what causes the "No such file or directory" error.

How can I force generate the missing files to fix this issue? Or does anyone know how to resolve this issue otherwise?

The full error (using sudo gives the same result):

$ testsaslauthd -u username -p password
connect() : No such file or directory
0:

I know that the postfix installation is chrooted because it has set the smtp service to chrooted: y in /etc/postfix/master.cf. All config files I could find try to find the saslauth files at /var/spool/postfix/var/run/saslauth/, but this directory is empty for me.

Apologies if anything is missing. It's my first time posting on here, or any tech forum for that matter.

Jasper
  • 1
  • 2
  • Issues caused by web hosting control panel are generally off topic [here](https://serverfault.com/help/on-topic). In any case, questions asking for help with diagnosing should include the full error message, and relevant configuration (check the tag descriptions for more on that). – anx Sep 17 '22 at 15:39
  • 1
    *The postfix installation seems chrooted* - You need to figure out what your config is for all involved services, and include relevant sections in the question. – vidarlo Sep 17 '22 at 15:46
  • -1 on the tag police, +1 on the helpful comment about chrooted. – Steve Owens Dec 12 '22 at 01:44

1 Answers1

2

This issue is not caused by a web hosting contol panel, I had the same issue setting up a postfix + cyrus imap with sasl authentication. There is an answer to this here which works like a charm

http://blog.bekyarov.info/2013/01/04/testsaslauthd-connect-no-such-file-or-directory-0-postfix-postfixsmtpd11571-warning-sasl-authentication-failure-cannot-connect-to-saslauthd-server-no-such-file-or-directory/

Basically modern postfix runs chrooted under /var/spool/postfix, and typically the saslautd stuff is created under /var/spool/postfix/var/run/saslauthd (assuming you are following the up to date tutorials).

Older versions of postfix did not run chrooted by default, and then people started realizing that having their server taken over by hackers makes for a bad day, so chroot became the default as an extra layer of defense. But with that there is some complexity. From the postfix user perspective when it's processes run '/var/spool/postfix' looks like '/' to postfix (or to any hacker running malware inside of postfix). So even if they get control of the postfix process, they are kind of stuck inside the chroot jail.

But when the actual saslauthd daemon runs it's looking for this directory under /var/run/saslauthd. Because it isn't running in chroot jail, and the tutorials don't really show you how to make it look in the right place for stuff. So to fix it just create a symlink from the actual directory under /var/spool/postfix/var/run/saslauthd to /var/run/saslauthd. Saslauthd can follow the symlink into the jail while postfix cannot see outside the jail.

Then test using the following:

testsaslauthd -r mydomain.com -u myusername -p mypassword

Assuming you are testing for the user with the email: myusername@mydomain.com

Steve Owens
  • 119
  • 4