ldap匿名访问用户访问proftp怎么抓包

dayong_guo 的BLOG
用户名:dayong_guo
文章数:27
评论数:40
访问量:47215
注册日期:
阅读量:5863
阅读量:12276
阅读量:341085
阅读量:1042844
51CTO推荐博文
& &运维界--开源集中统一账号管理平台 - OpenLDAP实战指南,感谢大家的支持和帮助,本书才能得以顺利出版,并将此书献给热爱开源技术的伙伴们。& & & &本书通过基础篇、高级篇、实战篇循序渐进介绍OpenLDAP的点点滴滴,如果你想了解 LDAP 协议并尝试理解其在用户认证管理方面的优秀表现,或者想深入学习
LDAP 及其实现,那么本书您值得拥有。《OpenLDAP实战指南样书》&OpenLDAP实战指南上市发售:人民邮电异步社区:当当购书地址:京东购书地址:亚马逊购书地址:& & & &同时感谢51cto学院高级运营经理孙琪、马永亮(马哥)、余洪春(抚琴煮酒)、李晨光、高俊峰(南非蚂蚁)、老男孩在百
忙之中阅读本书草稿,并为本书撰写推荐语。OpenLDAP实战指南读者交流群:QQ群:
微信公众号:OpenLDAP_China本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)ProFTP + LDAP + SSL (LDAPServer 1.2.3.4:636)
Subject: ProFTP + LDAP + SSL (LDAPServer 1.2.3.4:636)
Date: Tue, 3 Jun :53 +0200
I do not know if this is the place to ask but maybe some of you have already
had this configuration.
I have a problem configuring ProFTP
to use LDAP over SSL (i.e. ldaps on port 636).
ProFTP without TLS (TLSEngine off) DOES
authenticate with LDAP without SSL (LDAPServer 1.2.3.4:389) &
ProFTP with TLS (TLSEngine on, path
to the ftp-ssl certificates) DOES
authenticate with LDAP without SSL (LDAPServer 1.2.3.4:389) &
ProFTP with TLS (TLSEngine on, path
to the ftp-ssl certificates) DOES
NOT authenticate with LDAP with SSL
(LDAPUseTLS LDAPServer 1.2.3.4:636) &
The procedure is &a 2 way SSL with
2 certificates:
filezilla (for example) (acting as client for ProFTP) -&SSL(cert_ftp)-&
ProFTP (acting as server for filezilla, cert_ftp)
ProFTP (acting as client for LDAP) -&SSL(cert_LDAP)-& LDAP (acting
as server for the ProFTP, cert_LDAP).
If I look in the logs I see that the ProFTP Server connects to the LDAP
server on the correct port, the LDAP server accepts the connection but
the TLS fails!
In principle for me it is obvious because in the ProFTP configuration I
do give the path to the FTP-SSL certificates and keys but I do not input
any path for the LDAP-SSL certificates i.e. in my opinion it can not work
like this.
So my question is how to make it work? As I have said in my opinion the
key point is to be able to set the path where the ProFTP server finds the
certificates for the LDAP server.
I do not find any hint whatsoever in the net.
The steps I have done:
LDAP Server:
The LDAP Server IP (say) 1.2.3.4
The LDAP Server listens to port 636
(ldaps) and port (ldap).
I have created a certificate for the
LDAP server (slapd.pem, slapd.key)
The LDAP server itself is fully functioning
on both ldap and ldaps (for example ldaps with apache ok)
ProFTP Server:
The ProFTP Server IP (say) 5.6.7.8
I have created a certificate for the
ProFTP server (ftp2.pem, ftp2.key)
I have copied locally the certificates
of the LDAP server (slapd.pem)
This is exactly what you do with apache
(and it works) provided one gives the path for &both& certificates
LDAPTrustedGlobalCert CA_BASE64 /apache/conf/ssl_certs/slapd.pem
SSLCertificateFile /apache/conf/ssl_certs/apache.pem
SSLCertificateKeyFile /apache/conf/ssl_certs/apache.key
This is the ProFTP configuration
(mod_tls and mod_ldap parts)
&IfModule mod_tls.c&
TLSEngine & & & & & & & & &
TLSLog & & & & & & & & & &
& & &/ftp2/logs/tls.log
TLSProtocol & & & & & & & & &
TLSOptions & & & & & & & & &
& &NoCertRequest
TLSRSACertificateFile & & & & & /ftp2/conf/ssl_certs/ftp2.pem
TLSRSACertificateKeyFile & & & &/ftp2/conf/ssl_certs/ftp2.key
TLSCACertificateFile & & & & & &/ftp2/conf/ssl_certs/ftp2.pem
TLSVerifyClient & & & & & & & &
TLSRequired & & & & & & & & &
TLSRenegotiate & & & & & & & &
&required off
&/IfModule&
&IfModule mod_ldap.c&
#LDAPServer & &1.2.3.4:389
LDAPUseTLS &on
LDAPServer & &1.2.3.4:636
LDAPDoAuth & & on &ou=bbb,dc=aaa,dc=de& &(&(uid=%v)(objectclass=posixAccount))&
LDAPDNInfo &uid=1234,dc=aaa,dc=de& root
LDAPAuthBinds & & on
LDAPDoUIDLookups & on &ou=bbb,dc=aaa,dc=de&
LDAPSearchScope subtree
&/IfModule&
Both LDAP server and ProFTP (proftp-ldap)
server are:
Linux version 2.6.18-6-amd64 (Debian 2.6.18.dfsg.1-18etch1)
(waldi@debian.org) (gcc version 4.1.2
(prerelease) (Debian 4.1.1-21))
#1 SMP Sun Feb 10 17:50:19 UTC 2008
OpenLDAP server (slapd)
dpkg -l | grep slapd
ii &slapd & & & & & & & &
& & & & & &2.3.30-5+etch1
I have used the ProFTP with precompiled
LDAP (proftp-ldap)
dpkg -l | grep proftp
ii &proftpd & & & & & & & &
& & & & & 1.3.0-19 & & & &
& & & & & & & & & & Versatile,
virtual-hosting FTP daemon
ii &proftpd-ldap & & & & & & &
& & & &1.3.0-19 & & & & &
& & & & & & & & & Versatile,
virtual-hosting FTP daemon
Error in /var/log/syslog from slapd
May 27 10:54:05 ftp1test slapd[7323]: daemon: activity
on 1 descriptor
May 27 10:54:05 ftp1test slapd[7323]: daemon: listen=9, new connection
May 27 10:54:05 ftp1test slapd[7323]: daemon: added 19r (active) listener=(nil)
May 27 10:54:05 ftp1test slapd[7323]: conn=106 fd=19 ACCEPT from IP=5.6.7.8:42564
(IP=0.0.0.0:636)
May 27 10:54:05 ftp1test slapd[7323]: daemon: select: listen=6 active_threads=0
May 27 10:54:05 ftp1test slapd[7323]: daemon: select: listen=7 active_threads=0
May 27 10:54:05 ftp1test slapd[7323]: daemon: select: listen=8 active_threads=0
May 27 10:54:05 ftp1test slapd[7323]: daemon: select: listen=9 active_threads=0
May 27 10:54:05 ftp1test slapd[7323]: daemon: activity on 1 descriptor
May 27 10:54:05 ftp1test slapd[7323]: daemon: activity on:
May 27 10:54:05 ftp1test slapd[7323]: &19r
May 27 10:54:05 ftp1test slapd[7323]:
May 27 10:54:05 ftp1test slapd[7323]: daemon: read activity on 19
May 27 10:54:05 ftp1test slapd[7323]: daemon: removing 19
May 27 10:54:05 ftp1test slapd[7323]: conn=106 fd=19 closed (TLS negotiation
Please Help
Prev by Date:
Next by Date:
Index(es):[精华] 理解与应用LDAP服务器 - ChinaUnix.net
[精华] 理解与应用LDAP服务器
http://www.chinaunix.net 作者:&&发表于: 19:41:06
(前段时间一直在做LDAP+POSTFIX相关项目,先把关于LDAP的一些经验写出来,一来可能会帮助一些人,二来对我自己所学知识也是一个巩固。)
先声明:我写的只是我对LDAP的一些理解,如果我的理解错误,那就是对兄弟们的误导。所以你可以直接看文章的结尾提供的几个网址。
关于LDAP的概念随便网上有很多,我不想重复,这里只是说一下我自己的理解。
都说它是“轻量级目录协议”,太专业,我不懂,我只把它想象成“简单”的目录协议。
几个很重要的概念,以后会用到:
---------------------------------------------
dn&:一条记录的位置
dc&:一条记录所属区域
ou&:一条记录所属组织
cn/uid:一条记录的名字/ID
---------------------------------------------
实际上更多时候我只把它看成数据库。我把它和我非常熟悉的MYSQL数据库做比较,通常会得到更好的理解:
MYSQL用“表”储存数据,LDAP用“树”
MYSQL指定一条记录要3个条件:DB、TABLE、ROW。
LDAP却更自由,为什么呢?因为LDAP数据是“树”状的,而且这棵树是可以无限延伸的,假设你要树上的一个苹果(一条记录),你怎么告诉园丁它的位置呢?当然首先要说明是哪一棵树(dc,相当于MYSQL的DB),然后是从树根到那个苹果所经过的所有“分叉”(ou,呵呵MYSQL里面好象没有这DD),最后就是这个苹果的名字(uid,记得我们设计MYSQL或其它数据库表时,通常为了方便管理而加上一个‘id’字段吗?)。&好了!这时我们可以清晰的指明这个苹果的位置了,就是那棵“歪脖树”的东边那个分叉上的靠西边那个分叉的再靠北边的分叉上的半红半绿的……,晕了!你直接爬上去吧!我还是说说LDAP里要怎么定义一个字段的位置吧,树(dc=waibo,dc=com),分叉(ou=bei,ou=xi,ou=dong),苹果(cn=honglv),好了!位置出来了:
dn:cn=honglv,ou=bei,ou=xi,ou=dong,dc=waibo,dc=com
一个有名的画家说过:“世上没有相同的2个鸡蛋”。当然也没有相同的2个苹果……,同样,在LDAP里也不可能存在2个相同的dn。
LDAP数据填充原理:
一棵树的生长,要循序渐进,如果还没有长出某个分叉,就不可能在那个分叉里长出苹果(问:FT!苹果是长在分叉上的吗?答:为了便于理解,你就当它是吧),同样,LDAP数据库也要一步步的充实,举一个学校数据库的例子,我们将要把一个庞大的学生档案放到LDAP里,大致需要这么做:
---------------------------------------------
1、建立“树根”,这是通过修改“slapd.conf”来实现的,由于现在的目的是理解,所以具体步骤就不说了,反正就是在这一步建立了一个“dc=ourschool,dc=org”这样一个“树根”。&注意:我把它理解成“目录”,或者“容器”,甚至它本身也是文件(苹果)的特殊形式,熟悉LINUX文件系统的朋友会更容易理解。
2、建立18个系,分别是“dn:ou=computer,dc=ourschool,dc=org”、“dn:ou=film,dc=ourschool,dc=org”……
3、当然是在每个系里面建立专业,比如“dn:ou=linux,ou=computer,dc=ourschool,dc=org”……
4、(开始长苹果吧!)加学生喽——“dn:cn=stan,ou=linux,ou=computer,dc=ourschool,dc=org”……
5、已经完成了吗?对了!学生的详细信息还没有呐!不过先这样吧,反正记录是可以编辑的。
---------------------------------------------
LDAP记录的详细信息
dn:cn=stan,ou=linux,ou=computer,dc=ourschool,dc=org
objectClass:organizationalPerson
cn:stan
cn:小刀
sn:小刀
description:a&good&boy
(以上是一条记录的信息,如果把他保存成LDIF文件,可以导入到LDAP数据库中)
上面不是说没有学生详细信息吗?怕你着急,就马上写出来了,只是还没有导入到LDAP里,那是以后的事。这里我先就你可能会产生的疑问做回答。
---------------------------------------------
Q1:“cn”不是在“dn”里定义了吗,怎么又在后面重新定义了?&答:你要把“cn=stan,ou=linux,ou=computer,dc=ourschool,dc=org”看成是一个整体,它只是属性dn的值。
Q2:怎么后面有2个“cn”,我以哪个为准?&答:区别于普通数据库,LDAP每个属性一般可以具有多个值,这样不好吗?你在学校数据库里找我的时候,只要记得我的一个cn就可以了,用“cn=stan”或“cn=小刀”都可以找到我!
Q3:就这些属性了吗?我都不知道你是男是女。&答:先声明,偶是男地。&LDAP对记录的属性做了严格的限制(这一点我不太喜欢),也就是说,你可以用哪些属性,哪些属性不能为空,哪些属性最多只能有一个值等,他们都给你规定好了。&幸好你有选择的权利,比如这次我们是储存学生信息,那么我们就定义一个“objectClass:organizationalPerson”,这样“organizationalPerson”这个类所规定的所有属性我们都可以用了,而且确实很适合我们。&虽然这个类中没有“sex”这个属性,不过你完全可以用一个“空闲”的属性来顶替。&如果我们能自己建立“类”就更好了,但目前我还没有时间去研究这个东西,我也期望高手指点啊&:)
---------------------------------------------
好了!看到我贴的图了吗?那是我偷别人的,差不多能用我就不自己画了&:)
##############################################################
关于安装配置LDAP,使之储存系统用户,这里有一个非常好的网址,如果你的英文不是很差,都应该做的来,我偷个懒,就先不写这方面的东西喽:
http://www.mandrakesecure.net/en/docs/ldap-auth.php
上面的方法我已经试过,是可行的,如果兄弟们配置的时候出现问题我们可以讨论讨论。
关于LDAP+POSTFIX,POSTFIX里的“LDAP_README”中介绍的很详细,我再说就是重复了。
##############################################################
其它相关资源:
yala&(很实用的数据库操作工具,简单的说,他就是MYSQL的phpmyadmin,自己找下载地址吧~)
http://www.openldap.org/&(说实话,我一直没用上它,不过它是官方网站,不提也不好)
/&(什么‘类’下面有什么‘属性’,在这里找)ldap上面的图
& 回复于: 22:59:51
LDAP_README&
--------------------------------------------------------------------------------
LDAP&SUPPORT&IN&POSTFIX
=======================
Postfix&can&use&an&LDAP&directory&as&a&source&for&any&of&its&lookups:
aliases,&virtual,&canonical,&etc.&This&allows&you&to&keep&information
for&your&mail&service&in&a&replicated&network&database&with&fine-grained
access&controls.&By&not&storing&it&locally&on&the&mail&server,&the
administrators&can&maintain&it&from&anywhere,&and&the&users&can&control
whatever&bits&of&it&you&think&appropriate.&You&can&have&multiple&mail
servers&using&the&same&information,&without&the&hassle&and&delay&of
having&to&copy&it&to&each.
BUILDING&WITH&LDAP&SUPPORT
==========================
Note:&Postfix&no&longer&supports&the&LDAP&version&1&interface.
You&need&to&have&LDAP&libraries&and&include&files&installed&somewhere
on&your&system,&and&you&need&to&configure&the&Postfix&Makefiles
accordingly.&
For&example,&to&build&the&OpenLDAP&libraries&for&use&with&Postfix
(i.e.&LDAP&client&code&only),&you&could&use&the&following&command:
%&./configure&--without-kerberos&--without-cyrus-sasl&--without-tls&\
--without-threads&--disable-slapd&--disable-slurpd&\
--disable-debug&--disable-shared
If&you're&using&the&libraries&from&the&UM&distribution
(http://www.umich.edu/~dirsvcs/ldap/ldap.html)&or&OpenLDAP
(http://www.openldap.org),&something&like&this&in&the&top&level&of&your
Postfix&source&tree&should&work:
%&make&tidy
%&make&makefiles&CCARGS="-I/usr/local/include&-DHAS_LDAP"&\
AUXLIBS="-L/usr/local/lib&-lldap&-L/usr/local/lib&-llber"
On&Solaris&2.x&you&may&have&to&specify&run-time&link&information,
otherwise&ld.so&will&not&find&some&of&the&shared&libraries:
%&make&tidy
%&make&makefiles&CCARGS="-I/usr/local/include&-DHAS_LDAP"&\
AUXLIBS="-L/usr/local/lib&-R/usr/local/lib&-lldap&\
-L/usr/local/lib&-R/usr/local/lib&-llber"
The&'make&tidy'&command&is&needed&only&if&you&have&previously&built
Postfix&without&LDAP&support.
Instead&of&'/usr/local'&specify&the&actual&locations&of&your&LDAP
include&files&and&libraries.&Be&sure&to&not&mix&LDAP&include&files
and&LDAP&libraries&of&different&versions!!
If&your&LDAP&libraries&were&built&with&Kerberos&support,&you'll&also
need&to&include&your&Kerberos&libraries&in&this&line.&Note&that&the&KTH
Kerberos&IV&libraries&might&conflict&with&Postfix's&lib/libdns.a,&which
defines&dns_lookup.&If&that&happens,&you'll&probably&want&to&link&with
LDAP&libraries&that&lack&Kerberos&support&just&to&build&Postfix,&as&it
doesn't&support&Kerberos&binds&to&the&LDAP&server&anyway.&Sorry&about
the&bother.
If&you're&using&one&of&the&Netscape&LDAP&SDKs,&you'll&need&to&change&the
AUXLIBS&line&to&point&to&libldap10.so&or&libldapssl30.so&or&whatever&you
have,&and&you&may&need&to&use&the&appropriate&linker&option&(e.g.&'-R')
so&the&executables&can&find&it&at&runtime.
CONFIGURING&LDAP&LOOKUPS
========================
In&order&to&use&LDAP&lookups,&define&at&least&one&LDAP&source&as&a&table
lookup&in&main.cf,&for&example:
alias_maps&=&hash:/etc/aliases,&ldap:ldapsource
Each&LDAP&source&can&have&the&following&parameters,&which&should&be
prefixed&in&main.cf&with&the&name&you've&given&the&source&in&its
definition&and&an&underscore.&To&continue&the&example,&the&first
parameter&below,&"server_host",&would&be&defined&in&main.cf&as
"ldapsource_server_host".&Defaults&are&given&in&parentheses:
server_host&(localhost)
The&name&of&the&host&running&the&LDAP&server,&e.g.
ldapsource_server_host&=&
It&should&be&possible&with&all&the&libraries&mentioned&above&to&
specify&multiple&servers&separated&by&spaces,&with&the&libraries
trying&them&in&order&should&the&first&one&fail.&It&should&also
be&possible&to&give&each&server&in&the&list&a&different&port,&by
naming&them&like&":1444".
server_port&(389)&
The&port&the&LDAP&server&listens&on,&e.g.
ldapsource_server_port&=&778
search_base&(No&&you&must&configure&this.)
The&base&at&which&to&conduct&the&search,&e.g.&
ldapsource_search_base&=&dc=your,&dc=com
timeout&(10&seconds)
The&number&of&seconds&a&search&can&take&before&timing&out,&e.g.
ldapsource_timeout&=&5
query_filter&(mailacceptinggeneralid=%s)
The&RFC2254&filter&used&to&search&the&directory,&where&%s&is&a&
substitute&for&the&address&Postfix&is&trying&to&resolve,&e.g.
ldapsource_query_filter&=&(&(mail=%s)(paid_up=true))
result_filter&(%s)
Filter&applied&to&result&attributes.&Supports&the&same&expansions
as&the&query_filter,&and&can&be&easily&used&to&append&(or&prepend)
text.
domain&(Default&is&to&ignore&this.)
This&is&a&list&of&domain&names,&paths&to&files,&or&dictionaries.
If&specified,&only&lookups&for&the&domains&on&this&list&will&be
performed.&This&means&that&the&LDAP&map&won't&get&searched&for
'user',&nor&will&it&get&searched&for&any&domain&not&listed.&This
can&significantly&reduce&the&query&load&on&the&LDAP&server.
ldapsource_domain&=&postfix.org,&hash:/etc/postfix/searchdomains
result_attribute&(maildrop)
The&attribute(s)&Postfix&will&read&from&any&directory&entries
returned&by&the&lookup,&to&be&resolved&to&an&email&address.
ldapsource_result_attribute&=&mailbox,maildrop
special_result_attribute&(No&default)
The&attribute(s)&of&directory&entries&that&can&contain&DNs&or&URLs.
If&found,&a&recursive&subsequent&search&is&done&using&their&values.
ldapsource_special_result_attribute&=&member
scope&(sub)
The&LDAP&search&scope:&sub,&base,&or&one.&These&translate&into
LDAP_SCOPE_SUBTREE,&LDAP_SCOPE_BASE,&and&LDAP_SCOPE_ONELEVEL.
bind&(yes)
Whether&or&not&to&bind&to&the&LDAP&server.&Newer&LDAP
implementations&don't&require&clients&to&bind,&which&saves
time.&Example:
ldapsource_bind&=&no
If&you&do&need&to&bind,&you&might&consider&configuring&Postfix
to&connect&to&the&local&machine&on&a&port&that's&an&SSL&tunnel
to&your&LDAP&server.&If&your&LDAP&server&doesn't&natively
support&SSL,&put&a&tunnel&(wrapper,&proxy,&whatever&you&want&to
call&it)&on&that&system&too.&This&should&prevent&the&password
from&traversing&the&network&in&the&clear.
bind_dn&("")
If&you&do&have&to&bind,&do&it&with&this&distinguished&name.
Example:
ldapsource_bind_dn&=&uid=postfix,&dc=your,&dc=com
bind_pw&("")
The&password&for&the&distinguished&name&above.&If&you&have&to
use&this,&you&probably&want&to&make&main.cf&readable&only&by
the&Postfix&user.&Example:
ldapsource_bind_pw&=&postfixpw
cache&(no)
Whether&to&use&a&client-side&cache&for&the&LDAP&connection.&See
ldap_enable_cache(3).&It's&off&by&default.
cache_expiry&(30&seconds)
If&the&client-side&cache&is&enabled,&cached&results&will&expire
after&this&many&seconds.
cache_size&(32768&bytes)
If&the&client-side&cache&is&enabled,&this&is&its&size&in&bytes.
dereference&(0)
When&to&dereference&LDAP&aliases.&(Note&that&this&has&nothing
do&with&Postfix&aliases.)&The&permitted&values&are&those&
legal&for&the&OpenLDAP/UM&LDAP&implementations:
0&never
1&when&searching
2&when&locating&the&base&object&for&the&search
3&always
See&ldap.h&or&the&ldap_open(3)&or&ldapsearch(1)&man&pages&for
more&information.&And&if&you're&using&an&LDAP&package&that&has
other&possible&values,&please&bring&it&to&the&attention&of&the
postfix-users@postfix.org&mailing&list.
chase_referrals&(0)
Sets&(or&clears)&LDAP_OPT_REFERRALS&(requires&LDAP&version&3
support.
version&(2)
Specifies&the&LDAP&protocol&version&to&use.
debuglevel&(0)
What&level&to&set&for&debugging&in&the&OpenLDAP&libraries.
Don't&use&quotes&in&these&&at&least,&not&until&the&Postfix
configuration&routines&understand&how&to&deal&with&quoted&strings.
EXAMPLES
========
ALIASES
-------
Here's&a&basic&example&for&using&LDAP&to&look&up&aliases.&Assume&that&in
main.cf,&you&have&these&configuration&parameters&defined:
alias_maps&=&hash:/etc/aliases,&ldap:ldapsource
ldapsource_server_host&=&
ldapsource_search_base&=&dc=my,&dc=com
Upon&receiving&mail&for&a&local&address&"ldapuser"&that&isn't&found&in
the&/etc/aliases&database,&Postfix&will&search&the&LDAP&server&listening
at&port&389&on&.&It&will&bind&anonymously,&search&for&any
directory&entries&whose&mailacceptinggeneralid&attribute&is&"ldapuser",
read&the&"maildrop"&attributes&of&those&found,&and&build&a&list&of&their
maildrops,&which&will&be&treated&as&RFC822&addresses&to&which&the
message&will&be&delivered.
VIRTUAL&DOMAINS/ADDRESSES
-------------------------
If&you&want&to&keep&information&for&virtual&lookups&in&your&directory,
it's&only&a&little&more&complicated.&First&you&need&to&make&sure&Postfix
knows&about&the&virtual&domain.&An&easy&way&to&do&that&is&to&add&the
domain&to&the&mailacceptinggeneralid&attribute&of&some&entry&in&the
directory.&Next&you'll&want&to&make&sure&all&of&your&virtual&recipients'
mailacceptinggeneralid&attributes&are&fully&qualified&with&their&virtual
domains.&Finally,&if&you&want&to&designate&a&directory&entry&as&the
default&user&for&a&virtual&domain,&just&give&it&an&additional
mailacceptinggeneralid&(or&the&equivalent&in&your&directory)&of
"@virtual.dom".&That's&right,&no&user&part.&If&you&don't&want&a&catchall
user,&omit&this&step&and&mail&to&unknown&users&in&the&domain&will&simply
bounce.
If&you're&using&a&version&of&Postfix&newer&than&,&that&should&do
it.&If&not,&you&also&need&to&add&your&virtual&domains&to&relay_domains.
Simply&add&"$virtual_maps"&to&your&relay_domains&line.&Then&you&can&use
the&same&map&you&use&to&find&virtual&recipients&to&determine&if&a&domain
is&a&valid&virtual&domain&and&should&be&allowed&to&relay.
In&summary,&you&might&have&a&catchall&user&for&a&virtual&domain&that
looks&like&this:
dn:&cn=defaultrecipient,&dc=fake,&dc=dom
objectclass:&top
objectclass:&virtualaccount
cn:&defaultrecipient
owner:&uid=root,&dc=someserver,&dc=isp,&dc=dom
1&-&;&mailacceptinggeneralid:&fake.dom
2&-&;&mailacceptinggeneralid:&@fake.dom
3&-&;&maildrop:&realuser@real.dom&
1:&Postfix&knows&fake.dom&is&a&valid&virtual&domain&when&it&looks&for
this&and&gets&something&(the&maildrop)&back.
2:&This&causes&any&mail&for&unknown&users&in&fake.dom&to&go&to&this&entry&...
3:&...&and&then&to&its&maildrop.
Normal&users&might&simply&have&one&mailacceptinggeneralid&and&maildrop,
e.g.&"normaluser@fake.dom"&and&"normaluser@real.dom".
OTHER&USES
----------
Other&common&uses&for&LDAP&lookups&include&rewriting&senders&and
recipients&with&Postfix'&canonical&lookups,&for&example&in&order&to&make
mail&leaving&your&site&appear&to&be&coming&from&"First.Last@site.dom"
instead&of&"userid@site.dom".
NOTES&AND&THINGS&TO&THINK&ABOUT
===============================
-&The&bits&of&schema&and&attribute&names&used&in&this&document&are&just
examples.&There's&nothing&special&about&them,&other&than&that&some&are
the&defaults&in&the&LDAP&configuration&parameters.&You&can&use
whatever&schema&you&like,&and&configure&Postfix&accordingly.&
-&You&probably&want&to&make&sure&that&mailacceptinggeneralids&are
unique,&and&that&not&just&anyone&can&specify&theirs&as&postmaster&or
root,&say.
-&An&entry&can&have&an&arbitrary&number&of&mailacceptinggeneralids&or
maildrops.&Maildrops&can&also&be&comma-separated&lists&of&addresses.
They&will&all&be&found&and&returned&by&the&lookups.&For&example,&you
could&define&an&entry&intended&for&use&as&a&mailing&list&that&looks
like&this&(Warning!&Schema&made&up&just&for&this&example):
dn:&cn=Accounting&Staff&List,&dc=my,&dc=com
cn:&Accounting&Staff&List
o:&
objectclass:&maillist
mailacceptinggeneralid:&accountingstaff
mailacceptinggeneralid:&accounting-staff
maildrop:&mylist-owner
maildrop:&an-accountant
maildrop:&some-other-accountant
maildrop:&this,&that,&theother
-&If&you&use&an&LDAP&map&for&lookups&other&than&aliases,&you&may&have&to
make&sure&the&lookup&makes&sense.&In&the&case&of&virtual&lookups,
maildrops&other&than&mail&addresses&are&pretty&useless,&because
Postfix&can't&know&how&to&set&the&ownership&for&program&or&file
delivery.&Your&query_filter&should&probably&look&something&like&this:
virtual_query_filter&=&(&(mailacceptinggeneralid=%s)(!(|(maildrop="*|*")(maildrop="*:*")(maildrop="*/*"))))
-&And&for&that&matter,&even&for&aliases,&you&may&not&want&users&able&to
specify&their&maildrops&as&programs,&includes,&etc.&This&might&be
particularly&pertinent&on&a&"sealed"&server&where&they&don't&have
local&UNIX&accounts,&but&exist&only&in&LDAP&and&Cyrus.&You&might&allow
the&fun&stuff&only&for&directory&entries&owned&by&an&administrative
account:
local_query_filter&=&(&(mailacceptinggeneralid=%s)(|(!(maildrop="*|*")(maildrop="*:*")(maildrop="*/*"))(owner=cn=root,&dc=your,&dc=com)))
So&that&if&the&object&had&a&program&as&its&maildrop&and&weren't&owned
by&"cn=root"&it&wouldn't&be&returned&as&a&valid&local&user.&This&will
require&some&thought&on&your&part&to&implement&safely,&considering&the
ramifications&of&this&type&of&delivery.&You&may&decide&it's&not&worth
the&bother&to&allow&any&of&that&nonsense&in&LDAP&lookups,&ban&it&in
the&query_filter,&and&keep&things&like&majordomo&lists&in&local&alias
databases.
-&LDAP&lookups&are&slower&than&local&DB&or&DBM&lookups.&For&most&sites
they&won't&be&a&bottleneck,&but&it's&a&good&idea&to&know&how&to&tune
your&directory&service.
FEEDBACK
========
If&you&have&questions,&send&them&to&postfix-users@postfix.org.&Please
include&relevant&information&about&your&Postfix&setup:&LDAP-related
output&from&postconf,&which&LDAP&libraries&you&built&with,&and&which
directory&server&you're&using.&If&your&question&involves&your&directory
contents,&please&include&the&applicable&bits&of&some&directory&entries.
CREDITS
=======
Manuel&Guesdon:&Spotted&a&bug&with&the&ldapsource_timeout&attribute.
John&Hensley:&Multiple&LDAP&sources&with&more&configurable&attributes.
Carsten&Hoeger:&Search&scope&handling.&
LaMont&Jones:&Domain&restriction,&URL&and&DN&searches,&multiple&result
attributes.
Mike&Mattice:&Alias&dereferencing&control.
Hery&Rakotoarisoa:&Patches&for&LDAPv3&updating.
Prabhat&K&Singh:&Wrote&the&initial&Postfix&LDAP&lookups&and&connection&caching.
Keith&Stevenson:&RFC&2254&escaping&in&queries.
Samuel&Tardieu:&Noticed&that&searches&could&include&wildcards,&prompting
the&work&on&RFC&2254&escaping&in&queries.&Spotted&a&bug
in&binding.
Sami&Haahtinen:&Referral&chasing&and&v3&support.
And&of&course&Wietse.
& 回复于: 23:00:55
关于LDAP的补充&
--------------------------------------------------------------------------------
LDAP就是&light&DAP,&轻量级目录访问协议,&可以想象&还有一个DAP,&
70年代诞生的DAP协议基于&X.400目录访问协议。主要用于&大型主机,因为有大量不常用的功能而且这些不用的功能消耗了过多的系统资源,虽然极强大,但是应用不广,&所以出现了LDAP.
这是一个开放的协议,&具体的实现有&Netscape&LDAP,&Novell&NDS,&MS&AD等等,这3个是使用最广,影响最大的。
Netscape&LDAP&server主要使用在unix或类unix系统上,&MS&AD自然只能在windows上,&NDS是唯一一个跨平台的产品。注意:&LDAP本身是平台无关的。
工作原因,比较熟悉NDS,&AD最熟。我个人最喜欢NDS,AD当然最简单,但是最不稳定,最乱,而且比较耗资源。
楼主说的类似数据库,完全正确,因为它原本就是数据库,只是不是关系型的数据库,它是链式数据库,详细细节可以找本数据库原理,很详细的。
和关系数据库一样,&LDAP内能够定义哪些对象,每个对象可以有什么属性,每个属性可以取什么样的值,这样一个框架结构被称为Schema,它是类,对象,属性的集合。类又分为抽象类(只能做父类,不能实例化)和结构类(可以实例化),编程的朋友会发现和面向对象的编程的概念完全一样。
举例:&LDAP内必须先有user类,&然后用user类创建user对象(一般缺省有的),我们才能创建具体的用户账号(实例化),&schema中user对象被指定了有哪些属性,我们创建账号的时候才能给账号哪些属性,例如&schema中user对象没有别名属性,我们就不能给账号起别名。
Schema的扩展:
缺省的schema一般预先创建有足够的类,对象和属性,例如&MS&的AD&缺省有&170个类和833个对象和属性。但是如果不能满足需要的话,我们就可以扩展Schema,&一般是使用&LDAP&API,&例如&MS的&ADSI,&NDS有专门的工具,当然也可以直接使用LDAP查询语言,来直接操作整个LDAP目录树。
& 回复于: 09:23:51
好文,浅显易懂
& 回复于: 22:41:17
谢谢yanyp&&&&&&
精灵王
兄弟
希望和CU兄弟共享
& 回复于: 22:47:11
确实好文!
楼主能不能对syntax&'1.3.6.1.4.1..1.5'做一个解释呢?
我定义了一个attribute,让它具有这个binary&syntax。
可是,为什么我在JNDI中看到的是String呢?
& 回复于: 13:31:03
你是怎么定义的
& 回复于: 16:24:12
好文章,加精:-)
& 回复于: 18:05:42
谢谢楼主支持
& 回复于: 16:20:18
& 回复于: 10:00:19
能不能继续讲讲&Schema?
& 回复于: 23:55:51
[url=/s?wd=%C0%ED%BD%E2%D3%EB%D3%A6%D3%C3LDAP%B7%FE%CE%F1%C6%F7&cl=3]
该帖纯属抄袭,请点这里查看
& 回复于: 12:43:02
其中有我自己的加一部分.
你怎么说我抄袭呢
& 回复于: 12:44:36
你说话也太不厚道了吧
学习是一个过程,文章来自又是一个过程.
闲事情为什么管的那么多呢?CU是学习的地方而不是管杂事情的地方吧
& 回复于: 13:37:20
请问haoyufu:
在openldap中,使用什么schema,才能让outlook能看到邮件列表。这是所说的邮件列表是指一个别名对应多个邮箱地址。谢谢
& 回复于: 13:44:34
& 回复于: 13:45:32
HonestQiao
做技术太直了也不好,
& 回复于: 17:24:39
不错,是好文章^_^
& 回复于: 11:22:55
得你幫助,&我終於大概明白ldap是甚麼了,&謝謝
& 回复于: 17:44:31
& 回复于: 23:35:26
喜欢这样的文章!
& 回复于: 16:50:29
哈哈,谢谢!
& 回复于: 15:53:27
谢谢,最近学习LDAP。^_^
& 回复于: 10:52:40
真正大师级的文章,道理明白,而且浅显易懂。。。。。
自己懂是能人,让别人懂才是高手,大师!!!!!!!
顶顶顶!!!!!
& 回复于: 22:32:04
补充一些:
说ldap像数据库其实不是很准确,ldap的角色应该是一个抽象的数据结构层
现代的ldap&application&server真正的数据存储部分都是由真正的数据库来
完成的,当然使用的是一种历史最悠久的数据库,Berkley&DB
除了AD以外(AD的结构我不了解,没研究过)值得一提的是BDB也是勇气号
上使用的数据库。
现在主流的LDAP其实有两支,一支是基于NDS,NDS当然已经没有了
现在主要的产品是SunOne&Directory&Server以及Red&Hat&Directory&Server
还有另外一支就是以Openldap为基础的
产品是OpenLDAP和IBM&Tivoli&Directory&Server
LDAP的Schema,我自己的理解,跟XML的schema表达的意思一样
所谓schema就是数据结构的描述,用来说明数据应该怎样存放。概念
就像关系型数据库里的数据表结构一样
& 回复于: 17:30:02
好文章!要顶一下!
& 回复于: 10:06:47
LDAP记录的详细信息
dn:cn=stan,ou=linux,ou=computer,dc=ourschool,dc=org
objectClass:organizationalPerson
cn:stan
cn:小刀
sn:小刀
description:a&good&boy
**************************************************
搂主,sn是什么DD&?
& 回复于: 20:54:56
core.schema:
attributetype&(&2.5.4.4&NAME&(&'sn'&'surname'&)
DESC&'RFC2256:&last&(family)&name(s)&for&which&the&entity&is&known&by'
SUP&name&)
& 回复于: 09:07:01
不错,对LDAP的认识从0到非0了。
& 回复于: 01:01:29
& 回复于: 10:27:23
好!
很好理解!
& 回复于: 12:27:59
太经典了,终于能吃上苹果了...
感谢楼主和楼上的所有兄弟.
& 回复于: 12:32:14
引用:原帖由&HonestQiao&于&&23:55&发表
[url=/s?wd=%C0%ED%BD%E2%D3%EB%D3%A6%D3%C3LDAP%B7%FE%CE%F1%C6%F7&cl=3]
该帖纯属抄袭,请点这里查看
&
做人要厚道
这么好的DD,我怎么抄不到呢,可能是我太笨吧,楼主就比我聪明,我支持楼主哈.
& 回复于: 13:04:07
& 回复于: 19:00:07
好文,顶!!
& 回复于: 16:13:12
如何才能应用这个技术???
& 回复于: 22:09:16
容易理解&顶起
& 回复于: 21:22:21
ldap具体有什么用呢?
用在哪些地方呢?
& 回复于: 14:01:08
收藏,慢慢学
& 回复于: 10:40:46
不错的文章。我这就试试
& 回复于: 14:37:16
看不懂,有没有初级电子书?
& 回复于: 14:03:05
看了,觉得不错,入了一下门
& 回复于: 15:27:04
引用:原帖由&haoyufu&于&&18:05&发表
谢谢楼主支持&
阁下不就是楼主么?
& 回复于: 17:31:37
现收藏了,然后顶一下&:-)
& 回复于: 11:42:14
sun的服务器里面可以自己建类的,也可以建属性
& 回复于: 23:23:50
狂赞!!!!
& 回复于: 14:39:37
& 回复于: 10:40:16
好文章!所有楼的兄弟们的支持就是最好的证明!管它抄还是不抄呢!
收获了知识是真的!有的地方还找不到呢!
& 回复于: 11:57:53
引用:原帖由&lnfxcf&于&&10:40&发表
好文章!所有楼的兄弟们的支持就是最好的证明!管它抄还是不抄呢!
收获了知识是真的!有的地方还找不到呢!&
不,这是原则问题了。
楼主要是引用了别人的文章,必须注明是引用,自己做过修改,至少该注明所占的百分比。
一声不吭将别人的成果据为已有,这种行为,岂止可耻,简直是可耻之极。
做人要厚道。被你引用了文章的人会怎么想,你对他厚道了吗?你提过原创作者一个字了吗?
& 回复于: 13:22:38
& 回复于: 14:02:22
引用:原帖由&gudai&于&&11:57&发表
不,这是原则问题了。
楼主要是引用了别人的文章,必须注明是引用,自己做过修改,至少该注明所占的百分比。
一声不吭将别人的成果据为已有,这种行为,岂止可耻,简直是可耻之极。
做人要厚道。被&...&
没错,别人的文章也是无偿贡献给大家的,引用原文应当加以说明。
& 回复于: 12:56:32
引用:原帖由&tlint&于&&14:02&发表
没错,别人的文章也是无偿贡献给大家的,引用原文应当加以说明。&
支持!!!
& 回复于: 11:17:47
好文,澆顯易懂。
& 回复于: 14:01:52
& 回复于: 14:53:32
& 回复于: 11:43:12
好东西,学习了。
& 回复于: 09:02:23
标记一下,以后再看!
& 回复于: 23:09:55
本菜鸟长见识了!
& 回复于: 11:00:54
& 回复于: 10:34:31
浅显易懂的介绍文章;)
& 回复于: 23:28:13
& 回复于: 16:31:08
我装好了OpenLDAP之后,完全不知道该做点什么了,我想访问WindowsAD,该怎么办?
& 回复于: 13:20:02
有没有人用Oracle&internet&directory?
& 回复于: 11:15:51
好文章!&顶一个。
& 回复于: 23:11:56
刚刚接触一点
& 回复于: 20:15:50
好复杂哦,!!!
& 回复于: 11:05:24
终于明白LDAP是什么了,谢谢楼主!:)
& 回复于: 11:04:14
问答的形式,把问题解释很清楚。非常感谢楼主。。:)
& 回复于: 10:21:24
很好的文章,很精彩:wink:
& 回复于: 10:14:10
和XML的Schema还相似啊,XML也是一棵树
& 回复于: 10:16:06
引用:原帖由&quakelee&于&&22:32&发表&[url=http://bbs3.chinaunix.net/redirect.php?goto=findpost&pid=4334165&ptid=593660]
补充一些:
说ldap像数据库其实不是很准确,ldap的角色应该是一个抽象的数据结构层
现代的ldap&application&server真正的数据存储部分都是由真正的数据库来
完成的,当然使用的是一种历史最悠久的数据库,Be&...&
居然有人和我的想法一样,不过我不懂LDAP,也没用过他
& 回复于: 12:53:23
& 回复于: 16:28:30
小弟刚开始学习ldap,用jsp写了个网页,想通过用户id和密码登陆后看到用户信息,如何用java代码实现搜素查询ldap数据库呢?
& 回复于: 23:24:54
看过,感谢,留脚印。
& 回复于: 17:36:31
mark一下,回去好好研究:mrgreen:
& 回复于: 13:38:32
简单而且蕴含大智慧。
& 回复于: 19:41:06
今天看了一天的LDAP和ubuntu下的搭建方法,知道怎么建,却不知所以然,对里面的概念都不是很清楚,看了这篇文章,就明白多了,谢谢楼主。
原文链接:
转载请注明作者名及原文出处

我要回帖

更多关于 ldap禁止匿名访问 的文章

 

随机推荐