shitou's blog 
Home About Feed | MIX BOY 塌客

Tags "postfix"

02
Nov

postfix一个帐户接收多个域的邮件 by shitou

0

邮件服务器需要一个帐户接收两个域的邮件, 在网上查了很多资料都不行,google了很长时间,才找到一点线索, 终于搞定了, 步骤就是:

 

首先你的postfix要支持regexp的查询表, 通过postconf -m, 可以看出是否支持, 就是正则表达式了(pcre),

这里举例发到xxx@abc.com.cn的邮件xxx@abc.com的域也可以收到

1. 添加虚拟域abc.com.cn

2. 建立文件/etc/postfix/reg_virtual.cf文件, 内容:

/(.*)@abc\.com\.cn/   $(1)@abc.com

3. 执行postmap /etc/postfix/reg_virtual.cf

4. 修改/etc/postfix/main.cf中的virtual_alias_maps为

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf regexp:/etc/postfix/reg_virtual.cf

(上面假设你已经有了mysql查询表, 上面没有换行, regexp前有空格)

5. 重启postfix

 

这样就OK了

 

参考文档

Using sympa_virtual with Postfix instead of regexp aliases

REGEXP_TABLE(5)   REGEXP_TABLE(5)
Postfix Pipe
Postfix Filter
Defending E-mail HOWTO


 

Tags: postfix

2008-11-02 22:20:56, 445 reviews

send to mailbox

Your email:

16
Oct

debian中架设postfix全功能邮件服务器 by shitou

3

刚到公司就开始忙了,本来应聘的是开发的职位,没想到来了就要先架设邮件服务器,而且平台一定要是debian, debian以前没用过, 以前做的所有服务都是RHEL/CentOS的, 包括邮件服务器, 不过都是类unix的系统,也没什么好怕的, 加上以前做过几次邮件服务器,所以就开动了,

 

之前用过Ubuntu, Ubuntu就是基于Debian的, 所以还好不是非常陌生, 感觉Debian和RHEL/CentOS最大的区别就是包管理了, 不再是rpm, 而是deb了,对应的管理工具就是dpkg, 不过早就听说Debian上的apt比RHEL/CentOS(5.0后)上的apt好用, 查了一些资料试了下,感觉Debian的包管理真的是非常方便,用着舒坦:), 没有特殊需求的话几乎可以完全抛开configure, 全部使用apt-get来安装, 依赖问题也没有那么痛苦了。

 

用了Debian才发现为什么总是说RedHat是给新手用的, 的确有一定的道理,Debian系统安装上后(通过netinst光盘安装),系统是干干净净的,所有的都需要自己定制,最细微的一个地方就是shell的别名, 在RHEL/CentOS中~/.bashrc文件里默认已添加了几个alias方便系统管理用,而Debian中要手动去uncomment才行,

 

花了一天多的功夫,照着自己以前的文档,终于把postfix搞定了,集成了postfix+pcre+mysql+postfixadmin+squirrelmail+courier-imap+courier-authlib+cyrussasl,

支持虚拟域,虚拟用户,SMTPD,IMAP等。

这次偷了个懒没有加入anti-spam, anti-virus的功能,之前都有做的, 以后再加吧,

详细的文档等有时间了再放上来

 

Tags: postfix

2008-10-16 16:13:11, 751 reviews

send to mailbox

Your email:

21
Sep

postfix中控制发送外部,内部邮件的方法 by shitou

0

有些时候在postfix中需要控制某个用户只能发内部邮件(只能发给本域用户的邮件)

可以使用postfix 的 RESTRICTION CLASS 来解决

下面简单描述下RESTRICTION CLASS 的原理,明白这个原理就可以解决控制某个用户只能发内部邮件的问题


我们可以使用check_xxxx_access来进行一些控制,例如接受任何来自1.1.1.1的邮件,设置如下:
smtpd_recipient_restrictions = check_client_access regexp:/etc/postfix/client_access.txt

在/etc/postfix/client_access.txt
加入以下内容:
/1\.1\.1\.1/   OK


但是check_xxx_access的执行方式比较单一:如果符合某个“单一条件”,则执行某个动作

