You are currently viewing Postfix pam_mysql

Postfix pam_mysql

CentOS 7 install pam_mysql:

  1. 安裝相依套件並下載 pam_mysql

    yum install -y gcc unzip wget make autoconf automake libtool mariadb-devel pam-devel cyrus-sasl-md5 cyrus-sasl cyrus-sasl-lib cyrus-sasl-devel cyrus-sasl-plain
    git clone https://github.com/NigelCunningham/pam-MySQL.git
  2. 開始編譯

    cd ./pam-MySQL
    autoreconf -f -i
    ./configure --with-cyrus-sasl2 \
                        --with-openssl \
                        --with-pam=/usr \
                        --with-mysql=/usr \
                        --with-pam-mods-dir=/usr/lib64/security
    make && make install
  3. 編輯 /etc/security/pam_mysql.conf

    users.host=lbmysqledm.tigerfly.tw
    users.database=awoo_mail_service
    users.db_user=dml_pg_mail
    users.db_passwd=Av2KYn3BUfF9hXq8uAKL
    users.table=mail_sasl_user_detail
    users.user_column=USERNAME
    users.password_column=PASSWORD
    users.password_crypt=9
    verbose=0
    log.enabled=0
    log.table=mail_sasl_user_log
    log.message_column=MESSAGE
    log.pid_column=PID
    log.user_column=USER
    log.host_column=HOST
    log.rhost_column=RHOST
    log.time_column=TIME
  4. 編輯 /etc/pam.d/smtp

    #%PAM-1.0
    #auth       include     password-auth
    #account    include     password-auth
    account required pam_mysql.so config_file=/etc/security/pam_mysql.conf
    auth sufficient pam_mysql.so config_file=/etc/security/pam_mysql.conf
  5. 編輯 /etc/pam.d/smtp.postfix

    account required pam_mysql.so config_file=/etc/security/pam_mysql.conf
    auth sufficient pam_mysql.so config_file=/etc/security/pam_mysql.conf
  6. 資料庫 schema:

    -- MySQL dump 10.14  Distrib 5.5.68-MariaDB, for Linux (x86_64)
    --
    -- Host: lbmysqledm.tigerfly.tw    Database: awoo_mail_service
    -- ------------------------------------------------------
    -- Server version       5.7.25-google-log
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    /*!40103 SET TIME_ZONE='+00:00' */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
    
    --
    -- Table structure for table mail_dkim_user_detail
    --
    
    DROP TABLE IF EXISTS mail_dkim_user_detail;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_dkim_user_detail (
     id int(10) unsigned NOT NULL AUTO_INCREMENT,
     domain_name varchar(255) NOT NULL,
     selector varchar(63) NOT NULL,
     private_key text,
     public_key text,
     PRIMARY KEY (id),
     KEY domain_name (domain_name)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_detail
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_detail;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_detail (
     ID int(10) unsigned NOT NULL AUTO_INCREMENT,
     USERNAME varchar(128) NOT NULL DEFAULT '',
     PASSWORD varchar(255) NOT NULL DEFAULT '',
     FORWARD varchar(128) NOT NULL DEFAULT '',
     DOMAIN varchar(64) NOT NULL DEFAULT '',
     MAIL varchar(64) NOT NULL DEFAULT '',
     FILTER varchar(64) NOT NULL DEFAULT 'OK',
     PARTITION varchar(32) NOT NULL DEFAULT 'default',
     QUOTA int(11) NOT NULL DEFAULT '10485760',
     STATUS tinyint(4) NOT NULL DEFAULT '1',
     PRIMARY KEY (ID),
     UNIQUE KEY USERNAME (USERNAME),
     UNIQUE KEY MAIL (MAIL)
    ) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200422
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200422;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200422 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200503
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200503;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200503 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200510
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200510;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200510 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200517
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200517;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200517 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200524
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200524;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200524 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200531
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200531;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200531 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200607
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200607;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200607 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200614
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200614;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200614 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200621
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200621;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200621 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200628
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200628;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200628 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200705
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200705;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200705 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200712
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200712;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200712 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200719
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200719;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200719 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200726
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200726;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200726 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200802
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200802;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200802 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200809
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200809;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200809 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200816
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200816;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200816 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200823
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200823;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200823 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200830
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200830;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200830 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200906
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200906;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200906 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200913
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200913;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200913 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200920
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200920;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200920 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20200927
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20200927;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20200927 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20201004
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20201004;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20201004 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    
    --
    -- Table structure for table mail_sasl_user_log_20201011
    --
    
    DROP TABLE IF EXISTS mail_sasl_user_log_20201011;
    /*!40101 SET @saved_cs_client     = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE mail_sasl_user_log_20201011 (
     PID bigint(20) unsigned NOT NULL,
     USER varchar(255) NOT NULL,
     HOST varchar(16) NOT NULL,
     RHOST varchar(16) NOT NULL,
     MESSAGE varchar(100) NOT NULL,
     TIME datetime NOT NULL,
     KEY MESSAGE (MESSAGE),
     KEY TIME (TIME),
     KEY USER (USER),
     KEY HOST (HOST)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    /*!40101 SET character_set_client = @saved_cs_client */;
    /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
    
    /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
    /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
    
    -- Dump completed on 2020-11-19  4:03:29
  7. 在資料庫新增一筆紀錄:

    INSERT INTO mail_sasl_user_detail (USERNAME,PASSWORD,FORWARD,DOMAIN,MAIL) VALUES ('test456',hash('sha256', 456),'test','sample.awoo.org','[email protected]');
  8. 修改 /etc/sysconfig/saslauthd

    FLAGS="r"
  9. 重啟服務

    systemctl restart saslauthd
    systemctl enable saslauthd
  10. 測試是否可以正常驗證

    testsaslauthd -u test456 -p 456 -s smtp

Beck Yeh

熱愛學習於 Linux 與 程式設計 在網站中分享各式各樣學習到的新知識

發佈留言

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料