Skip to content

smtpd imap4d pop3d

Debian GNU/Linux 6.0.4(Squeeze) メール関係

  1. postfixのインストールと設定
  2. $ sudo aptitude install postfix
    $ sudo /etc/init.d/postfix stop


    smtpd_tls_loglevel = 1

    を# TLS parametersのセクションに

    home_mailbox = Maildir/ 


    $ sudo aptitude install sasl2-bin
    $ sudo /usr/sbin/dpkg-statoverride --add root sasl 710 /var/spool/postfix/var/run/saslauthd
    $ sudo /usr/sbin/adduser postfix sasl


    OPTIONS="-c -m /var/run/saslauthd"


    OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"


    smtps     inet  n       -       -       -       -       smtpd
      -o smtpd_tls_wrappermode=yes
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_client_restrictions=permit_sasl_authenticated,reject


      -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination


    $ sudo vi /etc/postfix/sasl/smtpd.conf
    pwcheck_method: saslauthd
    mech_list: plain login
  3. dovecotのインストールと設定
  4. $ sudo aptitude install dovecot-imapd dovecot-pop3d


    # Disable LOGIN command and all other plaintext authentications unless
    # SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
    # matches the local IP (ie. you're connecting from the same computer), the
    # connection is considered secure and plaintext authentication is allowed.
    disable_plaintext_auth = no
    # SSL/TLS support: yes, no, required. 
    ssl = yes
    # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
    # dropping root privileges, so keep the key file unreadable by anyone but
    # root.
    ssl_cert_file = /etc/ssl/certs/dovecot.pem
    ssl_key_file = /etc/ssl/private/dovecot.pem
    ## Mailbox locations and namespaces
    mail_location = maildir:~/Maildir


    $ maildirmake.dovecot /home/hoge/Maildir
  5. ウィルス対策
  6. ClamAVを利用する

    $ sudo aptitude install clamav
    $ sudo freshclam


    $ sudo clamscan --infected --remove --recursive /home
    ----------- SCAN SUMMARY -----------
    Known viruses: 1184339
    Engine version: 0.97.3
    Scanned directories: 13
    Scanned files: 26
    Infected files: 0
    Data scanned: 0.00 MB
    Data read: 0.01 MB (ratio 0.00:1)
    Time: 2.345 sec (0 m 2 s)
  7. clamAVのpostfixへの組込とspamassassinの導入
  8. $ sudo aptitude install clamav-daemon amavisd-new spamassassin


    # Change to one to enable spamd


    $ sudo cp /usr/share/doc/amavisd-new/examples/amavisd.conf-sample.gz /etc/amavis/
    $ sudo gunzip /etc/amavis/amavisd.conf-sample.gz
    $ sudo mv /etc/amavis/amavisd.conf-sample /etc/amavis/amavisd.conf


    # $MYHOME serves as a quick default for some other configuration settings.
    # More refined control is available with each individual setting further down.
    # $MYHOME is not used directly by the program. No trailing slash!
    $MYHOME = '/var/lib/amavis';   # (default is '/var/amavis'), -H
    # $mydomain serves as a quick default for some other configuration settings.
    # More refined control is available with each individual setting further down.
    # $mydomain is never used directly by the program.
    $mydomain = '';      # (no useful default)
    $myhostname = '';  # fqdn of this host, default by uname(3)
     Set the user and group to which the daemon will change if started as root
    # (otherwise just keeps the UID unchanged, and these settings have no effect):
    $daemon_user  = 'amavis';   # (no default;  customary: vscan or amavis), -u
    $daemon_group = 'amavis';   # (no default;  customary: vscan or amavis), -g


    # ###
       \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
       qr/\bOK$/m, qr/\bFOUND$/m,
       qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],


    @bypass_virus_checks_maps = (
       \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
    @bypass_spam_checks_maps = (
       \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);




    #Setting for AMaViS
    smtp-amavis unix -       -       n      -     2 smtp
          -o smtp_data_done_timeout=1200
          -o smtp_send_xforward_command=yes
          -o disable_dns_lookups=yes inet n     -     n     -     - smtpd
          -o content_filter=
          -o local_recipient_maps=
          -o relay_recipient_maps=
          -o smtpd_restriction_classes=
          -o smtpd_client_restrictions=
          -o smtpd_helo_restrictions=
          -o smtpd_sender_restrictions=
          -o smtpd_recipient_restrictions=permit_mynetworks,reject
          -o mynetworks=
          -o strict_rfc821_envelopes=yes
          -o smtpd_error_sleep_time=0
          -o smtpd_soft_error_limit=1001
          -o smtpd_hard_error_limit=1000
    $ sudo touch /etc/mailname
    $ sudo chmod -R 755 /var/lib/amavis/tmp
    $ sudo usermod -G amavis clamav


    $ sudo /etc/init.d/clamav-daemon restart
    $ sudo /etc/init.d/spamassassin start
    $ sudo /etc/init.d/postfix start
    $ sudo /etc/init.d/amavis restart
No comments yet


以下に詳細を記入するか、アイコンをクリックしてログインしてください。 ロゴ アカウントを使ってコメントしています。 ログアウト /  変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト /  変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト /  変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト /  変更 )


%s と連携中