很多时候,我们需要符合“两个”或者多个条件才执行某个动作,
例如:拒接来自1.1.1.1的并且发送人地址为[email]a@a.com[/email]的邮件;
但是接受来自1.1.1.1,发送人地址为"非[email]a@a.com[/email]"的邮件

此时我们单一使用check_sender_access或者check_client_access都无法实现这个要求
需要结合这2个才行,此时就需要RESTRICTION CLASS

首先定义一个RESTRICTION CLASS :

smtpd_restriction_classes = myrestriction
myrestriction = check_sender_access regexp:/etc/postfix/sender_access.txt

在/etc/postfix/sender_access.txt文件加入以下内容:
/a\@a.com/   REJECT YOU ARE BLOCKED


再定义:
smtpd_recipient_restrictions = check_client_access regexp:/etc/postfix/client_access.txt
然后在/etc/postfix/client_access.txt加入:
/1\.1\.1\.1/   myrestriction

最后reload postfix则可以生效

 

转载 http://postfix.cn99.com/RESTRICTION_CLASS_README.html

Tags: postfix

2008-09-21 20:10:07, 444 reviews

send to mailbox

Your email:

Tags

U-ka saegusa IN db command Mai Kuraki Norah Jones log iPhoneException ACG Mac Safari objective-c CouchDB LVS AJAX debian 推荐 AMQP google mail bug gettext Erlang 北京 iptables 架构 tips mysql backup function 我看 postfix 监控 SEO cache Etag memcache thread 进程 线程 无锡 yield file column mixboy xml rss gems ruby shitou shell lighttpd 安全 csrf 公司 nginx linux 模块 apache webserver 朋友 大学 生活 尼古拉斯凯奇 movie 文件同步 笑笑 歌词 auto complete plugin rails music ubuntu blog

Category

  • iPhone[17]
  • Erlang[4]
  • google[8]
  • 生活[38]
  • 音乐[11]
  • 电影[11]
  • linux[20]
  • web server[6]
  • mail server[3]
  • cluster[1]
  • system manage[5]
  • ruby[18]
  • ruby on rails[27]
  • 开源[3]

Episode

  • iPhoneException
  • shell
  • thread
  • memcache

Recent Comments

  • comment6, viagra bez receptu, revelation, ambie...
  • comment5, http://www.freecodesource.com/user/pr...
  • comment4, meridia medicine, :-<>], plavix clopi...
  • comment2, viagra calgary, resin, paxil vs wellb...
  • comment2, codeine promethazine, conclusion, buy...
  • comment2, clomid ovarian cysts, fronted, oxycod...
  • comment2, http://www.freecodesource.com/user/pr...
  • comment3, cipro allergy, :-E, weed and hydrocod...
  • comment2, http://www.freecodesource.com/user/pr...
  • comment4, vicodin cr, chocolate, premarin cance...

Popular Posts

  • MySQL Innodb备份
  • 准备开始学习Erlang了(恶狼, 二郎..)
  • Lighttpd配置参数
  • iPhone上的HelloWorld终于跑起来了
  • Etag和Expire

Recommended Posts

  • Mai Kuraki -永远より ながく
  • U-ka saegusa IN db Final Best
  • Heaven Can Wait - Charlotte Gainsbou
  • Ruby遍历MemCached的key
  • Norah Jones - The fall
  • 请记得仰望梦想的姿势
  • Shell: 统计MySQL InnoDB表的大小
  • Rails Benchmark
  • 发送异常到邮箱
  • I Miss Nobody
  • Music4u, Vol. 1
  • my macbook
  • Mai Kuraki-Beautiful
  • 10首最伤情英文歌曲精选
  • Mai Kuraki - PUZZLE/Revive

Friends' blogs

  • levy
  • sphance
  • andreas

Login

   注册

留言 查看留言

留言

   取消

留言 查看留言


Statistics

  • 访问次数: 51144
  • 今天访问: 8
  • 日志: 172
  • 评论: 124
  • 音乐: 9
  • 用户: 148


 

just DO NOT support IE

close