Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > 服务器相关 > Postfix: header/body_checks using MySQL
【标  题】:Postfix: header/body_checks using MySQL
【关键字】:Postfix,header/body_checks,using,MySQL
【来  源】:http://www.cublog.cn/u/11382/showart.php?id=68363

Postfix: header/body_checks using MySQL

Your Ad Here

Postfix: header/body_checks using MySQL (zt)


转载自某邮件列表,回复者比较透彻的说明了postfix中各种map方式的机制及使用方法

On 20 July 2000, Stephen Bolinger <pflist@pigglet.com> wrote:
> >> Is it possible to have all of my header/body checks in a mysql
> >> table? If it is, how is it called?
> >>
> >> header_checks = mysql:/etc/postfix/header_checks.mysql ???
> >>
> >> If I specify it like this, will it still interpret regular
> >> expression returned from the lookup? Or will it only match
> >> absolutely?
>
> >In order to subject header/body lines to regular expressions, specify
> >a map type that supports regular expressions.
> >
> > Wietse
>
> Does anyone know if mysql supports regular expressions? I have the
> line below working in an absolute matching fashion, but not as regexp:
> header_checks = mysql:/etc/postfix/header_checks.mysql
>
> This checks the database and searches the header for an exact literal
> match, so if I have "/^Subject: foo/" in the database it only matches
> if it finds "/^Subject: foo/" (rather than matching on "Subject:
> foo"). Anyone know how I can get the regular expression strings in
> the database to be interpreted as regexp?

    Write your SQL query so that it does a regexp match. Logically,
a map in Postfix is a sort of recipe that translates a given input
to a well-defined (that is, consistently reproducible) output. For
$header_checks, the input is a header line, and the output is one of
"OK", "REJECT", or "don't know". The translation process depends on
the _type_ of the map, but not on _where_ the result is used. A map of
type "hash" will lookup the input as a key in a hashed database, and
return the corresponding value, or "don't know" if not found. A map of
type "regexp" or "pcre" will match the input against each regexps in a
given file, and return the corresponding rhs if a match is found, or a
"don't know" otherwise. A "mysql" map builds a query from the SELECT
you supply and the input, and returns whatever the database returns in
response to the query. It doesn't matter whether the map is used in a
$header_checks, in a $canonical_maps, in a transport table, or somewhere
else; the result of the lookup only depends on the type of the map. The
magic of doing regexp matches if $header_checks is of type "regexp" or
"pcre" is contained in the type of the map; if you change the type,
you lose the magic. Now, in the case of "mysql" maps you can still
get it back because MySQL can do regexp matches in queries: just write
your SELECT with a regexp match clause. Postfix won't do it for you
automatically.

    That said, I'm not sure using a "mysql" map for $header_checks
is a good idea: a query will be issued for each header line, and the
resulting performance would be less than stellar. Why on Earth do you
want to do that anyway?

    Regards,

    Liviu Daia

一個很不錯的反spam軟件:【上一篇】
Postfix: header/body checks using MySQL:【下一篇】
【相关文章】
  • postfix+mysql+apache+cyrus-sasl2+courier-imap安装
  • 续postfix+mysql,添加病毒和垃圾邮件扫描功能,Clamav+SpamAssassin
  • 简易安装postfix邮件服务器
  • 在Linux平台上安装基于Postfix、Courier-imap、Extmail的邮件系统
  • postfix最完整文档(轉)
  • sarge+postfix+mysql+webmail+web admin安装配置指南
  • 决定用开始研究邮件系统,使用postfix
  • 在RHEL 4 上配置全功能的Postfix 服务器
  • Postfix Integrated Solution OpenLDAP
  • Postfix中需要注意的几个规则(发信者的身份验证)
  • 【随机文章】
  • 近10年最强的50本计算机图书,您读过几本?
  • 测试驱动开发指南
  • 设置不同主机之间互相信任登录
  • JavaScript操作Table,DataGrid(2)
  • 使用tr命令发现的一个有趣的现象
  • Illustrator 图表工具详解(7)
  • 星型结构构建千兆主干校园网
  • 【转载】SQL Server中索引使用及维护
  • vector::capacity
  • IT架构和应用程序的端到端测试
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.