Task: IMAP, SMTP, virtual mailboxes, easy to maintain and manage vdomains and users.

System: production server with CentOS (no gcc, no devel packages), non-production system with CentsOS and gcc.

Tools: postfix, DBMAIL, DBMA, cyrus-sasl2

I had some troubles while tried to setup SMTP AUTH against DBMAIL MySQL database, because there are no exact instruction, that describe many difficult moments.

DBMAIL installation requires postfix with mysql support.

CentsOS 4.2 comes with postfix w/o mysql support, so download

  • postfix-2.1.5-4.2.RHEL4.src.rpm
  • MySQL-client-standard-5.0.18-0.rhel4.i386.rpm
  • MySQL-devel-standard-5.0.18-0.rhel4.i386.rpm
  • MySQL-server-standard-5.0.18-0.rhel4.i386.rpm
  • MySQL-shared-standard-5.0.18-0.rhel4.i386.rpm

from mysql.com and rebuild postfix:

rpmbuild —-rebuild postfix-2.1.5-4.2.RHEL4.src.rpm —-clean

Setup postfix+DBMAIL+DBMA as usual.

I tried to setup SMTP AUTH as described in previous article, but get only a 2 sleepless nights. The problem was with cyrus-sasl-sql library, that understand only plain passwords. But! my dbmail-2.0.10 do not understand plain passwords. May be I miss something when I compiled DBMAIL, but I was so tired so I choose do not investigate this.

So, I start discovering internet with keywords “sasl mysql encryption” and find some pach to cyrus-sasl that allow SMTP AUTH as described in previous article by adding special parameter “password_format: [plaintext|crypt|crypt_trad]”.

Ok, I don't look for easy way, so I tried to recompile cyrus-sasl-2.1.19-5.EL4.src.rpm with patch, copied from cyrus-sasl2-2.1.20-alt7.src.rpm(from Alt Linux repository) but get problem with cyrus-sasl-sql and my MySQL-5.0.18.

And after all I found one article, that described generic steps to setup postfix+cyrus-imapd+cyradm. This article says to use simple pam_mysql module with saslauthd daemon. There are the steps:

  • Install pam_mysql
  • Edit /etc/pam.d/smtp.postfix and synlink smtp.postfix to /etc/pam.d/smtp

content of original etc/pam.d/smtp.postfix:

   #%PAM-1.0
   auth       required    pam_stack.so service=system-auth
   account    required    pam_stack.so service=system-auth

after aditing:

  #%PAM-1.0
  auth sufficient pam_mysql.so user=dbmailuser passwd=dbmailpass host=localhost db=dbmail table=dbmail_users usercolumn=userid passwdcolumn=passwd crypt=1
   
  account required pam_mysql.so user=dbmailuser passwd=dbmailpass host=localhost db=dbmail table=dbmail_users usercolumn=userid passwdcolumn=passwd crypt=1

where are(copy/paste from pam_mysql.s README):

    user(nobody) - The user with access to the open the connection to mysql
    and has permission to read the table with the passwords.
    passwd("") - Password for the same.
    host(localhost) - Machine that is running the sql server
    db(mysql) - database that contents the table with the user/password
    combos
    table(user) - table that you want to use for the user/password checking
    usercolumn(User) - column that has the username field
    passwdcolumn(password) - column that has the password field
    crypt(0) - Used to decide to use MySQL's PASSWORD() function or crypt()
          0 = No encryption. Passwords in database in plaintext. NOT recommended!
          1 = Use crypt
          2 = Use MySQL PASSWORD() function
  • Edit /etc/sysconfig/saslauthd:
   ...
   MECH=pam
   FLAGS=-r
   ...

“FLAGS=-r” option is very important: w/o this option if userid contains domain name, like username@somehost.com pam_mysql will query only “username”, that is unacceptable if you have more than 1 domain.

  • /usr/lib/sasl2/smtpd.conf contains “pwcheck_method: saslauthd”
  • /etc/postfix/main.cf contains:
  broken_sasl_auth_clients = yes
  smtpd_sasl_auth_enable = yes
  smtpd_sasl_security_options = noanonymous
  smtpd_recipient_restrictions =
                              permit_mynetworks,
                              reject_invalid_hostname,
                              reject_non_fqdn_sender,
                              reject_non_fqdn_recipient,
                              reject_unknown_recipient_domain,
                              reject_unauth_pipelining,
                              reject_unknown_sender_domain,
                              permit_sasl_authenticated,
                              reject

After applying this settings restart postfix, saslauthd. Create a user with password encrypter with “crypt” function in DBMA. If you are not using DBMA, you can create the account with dbmail-users by specifying -p crypt. Now attempt to login and send e-mail from place that not described as “mynetworks_style” directive, or comment “permit_mynetworks” and make “mynetworks_style = host”, restart postfix and try from any PC from you'r network.

