分享
 
 
 

在FreeBSD上建立一个功能完整的邮件服务器

王朝system·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

第一部分:安装邮件服务器:postfix+vm-pop3d+openwebmail

以下的安装在FreeBSD 5.2.1系统上完成

1.更新 ports

# cvsup -gL 2 -h cvs

p/ports-supfile

up.freebsdchina.org /usr/sha

re/examples/cvsu

2. 安装 openssl+apache 服务器

# cd /usr/ports/security/openssl

# make install

# make clean

# cd /usr/ports/www/apache2

# make install

# make clean

# vi /etc/rc.conf

apache2_enable="YES"

3. 安装 openwebmail

# cd /usr/ports/mail/openwebmail/

# make WITH_QUOTA=yes install

# make clean

4. 安装 postfix ,在安装过程中用yes回答提出的问题

# cd /usr/ports/mail/postfix/

# make install

# make clean

# vi /etc/rc.conf

为了能启动postfix加入:

sendmail_enable="YES"

sendmail_flags="-bd"

sendmail_pidfile="/v

ar/spool/postfix/pid/master.

pid"

sendmail_outbound_enable="NO"

sendmail_submit_enable="NO"

5. 安装 vm-pop3d

# cd /usr/ports/mail/vm-pop3d

# make install

# make clean

6. 配置 postfix

# vi /usr/local/etc/postfix/main.cf

添加:

virtual_alias_maps=h

ash:/usr/local/etc/postfix/v

irtual

alias_maps=hash:/usr/local/etc/p

ostfix/aliases

default_privs=nobody

allow_mail_to_commands = alias,f

orward,include

allow_mail_to_files

= alias,forward,include

下面我加入一个 nero.3322.org 的

虚拟域,并添加一个用户llzqq

# vi /usr/local/etc/postfix/virtual

添加:

nero.3322.org anything //之间用[tab]

llzqq@nero.3322.org

llzqq.nero.3322.org //之间用

[tab]

执行下面的命令,生成 virtual.db:

# cd /usr/local/etc/postfix/

# postmap virtual

# vi /usr/local/etc/postfix/aliases

添加:

llzqq.nero.3322.org:

/var/spool/virtual/nero.3322

.org/llzqq

执行下面的命令,生成 aliases.db:

# cd /usr/local/etc/postfix

# postalias aliases

7. 配置 vm-pop3d 使其开机自动执行

# cd /usr/local/etc/rc.d

# mv vm-pop3d.sh.sample vm-pop3d.sh

配置 openwebmail 支

持 nero.3322.org 域,创建下

面的文件:

# vi /usr/local/www/cgi-bin/open

webmail/etc/sites.conf/nero.3322.org

=========================== nero

.3322.org =======================

auth_module auth_vdomain.pl

auth_withdomain yes

mailspooldir /var/sp

ool/virtual/nero.3322.org

use_syshomedir no

use_homedirspools no

enable_autoreply no

enable_setforward no

enable_vdomain yes

vdomain_admlist llzqq //这里设置了这个域的管理员

vdomain_maxuser 500

vdomain_vmpop3_pwdpa

th /usr/local/etc/virtual

vdomain_vmpop3_pwdname passwd

vdomain_vmpop3_mailpath /var/spo

ol/virtual

vdomain_postfix_alia

ses /usr/local/etc/postfix/a

liases

vdomain_postfix_virt

ual /usr/local/etc/postfix/v

irtual

vdomain_postfix_postalias /usr/l

ocal/sbin/postalias

vdomain_postfix_post

map /usr/local/sbin/postmap

# quota设置部分

quota_module quota_du.pl

quota_limit 52400 //定义了邮箱大小

quota_threshold 85

delmail_ifquotahit no

delfile_ifquotahit no

=========================== nero

.3322.org =======================

# mkdir -p /var/spoo

l/virtual/nero.3322.org

# chown nobody /var/

spool/virtual/nero.3322.org

# chgrp mail /var/spool/virtual/

nero.3322.org

# mkdir -p /usr/loca

l/etc/virtual/nero.3322.org

# touch /usr/local/etc/virtual/n

ero.3322.org/passwd

# chmod 644 /usr/local/etc/virtu

al/nero.3322.org/passwd

# htpasswd /usr/loca

l/etc/virtual/nero.3322.org/

passwd llzqq

# chmod 755 /usr/loc

al/www/cgi-bin/openwebmail/e

tc/users

# sync

# reboot

8. 最后通过浏览器登陆到OPENWEBMAIL

http://nero.3322.org/cgi-bin/ope

nwebmail/openwebmail.pl

第二部分:防病毒、垃圾邮件:clamav+amavisd-new+spam

1.0 安装clamav:

# cd /usr/ports/security/clamav

# make install

# make clean

# vi /usr/local/etc/clamav.conf

===============================c

lamav.conf============================

# Comment or remove the line below.

# Example

