<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Debian Tutorials &#187; sasl</title>
	<atom:link href="http://www.debiantutorials.com/tag/sasl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.debiantutorials.com</link>
	<description>Copy/Paste tutorials for Debian based Linux distros</description>
	<lastBuildDate>Tue, 27 Dec 2011 01:15:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Installing Postfix with MySql backend and SASL for SMTP authentication</title>
		<link>http://www.debiantutorials.com/installing-postfix-with-mysql-backend-and-sasl-for-smtp-authentication/</link>
		<comments>http://www.debiantutorials.com/installing-postfix-with-mysql-backend-and-sasl-for-smtp-authentication/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 10:45:13 +0000</pubDate>
		<dc:creator>aip</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Squeeze]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[tls]]></category>

		<guid isPermaLink="false">http://www.debiantutorials.net/?p=186</guid>
		<description><![CDATA[Postfix is a free and open source mail transfer agent (MTA). It is intended as a fast, easy-to-administer, and secure alternative to the widely-used Sendmail MTA. Install and configure Postfix 1. Install Postfix and SASL apt-get install postfix postfix-mysql libsasl2-modules-sql sasl2-bin libsasl2-2 postfix-tls libpam-mysql > Internet Site > host.domain.com 2. Create database and tables (mysql [...]]]></description>
			<content:encoded><![CDATA[<p>Postfix is a free and open source mail transfer agent (MTA). It is intended as a fast, easy-to-administer, and secure alternative to the widely-used Sendmail MTA.</p>
<p><strong>Install and configure Postfix</strong></p>
<p>1. Install Postfix and SASL</p>
<p><code>apt-get install postfix postfix-mysql libsasl2-modules-sql sasl2-bin libsasl2-2 postfix-tls libpam-mysql<br />
> Internet Site<br />
> host.domain.com<br />
</code><span id="more-186"></span></p>
<p>2. Create database and tables (mysql -u root -p)</p>
<p><code># Create the database<br />
CREATE DATABASE mail;<br />
&nbsp;<br />
# Create user and allow him to read from the mail database<br />
GRANT SELECT ON mail.* TO '{username}'@'localhost' IDENTIFIED BY '{password}';<br />
FLUSH PRIVILEGES;<br />
&nbsp;<br />
# Select the mail database<br />
USE mail;<br />
&nbsp;<br />
# Create table containing domains handled by this mail server<br />
CREATE TABLE domains (<br />
	domain varchar(255) NOT NULL,<br />
	PRIMARY KEY (domain)<br />
) TYPE=MyISAM;<br />
&nbsp;<br />
# Create table for e-mail address forwardings<br />
CREATE TABLE forwardings (<br />
	source varchar(255) NOT NULL,<br />
	destination varchar(255) NOT NULL,<br />
	PRIMARY KEY (source)<br />
) TYPE=MyISAM;<br />
&nbsp;<br />
# Create table for e-mail accounts / users<br />
CREATE TABLE users (<br />
	email varchar(255) NOT NULL,<br />
	password varchar(255) NOT NULL,<br />
	quota int(10) DEFAULT '104857600',<br />
	PRIMARY KEY (email)<br />
) TYPE=MyISAM;<br />
&nbsp;<br />
# Create table for transports<br />
CREATE TABLE transport (<br />
	domain varchar(255) NOT NULL,<br />
	transport varchar(255) NOT NULL,<br />
	UNIQUE KEY domain (domain)<br />
) TYPE=MyISAM;<br />
</code></p>
<p><em>{username} = A new MySql user used by Postfix to access the MySql data<br />
{password} = A password for the new MySql user</em></p>
<p>3. Create Postfix to MySql mappings</p>
<p>Domains (pico /etc/postfix/mysql-virtual_domains.cf)</p>
<p><code>user = {username}<br />
password = {password}<br />
dbname = mail<br />
table = domains<br />
select_field = 'virtual'<br />
where_field = domain<br />
hosts = 127.0.0.1<br />
</code></p>
<p>Forwards (pico /etc/postfix/mysql-virtual_forwardings.cf)</p>
<p><code>user = {username}<br />
password = {password}<br />
dbname = mail<br />
table = forwardings<br />
select_field = destination<br />
where_field = source<br />
hosts = 127.0.0.1<br />
</code></p>
<p>Mailboxes / Users (pico /etc/postfix/mysql-virtual_mailboxes.cf)</p>
<p><code>user = {username}<br />
password = {password}<br />
dbname = mail<br />
table = users<br />
select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')<br />
where_field = email<br />
hosts = 127.0.0.1<br />
</code></p>
<p>E-mail to E-mail (pico /etc/postfix/mysql-virtual_email2email.cf)</p>
<p><code>user = {username}<br />
password = {password}<br />
dbname = mail<br />
table = users<br />
select_field = email<br />
where_field = email<br />
hosts = 127.0.0.1<br />
</code></p>
<p>Transports (pico /etc/postfix/mysql-virtual_transports.cf)</p>
<p><code>user = {username}<br />
password = {password}<br />
dbname = mail<br />
table = transport<br />
select_field = transport<br />
where_field = domain<br />
hosts = 127.0.0.1<br />
</code></p>
<p>Quota (pico /etc/postfix/mysql-virtual_mailbox_limit_maps.cf)</p>
<p><code>user = {username}<br />
password = {password}<br />
dbname = mail<br />
table = users<br />
select_field = quota<br />
where_field = email<br />
hosts = 127.0.0.1<br />
</code></p>
<p>Destinations (pico /etc/postfix/mysql-mydestination.cf)</p>
<p><code>user = {username}<br />
password = {password}<br />
dbname = mail<br />
table = transport<br />
select_field = domain<br />
where_field = domain<br />
hosts = 127.0.0.1<br />
</code></p>
<p><em>{username} = The username you selected for the new MySql user<br />
{password} = The password you selected for the new MySql user</em></p>
<p>4. Change permissions on the new files</p>
<p><code>chmod 640 /etc/postfix/mysql-*.cf<br />
chgrp postfix /etc/postfix/mysql-*.cf<br />
</code></p>
<p><em>Make sure they aren't readable by any user because the password is included</em></p>
<p>5. Create a local user and group for the virtual users</p>
<p><code>groupadd -g 5000 vmail<br />
useradd -g vmail -u 5000 vmail -d /home/vmail -m<br />
</code></p>
<p>6. Create certificates for TLS</p>
<p><code>openssl req -new -outform PEM -out /etc/postfix/smtpd.cert -newkey rsa:2048 -nodes -keyout /etc/postfix/smtpd.key -keyform PEM -days 3650 -x509<br />
chmod 640 /etc/postfix/smtpd.key<br />
</code></p>
<p>7. Configure Postfix</p>
<p><code>postconf -e 'mydestination = localhost, proxy:mysql:/etc/postfix/mysql-mydestination.cf'<br />
postconf -e 'virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf'<br />
postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf'<br />
postconf -e 'virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf'<br />
postconf -e 'virtual_mailbox_base = /home/vmail'<br />
postconf -e 'virtual_uid_maps = static:5000'<br />
postconf -e 'virtual_gid_maps = static:5000'<br />
postconf -e 'smtpd_sasl_auth_enable = yes'<br />
postconf -e 'smtpd_helo_required = yes'<br />
postconf -e 'broken_sasl_auth_clients = yes'<br />
postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination'<br />
postconf -e 'smtpd_use_tls = yes'<br />
postconf -e 'smtpd_tls_cert_file = /etc/postfix/smtpd.cert'<br />
postconf -e 'smtpd_tls_key_file = /etc/postfix/smtpd.key'<br />
postconf -e 'strict_rfc821_envelopes = yes'<br />
postconf -e 'disable_vrfy_command = yes'<br />
postconf -e 'transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf'<br />
postconf -e 'virtual_create_maildirsize = yes'<br />
postconf -e 'virtual_mailbox_extended = yes'<br />
postconf -e 'virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf'<br />
postconf -e 'virtual_mailbox_limit_override = yes'<br />
postconf -e 'virtual_maildir_limit_message = "Account is over quota"'<br />
postconf -e 'virtual_overquota_bounce = yes'<br />
postconf -e '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_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps'<br />
</code></p>
<p>8. Enable secure ports: 465 and 587 (pico /etc/postfix/master.cf)</p>
<p><code>smtps     inet  n       -       -       -       -       smtpd<br />
  -o smtpd_tls_wrappermode=yes<br />
  -o smtpd_sasl_auth_enable=yes<br />
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject<br />
  -o milter_macro_daemon_name=ORIGINATING<br />
&nbsp;<br />
587      inet  n       -       -       -       -       smtpd<br />
</code></p>
<p><strong>Configure SASL for SMTP authentication</strong></p>
<p>9. Add the postfix user to the sasl group</p>
<p><code>adduser postfix sasl<br />
</code></p>
<p>10. Create a folder for the SASL PID file</p>
<p><code>mkdir -p /var/spool/postfix/var/run/saslauthd<br />
</code></p>
<p>11. Enable SASL (pico /etc/default/saslauthd)</p>
<p><code>START=yes<br />
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"<br />
</code></p>
<p>12. Configure SASL to use the new PID file location (pico /etc/init.d/saslauthd)</p>
<p><code>PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"<br />
</code></p>
<p><em>Make sure you replace all PIDFILE definations in the file. This is set on a few places.</em></p>
<p>13. Configure PAM to use MySql backend for authentication (pico /etc/pam.d/smtp)</p>
<p><code>auth    required   pam_mysql.so user={username} passwd={password} host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1<br />
account sufficient pam_mysql.so user={username} passwd={password} host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1<br />
</code></p>
<p><em>{username} = The username you selected for the new MySql user<br />
{password} = The password you selected for the new MySql user</em></p>
<p>14. Configure Postfix to use SASl for SMTP authentication (pico /etc/postfix/sasl/smtpd.conf)</p>
<p><code>pwcheck_method: saslauthd<br />
mech_list: plain login<br />
allow_plaintext: true<br />
auxprop_plugin: mysql<br />
sql_hostnames: 127.0.0.1<br />
sql_user: {username}<br />
sql_passwd: {password}<br />
sql_database: mail<br />
sql_select: select password from users where email = '%u'<br />
</code></p>
<p><em>{username} = The username you selected for the new MySql user<br />
{password} = The password you selected for the new MySql user</em></p>
<p>15. Restart Postfix and SASL</p>
<p><code>/etc/init.d/saslauthd restart<br />
/etc/init.d/postfix restart<br />
</code></p>
<p><strong>Test MySql data</strong></p>
<p>1. Handle mail for a domain. This must be done if you will create mailboxes or forwards handled on this server.</p>
<p><code>INSERT INTO domains VALUES ('domain.com');<br />
</code></p>
<p>2. Create user/mailbox. Users will be able to receive mail and send mails using this server</p>
<p><code>INSERT INTO users VALUES ('user@domain.com', ENCRYPT('password'), 104857600);<br />
</code></p>
<p>3. Create forward. A e-mail address used to forward to another e-mail address or multiple e-mail addresses</p>
<p><code>INSERT INTO forwardings VALUES ('user2@domain.com', 'user@domain.com');<br />
</code></p>
<p>Forward to multiple e-mail addresses using a comma to seperate</p>
<p><code>INSERT INTO forwardings VALUES ('user3@domain.com', 'user@domain.com,user@gmail.com');<br />
</code></p>
<p>4. Forward all mails for a domain to another mail server</p>
<p><code>INSERT INTO transport VALUES ('domain.com', 'smtp:server2.domain.com');<br />
</code></p>
<p>Next step is to set up services to support POP3 and IMAP:<br />
<a href="http://www.debiantutorials.net/installing-courier-pop3-and-imap-daemon-with-mysql-backend-install-courier/">Installing Courier POP3 and IMAP daemon with MySql backend / Install Courier</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/installing-postfix-with-mysql-backend-and-sasl-for-smtp-authentication/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Installing Postfix with MySql backend and TLS</title>
		<link>http://www.debiantutorials.com/installing-postfix-with-mysql-backend-and-tls/</link>
		<comments>http://www.debiantutorials.com/installing-postfix-with-mysql-backend-and-tls/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 22:57:36 +0000</pubDate>
		<dc:creator>aip</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[tls]]></category>

		<guid isPermaLink="false">http://www.debiantutorials.net/?p=61</guid>
		<description><![CDATA[In this tutorial we'll install a ready to use Postfix mail server with MySql backend for virtual users. Notice that this tutorial only covers installing the SMTP server (not POP3 and IMAP). Click here for a tutorial on installing Courier POP3 and IMAp services. Once installed and configured, you can easily create your own admin [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial we'll install a ready to use Postfix mail server with MySql backend for virtual users. Notice that this tutorial only covers installing the SMTP server (not POP3 and IMAP). <a href="http://www.debiantutorials.net/installing-courier-pop3-and-imap-services-with-mysql-backend/">Click here for a tutorial on installing Courier POP3 and IMAp services</a>.</p>
<p>Once installed and configured, you can easily create your own admin system to modifiy the domains and users because the table structure is very simple.</p>
<p>This tutorial has been tested on Debian etch and lenny</p>
<p>1. Install the Postfix mail server, MySql server and other required packages</p>
<p><code>apt-get install postfix postfix-mysql sasl2-bin libsasl2-modules mysql-client mysql-server libpam-mysql<br />
</code><span id="more-61"></span>	</p>
<p>In the configuration wizzard for Postfix select and input the following</p>
<p><code>General type of mail configuration<br />
 -> Internet Site<br />
&nbsp;<br />
System mail name<br />
 -> server.domain.com (your server host name)<br />
</code></p>
<p>2. Create a MySql database that will contain domains and mappings and create a user that has read privileges on it. Execute the following SQL queries to create the table structure:</p>
<p><code>CREATE TABLE domains (<br />
  domain varchar(63) NOT NULL,<br />
  PRIMARY KEY (domain)<br />
) ENGINE=MyISAM;<br />
&nbsp;<br />
CREATE TABLE forwardings (<br />
  email varchar(255) NOT NULL,<br />
  destination text NOT NULL,<br />
  PRIMARY KEY (email)<br />
) ENGINE=MyISAM;<br />
&nbsp;<br />
CREATE TABLE transport (<br />
  domain varchar(255) NOT NULL,<br />
  transport varchar(255) NOT NULL,<br />
  PRIMARY KEY (domain)<br />
) ENGINE=MyISAM;<br />
&nbsp;<br />
CREATE TABLE users (<br />
  email varchar(255) NOT NULL,<br />
  password varchar(255) NOT NULL,<br />
  quota int(10) unsigned NOT NULL default '102400',<br />
  PRIMARY KEY (email)<br />
) ENGINE=MyISAM;<br />
</code></p>
<p>3. Populate tables with some test data</p>
<p><code>INSERT INTO domains (domain) VALUES (mydomain.com);<br />
INSERT INTO users (email, password) VALUES ('address@mydomain.com', ENCRYPT('mypassword'));<br />
INESRT INTO forwardings (email, desination) VALUES ('myforward@mydomain.com', 'address@mydomain.com, otheraddress@mydomain.com');<br />
INSERT INTO transport (domain, transport) VALUES ('transport.com', 'smtp:mail.transport.com');<br />
</code></p>
<p><em>If you want to create a user or forwarding for a domain, you must add it to the domains table. Using the transport table you can forward all mail received to another mail server, when using the transport table you don't have to add the domain to the domains table.</em></p>
<p>4. Create MySql mappings for Postfix. Replace {mysql_*} with your MySql credentials.</p>
<p><code>pico /etc/postfix/mysql-virtual_domains.cf<br />
	hosts = {mysql_host}<br />
	user = {mysql_username}<br />
	password = {mysql_password}<br />
	dbname = {mysql_database}<br />
	table = domains<br />
	select_field = 'virtual'<br />
	where_field = domain<br />
&nbsp;<br />
pico /etc/postfix/mysql-virtual_forwardings.cf<br />
	hosts = {mysql_host}<br />
	user = {mysql_username}<br />
	password = {mysql_password}<br />
	dbname = {mysql_database}<br />
	table = forwardings<br />
	select_field = destination<br />
	where_field = email<br />
&nbsp;<br />
pico /etc/postfix/mysql-virtual_mailboxes.cf<br />
	hosts = {mysql_host}<br />
	user = {mysql_username}<br />
	password = {mysql_password}<br />
	dbname = {mysql_database}<br />
	table = users<br />
	select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')<br />
	where_field = email<br />
&nbsp;<br />
pico /etc/postfix/mysql-virtual_email2email.cf<br />
	hosts = {mysql_host}<br />
	user = {mysql_username}<br />
	password = {mysql_password}<br />
	dbname = {mysql_database}<br />
	table = users<br />
	select_field = email<br />
	where_field = email<br />
&nbsp;<br />
pico /etc/postfix/mysql-virtual_transports.cf<br />
	hosts = {mysql_host}<br />
	user = {mysql_username}<br />
	password = {mysql_password}<br />
	dbname = {mysql_database}<br />
	table = transport<br />
	select_field = transport<br />
	where_field = domain<br />
&nbsp;<br />
pico /etc/postfix/mysql-virtual_mailbox_limit_maps.cf<br />
	hosts = {mysql_host}<br />
	user = {mysql_username}<br />
	password = {mysql_password}<br />
	dbname = {mysql_database}<br />
	table = users<br />
	select_field = quota<br />
	where_field = email<br />
</code></p>
<p>5. Set correct permissions on the newly created files and allow Postfix to read the files</p>
<p><code>chmod 640 /etc/postfix/mysql-virtual_*<br />
chgrp postfix /etc/postfix/mysql-virtual_*<br />
</code></p>
<p>6. Create a new user and group named vmail. All incoming mail will be stored in this users home directory</p>
<p><code>groupadd -g 5000 vmail<br />
useradd -g vmail -u 5000 vmail -d /home/vmail -m<br />
</code></p>
<p>7. Configure Postfix to use SASL for user authentication and TLS for encryption</p>
<p><code>postconf -e 'smtpd_sasl_auth_enable = yes'<br />
postconf -e 'broken_sasl_auth_clients = yes'<br />
postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination'<br />
postconf -e 'smtpd_use_tls = yes'<br />
postconf -e 'smtpd_tls_cert_file = /etc/postfix/smtpd.cert'<br />
postconf -e 'smtpd_tls_key_file = /etc/postfix/smtpd.key'<br />
postconf -e 'smtpd_sasl_local_domain = $myhostname'<br />
postconf -e 'smtpd_sasl_security_options = noanonymous'<br />
</code></p>
<p>8. Configure Postfix to use the MySql database to find virtual users, where to store mail and what to do for users over quota</p>
<p><code>postconf -e 'virtual_alias_domains ='<br />
postconf -e 'virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf'<br />
postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf'<br />
postconf -e 'virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf'<br />
postconf -e 'virtual_mailbox_base = /home/vmail'<br />
postconf -e 'virtual_uid_maps = static:5000'<br />
postconf -e 'virtual_gid_maps = static:5000'<br />
postconf -e 'transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf'<br />
postconf -e 'virtual_create_maildirsize = yes'<br />
postconf -e 'virtual_mailbox_extended = yes'<br />
postconf -e 'virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf'<br />
postconf -e 'virtual_mailbox_limit_override = yes'<br />
postconf -e 'virtual_maildir_limit_message = "The user you are trying to reach is over quota."'<br />
postconf -e 'virtual_overquota_bounce = yes'<br />
postconf -e '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_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps'<br />
</code></p>
<p>9. Create a self signed certificate to encrypt connections</p>
<p><code>openssl req -new -outform PEM -out /etc/postfix/smtpd.cert -newkey rsa:2048 -nodes -keyout /etc/postfix/smtpd.key -keyform PEM -days 3650 -x509<br />
chmod 640 /etc/postfix/smtpd.key<br />
</code></p>
<p>10. Make Postfix listen on port 465 for secure smtp connections (pico /etc/postfix/master.cf)</p>
<p><code>smtps     inet  n       -       -       -       -       smtpd<br />
 -o smtpd_tls_wrappermode=yes<br />
 -o smtpd_sasl_auth_enable=yes<br />
 -o smtpd_client_restrictions=permit_sasl_authenticated,reject<br />
</code></p>
<p>11. Force SASL to store the PID files in a location where Postfix can read them</p>
<p><code>mkdir -p /var/spool/postfix/var/run/saslauthd<br />
</code></p>
<p>Edit SASL config to enable the daemon and make it use the new PID file location (pico /etc/default/saslauthd)</p>
<p><code>START=yes<br />
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"<br />
</code></p>
<p>Edit the init file for SASL (pico /etc/init.d/saslauthd)</p>
<p><code>PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"<br />
</code></p>
<p>12. Insert MySql credentials for PAM (pico /etc/pam.d/smtp)</p>
<p><code>auth    required   pam_mysql.so user={mysql_username} passwd={mysql_password} host={mysql_host} db={mysql_database} table=users usercolumn=email passwdcolumn=password crypt=1<br />
account sufficient pam_mysql.so user={mysql_username} passwd={mysql_password} host={mysql_host} db={mysql_database} table=users usercolumn=email passwdcolumn=password crypt=1<br />
</code></p>
<p>13. Config SASL for Postfix and specify MySql credentials (pico /etc/postfix/sasl/smtpd.conf)</p>
<p><code>pwcheck_method: saslauthd<br />
mech_list: plain login<br />
allow_plaintext: true<br />
auxprop_plugin: mysql<br />
sql_hostnames: {mysql_host}<br />
sql_user: {mysql_username}<br />
sql_passwd: {mysql_password}<br />
sql_database: {mysql_database}<br />
sql_select: select password from users where email = '%u'<br />
</code></p>
<p>14. Add the Postfix user to the SASL group allowing Postfix to communicate with SASL</p>
<p><code>adduser postfix sasl<br />
</code></p>
<p>15. Restart Postfix and SASL</p>
<p><code>/etc/init.d/postfix restart<br />
/etc/init.d/saslauthd restart<br />
</code></p>
<p>You're all done. Now you can connect to ports 25 and 465 to sent mails to your virtual users specified in the MySql database. When authenticating with your e-mail client, use the full e-mail address as the username.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/installing-postfix-with-mysql-backend-and-tls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