今晩、誰か泊めてくれませんか〜ぉ礼はするょ^^どこに住んでるか教えてね(*´Д`*)ノシchoco0315@softbank.ne.jp 一晩限りの恋人契約で高額報酬 http://ok.w3vr.cn セフレを探してるんです。love1224hhh@softbank.ne.jpです。必ずお返事します♪待ってるょ 割り切りお付き合いで大金を稼いでみませんか http://ok.rwhvtw.cn 家出をして不安な少女 http://ok.w3yn.cn モテる度を無料診断、モテる度チェッカー http://ok.sey3n78.cn 手軽にお金稼ぎが出来るサイト http://ok.urmi6.cn ネットカフェに寝泊まりしてる子に安息の時間と場所を提供しませんか http://ok.e35n5.cn 女性のオナニーを見るだけで高収入のお仕事 http://ok.w63n5.cn 最近ネット始めたsoraでぇす♪もしよければ誰かお友達になってくださぁい mikumiku_0430@yahoo.co.jp 女性にメールやチャットをして癒してあげるだけで儲かる新感覚のアルバイト http://ok.rgw35u.cn 家出少女のHなお礼 http://ok.46mn.cn あなたのエッチ度を無料チェック http://ok.g3w08.cn 彼女たちを癒して大金を儲ける事も可能です http://ok.dhgq2.cn Hメールや普通に遊んでくれる人募集中なんでいつでもメールしてね(*^-^) nanako_l0oo0l@docomo.ne.jp 時給2万円〜の高額アルバイト、出張ホスト http://ok.bbrba4.cn 割り切ったアルバイト感覚で稼げる逆援バイト http://ok.dhvaw874.cn 一晩のお付き合いで大金を稼げるのが素人ホスト http://ok.gh2048g.cn 家出をして生活が不安な少女を囲ってみませんか? http://ok.ghq34g.cn あなたの隠された性癖がわかる えっちチェッカー http://ok.h824.cn 高級セレブたちとの出会いの場を提供しております http://ok.fh9823g.cn 時間がなくて恋がまったくできません(>c<)22歳にして欲求不満な私ですが、誰か絡んでください! lioil_celebration@docomo.ne.jp 大好評の逆ナンパ出会いイベントがなんと毎週開催決定! http://www.deai-megami.net/ GW特別企画今だけ天皇賞・春の鉄板激アツ情報を配信中! http://www.aveureka.org/ 新しい出会いと大金を儲けることが可能です http://see.jk98r.cn 家出少女が泊まるところを探して家出サイトに集まっています http://see.3rg3.cn カワイイあの子をエッチ診断してそのままHしちゃおう! http://see.gh384g.cn 女性のオナニーを見るだけで大金を得ることが出来てしまうのです http://see.fg83q4.cn 少しの時間だけでもいいのでお話しませんか?kyun—v0v-iine@docomo.ne.jp 容姿や年齢、経験は一切不問!期間限定恋人がほしい方はこのサイト! http://see.34yq34y.cn ゲーマーチェッカーであなたのゲーマー度数を測定しよう http://see.g3qgb.cn/ 癒してほしいセレブ達が集まる、セレブラブ http://see.gfh45.cn 家出娘のメッセージが多数書き込みされています http://see.he456j.cn HちぇっくでH度を測定しちゃおう http://see.jetnbg.cn 話題の逆円助サイトで女を抱いて報酬をもらおう http://see.3g3wj.cn 簡単に家出少女と会えちゃう掲示板 http://see.berbn45.cn あなたも不貞行為の刺激を試してみませんか http://see.j7kek.cn SM度をチェックして最高のパートナーをGETしよう http://see.5hw3.cn 簡単な登録制のバイトで好きな時に稼げます http://see.6j46j.cn 誰か割り切りでアタシを満足させてもらえませんか? c.dior_l-3-l_la.al@docomo.ne.jp チェッカーサイトで一番人気、Hチェッカー http://see.2qev2.cn 誰か割り切りでアタシを満足させてもらえませんか? c.dior_l-3-l_la.al@docomo.ne.jp 誰も試したことの無いような一人エッチで快楽を楽しもう http://see.34g46h.cn mixiでの楽しい思い出を再び感じたい方はコチラ http://mixi.050522o.net/ 毎日投稿ムービーが更新されている人気SNSはここ http://nice.k56hy.cn 誰か割り切りでアタシを満足させてもらえませんかlo3ol_jv.vj_favorite-cartier@docomo.ne.jp

 
smtp_auth/postfix_centos.txt · Last modified: 2009/05/22 04:23 (external edit)