# SASL support in postfix



## devnill (Dec 5, 2011)

I'm managing a mail server running postfix and dovecot. Right now it's mainly used to relay mail using virtual alias mapping and I would like to enable SASL support so that users can send mail from their accounts. I've added 
	
	



```
smtpd_sasl_auth_enable = yes
```
 to my main.cf, but when I run `postconf -a` nothing is returned. Does this mean I need to recompile postfix with SASL support?  How can I get SASL working?

Thanks!


----------



## gkontos (Dec 5, 2011)

It is a bit more complicated. Have a look at this guide it will give you some hints on how to make it work.

Regards


----------



## ecazamir (Dec 6, 2011)

1. Compile and install Dovecot

2. Compile Postfix with SASL support, according to your dovecot version

3. Create the authentication socket in dovecot config (dovecot.conf, if you use dovecot 1.x)

```
auth default {
    mechanisms = plain login
    passdb sql {
        args = /usr/local/etc/dovecot/dovecot-mysql.conf
    }
    userdb prefetch {
    }
    userdb sql {
        args = /usr/local/etc/dovecot/dovecot-mysql.conf
    }

[color="Red"]    socket listen {
        client {
            path = /var/spool/postfix/private/auth
            mode = 0660
            user = postfix
            group = postfix
        }[/color]
    }
}
```

4. Use this socket with postfix (main.cf)

```
# SASL
[color="Red"]smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth[/color]
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
broken_sasl_auth_clients = yes
```

5. Proceed with the remaining SASL options for postfix.


----------



## devnill (Dec 6, 2011)

I already had dovecot and postfix installed. I ran `make deinstall` in /usr/ports/mail/postfix and changed the flag for sasl support to on and ran `make install clean`

After adding the sasl lines to main.cf, *postconf -a* still returns nothing. Is there a way to tell what is causing this to fail?


----------



## ecazamir (Dec 7, 2011)

Try the following:

```
cd /usr/ports/mail/postfix
make config
```
Make sure that 'DOVECOT' (or 'DOVECOT2' if you like) is checked. Then rebuild the package.


----------