LogFile /var/log/clamav/clamd.log

LogFileMaxSize 1M

LogTime

LogVerbose

PidFile /var/run/clamav/clamd.pid

DataDirectory /usr/local/share/clamav

LocalSocket /tmp/clamd

StreamMaxLength 10M

MaxThreads 10

MaxDirectoryRecursion 15

User clamav

ScanMail

ScanArchive

ScanRAR

ArchiveMaxFileSize 10M

ArchiveMaxRecursion 5

ArchiveMaxFiles 1000

ClamukoScanOnOpen

ClamukoScanOnClose

ClamukoScanOnExec

ClamukoIncludePath /var/spool/virtual

ClamukoMaxFileSize 6M

ClamukoScanArchive

====================

===========clamav.conf======

======================

1.1 更新病毒库

# /usr/local/etc/rc.

d/clamav-freshclam.sh start

2.0 安装amavisd-new

# cd /usr/ports/security/amavisd-new

# make install

# make clean

# cd /usr/local/etc

# mv amavisd.conf-dist amavisd.conf

# vi amavisd.conf

====================

========== amavisd.conf ====

===========================

$MYHOME = '/var/amav

is'; # (default is '/var/ama

vis')

$mydomain = 'nero.33

22.org'; # (no useful defaul

t)

$daemon_user = 'vscan'; # (no de

fault; customary: vscan or amavis)

$daemon_group = 'vsc

an'; # (no default; customar

y: vscan or amavis)

$log_level = 0;

$sa_spam_subject_tag = '***SPAM***'

$virus_admin = "root\@$mydomain";

$spam_admin = "llzqq\@$mydomain";

$mailfrom_notify_adm

in = "llzqq\@$mydomain";

$mailfrom_notify_recip = "llzqq @$mydomain";

$mailfrom_notify_spa

madmin = "llzqq\@$mydomain";

$inet_socket_bind = '127.0.0.1';

$forward_method = 'smtp:127.0.0.

1:10025';

$notify_method = $forward_method;

$inet_socket_port = 10024;

$max_servers = 2;

['Clam Antivirus-clamd',

\&ask_daemon, ["CONT

SCAN {}\n", '/tmp/clamd'],

qr/\bOK$/, qr/\bFOUND$/,

qr/^.*?: (?!Infected

Archive)(.*) FOUND$/ ],

============================== a

mavisd.conf ===============================

2.1 要启动clamav和am

avisd-new需要配置一下/etc/rc

.conf

# vi /etc/rc.conf

spamd_enable="YES"

amavisd_enable="YES

clamav_clamd_enable="YES"

3.0 由于在安装amavisd-new时spama

ssassin被一起安装了下面对其进行配置

3.1 建立过滤规则:

# cd /usr/local/etc/mail/spamassassin

# env LANG=C vi local.cf

===============================

local.cf ===============================

# SpamAssassin confi

g file for version x.xx

# generated by http://www.yrex.c

om/spam/spamconfig.php (version 1.01)

# How many hits before a message

is considered spam.

required_hits 4.0

# Whether to change the subject

of suspected spam

rewrite_subject 1

# Text to prepend to subject if

rewrite_subject is used

subject_tag *****SPAM*****

# Encapsulate spam in an attachment

report_safe 1

# Use terse version of the spam report

use_terse_report 0

# Enable the Bayes system

use_bayes 1

# Enable Bayes auto-learning

auto_learn 1

# Enable or disable network checks

skip_rbl_checks 1

use_razor2 0

use_dcc 0

use_pyzor 0

# Mail using languages used in t

hese country codes will not be marked

# as being possibly

spam in a foreign language.

# - chinese english

ok_languages zh en

# Mail using locales

used in these country codes

will not be marked

# as being possibly spam in a fo

reign language.

ok_locales en zh

score SUBJ_FULL_OF_8BITS 2

score NO_REAL_NAME 4.0

===============================

local.cf ===============================

3.2 下载新的垃圾邮件地址列表文件

# cd /usr/local/share/spamassassin

# fetch http://anti-spam.org.cn/

rules/sa/55_diy_score.cf

4.0 对POSFIX进行配置,在他的配置文件中添加下面的一些内容

# vi /usr/local/etc/postfix/master.cf

---------------------- master.cf

---------------------

smtp-amavis unix - - n - 2 smtp

-o smtp_data_done_timeout=1200

-o disable_dns_lookups=yes

127.0.0.1:10025 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 mynetworks=127.0.0.0/8

--------------------

-- master.cf ---------------

------

# vi /usr/local/etc/postfix/main.cf

content_filter = smtp-amavis:[12

7.0.0.1]:10024

现在一个基于FreeBSD的功能相对完

登陆OPENWEBMAIL进行用户的添加、删除

密码。

整的邮件服务器就建立起来了,虚拟域的管理员可以

等操作,虚拟用户可以通过OPENWEBMAIL修改自己的

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有