LINUX.ORG.RU
решено ФорумAdmin

postfix, чтение информации из ldap

 , , ,


0

1

Для оформления ограничений в Postfix, хочу использовать как карту, уже существующую группу в ldap. Вот ее содержимое

dn: cn=mailFullAccess,ou=mail,ou=Groups,dc=my,dc=myorg
gidNumber: 5555
memberUid: user1
memberUid: user2
memberUid: user3
memberUid: user4
memberUid: user5
description: for unlimited access to mail
objectClass: top
objectClass: posixGroup
cn: mailFullAccess

результат ldapseach запроса (запрос существующего пользователя)

[root@mail ~]# ldapsearch -LLL -x -h ldap.host -b 'cn=mailFullAccess,ou=mail,ou=Groups,dc=my,dc=myorg' memberuid=user1

dn: cn=mailFullAccess,ou=mail,ou=Groups,dc=my,dc=myorg
gidNumber: 5555
memberUid: user1
memberUid: user2
memberUid: user3
memberUid: user4
memberUid: user5
description: for unlimited access to mail
objectClass: top
objectClass: posixGroup
cn: mailFullAccess

результат ldapseach запроса (запрос НЕсуществующего пользователя)

[root@mail ~]# ldapsearch -LLL -x -h ldap.host -b 'cn=mailFullAccess,ou=mail,ou=Groups,dc=my,dc=myorg' memberuid=user1234

-ВЫВОДА НЕТ-

Запрос к группе в в виде файла для Postfix - ldap_full.cf

search_base = cn=mailFullAccess,ou=mail,ou=Groups,dc=my,dc=myorg
server_host = ldap.host
query_filter = (memberUid=%u)
result_attribute = memberUid
scope = one
bind = yes
binddn = cn=poweruser,ou=Service,dc=my,dc=myorg
bindpw = password
debuglevel = 0

Пытаюсь проверить

postmap -q «user1@domain.ru» ldap:/etc/postfix/ldap/full_ldap.cf

пусто, пробую несуществующую абрукадабру

postmap -q «user123456» ldap:/etc/postfix/ldap/full_ldap.cf

также пусто.. что не так?


Первое, что приходит в голову:

binddn = cn=poweruser,ou=Service,dc=my,dc=myorg

Не имеет прав чтения из нужной части каталога - вы когда ldapsearch делаете, от чьего имени выполняете запрос?

Кроме того, для того, чтобы понять, что происходит, достаточно включить debug в ldap и наблюдать в логе запросы и возвращаемые ответы - будет сразу видно, что за запрос на самом деле строит postfix

zgen ★★★★★
()
Ответ на: комментарий от zgen

Права есть, дебаг вроде показывает, что ищется что-то..

[root@mail postfix]# postmap -q «user1@domain.tld» ldap:./ldap/full_ldap.cf
postmap: dict_ldap_debug: ldap_create                                              
postmap: dict_ldap_debug: ldap_url_parse_ext(ldap://ldap.host:389)              
postmap: dict_ldap_debug: ldap_sasl_bind                                           
postmap: dict_ldap_debug: ldap_send_initial_request                                
postmap: dict_ldap_debug: ldap_new_connection 1 1 0                                
postmap: dict_ldap_debug: ldap_int_open_connection                                 
postmap: dict_ldap_debug: ldap_connect_to_host: TCP ldap.host:389               
postmap: dict_ldap_debug: ldap_new_socket: 4                                       
postmap: dict_ldap_debug: ldap_prepare_socket: 4                                   
postmap: dict_ldap_debug: ldap_connect_to_host: Trying ldap.host:389            
postmap: dict_ldap_debug: ldap_pvt_connect: fd: 4 tm: 10 async: 0                  
postmap: dict_ldap_debug: ldap_ndelay_on: 4                                        
postmap: dict_ldap_debug: ldap_int_poll: fd: 4 tm: 10                              
postmap: dict_ldap_debug: ldap_is_sock_ready: 4                                    
postmap: dict_ldap_debug: ldap_ndelay_off: 4                                       
postmap: dict_ldap_debug: ldap_pvt_connect: 0                                      
postmap: dict_ldap_debug: ldap_open_defconn: successful                            
postmap: dict_ldap_debug: ldap_send_server_request                                 
postmap: dict_ldap_debug: ber_scanf fmt ({it) ber:                                 
postmap: dict_ldap_debug: ber_scanf fmt ({i) ber:                                  
postmap: dict_ldap_debug: ber_flush2: 14 bytes to sd 4                             
postmap: dict_ldap_debug: ldap_result ld 0x7fe8576ce290 msgid 1                    
postmap: dict_ldap_debug: wait4msg ld 0x7fe8576ce290 msgid 1 (timeout 10000000 usec)
postmap: dict_ldap_debug: wait4msg continue ld 0x7fe8576ce290 msgid 1 all 1         
postmap: dict_ldap_debug: ** ld 0x7fe8576ce290 Connections:                         
postmap: dict_ldap_debug: * host: ldap.host  port: 389  (default)                
postmap: dict_ldap_debug:   refcnt: 2  status: Connected                            
postmap: dict_ldap_debug:   last used: Fri Dec 28 12:36:02 2012                     
postmap: dict_ldap_debug:                                                           
postmap: dict_ldap_debug: ** ld 0x7fe8576ce290 Outstanding Requests:                
postmap: dict_ldap_debug:  * msgid 1,  origid 1, status InProgress                  
postmap: dict_ldap_debug:    outstanding referrals 0, parent count 0                
postmap: dict_ldap_debug:   ld 0x7fe8576ce290 request count 1 (abandoned 0)         
postmap: dict_ldap_debug: ** ld 0x7fe8576ce290 Response Queue:                      
postmap: dict_ldap_debug:    Empty                                                  
postmap: dict_ldap_debug:   ld 0x7fe8576ce290 response count 0                      
postmap: dict_ldap_debug: ldap_chkResponseList ld 0x7fe8576ce290 msgid 1 all 1      
postmap: dict_ldap_debug: ldap_chkResponseList returns ld 0x7fe8576ce290 NULL       
postmap: dict_ldap_debug: ldap_int_select                                           
postmap: dict_ldap_debug: read1msg: ld 0x7fe8576ce290 msgid 1 all 1                 
postmap: dict_ldap_debug: ber_get_next                                              
postmap: dict_ldap_debug: ber_get_next: tag 0x30 len 12 contents:                   
postmap: dict_ldap_debug: read1msg: ld 0x7fe8576ce290 msgid 1 message type bind     
postmap: dict_ldap_debug: ber_scanf fmt ({eAA) ber:                                 
postmap: dict_ldap_debug: read1msg: ld 0x7fe8576ce290 0 new referrals               
postmap: dict_ldap_debug: read1msg:  mark request completed, ld 0x7fe8576ce290 msgid 1
postmap: dict_ldap_debug: request done: ld 0x7fe8576ce290 msgid 1                     
postmap: dict_ldap_debug: res_errno: 0, res_error: <>, res_matched: <>                
postmap: dict_ldap_debug: ldap_free_request (origid 1, msgid 1)                       
postmap: dict_ldap_debug: ldap_parse_sasl_bind_result                                 
postmap: dict_ldap_debug: ber_scanf fmt ({eAA) ber:
postmap: dict_ldap_debug: ldap_msgfree
postmap: dict_ldap_debug: ldap_search_ext
postmap: dict_ldap_debug: put_filter: "(memberUid=user1)"
postmap: dict_ldap_debug: put_filter: simple
postmap: dict_ldap_debug: put_simple_filter: «memberUid=user1»
postmap: dict_ldap_debug: ldap_send_initial_request
postmap: dict_ldap_debug: ldap_send_server_request
postmap: dict_ldap_debug: ber_scanf fmt ({it) ber:
postmap: dict_ldap_debug: ber_scanf fmt ({) ber:
postmap: dict_ldap_debug: ber_flush2: 108 bytes to sd 4
postmap: dict_ldap_debug: ldap_result ld 0x7fe8576ce290 msgid 2
postmap: dict_ldap_debug: wait4msg ld 0x7fe8576ce290 msgid 2 (timeout 10000000 usec)
postmap: dict_ldap_debug: wait4msg continue ld 0x7fe8576ce290 msgid 2 all 1
postmap: dict_ldap_debug: ** ld 0x7fe8576ce290 Connections:
postmap: dict_ldap_debug: * host: ldap.host  port: 389  (default)
postmap: dict_ldap_debug:   refcnt: 2  status: Connected
postmap: dict_ldap_debug:   last used: Fri Dec 28 12:36:02 2012
postmap: dict_ldap_debug:
postmap: dict_ldap_debug: ** ld 0x7fe8576ce290 Outstanding Requests:
postmap: dict_ldap_debug:  * msgid 2,  origid 2, status InProgress
postmap: dict_ldap_debug:    outstanding referrals 0, parent count 0
postmap: dict_ldap_debug:   ld 0x7fe8576ce290 request count 1 (abandoned 0)
postmap: dict_ldap_debug: ** ld 0x7fe8576ce290 Response Queue:
postmap: dict_ldap_debug:    Empty
postmap: dict_ldap_debug:   ld 0x7fe8576ce290 response count 0
postmap: dict_ldap_debug: ldap_chkResponseList ld 0x7fe8576ce290 msgid 2 all 1
postmap: dict_ldap_debug: ldap_chkResponseList returns ld 0x7fe8576ce290 NULL
postmap: dict_ldap_debug: ldap_int_select
postmap: dict_ldap_debug: read1msg: ld 0x7fe8576ce290 msgid 2 all 1
postmap: dict_ldap_debug: ber_get_next
postmap: dict_ldap_debug: ber_get_next: tag 0x30 len 12 contents:
postmap: dict_ldap_debug: read1msg: ld 0x7fe8576ce290 msgid 2 message type search-result
postmap: dict_ldap_debug: ber_scanf fmt ({eAA) ber:
postmap: dict_ldap_debug: read1msg: ld 0x7fe8576ce290 0 new referrals
postmap: dict_ldap_debug: read1msg:  mark request completed, ld 0x7fe8576ce290 msgid 2
postmap: dict_ldap_debug: request done: ld 0x7fe8576ce290 msgid 2
postmap: dict_ldap_debug: res_errno: 0, res_error: <>, res_matched: <>
postmap: dict_ldap_debug: ldap_free_request (origid 2, msgid 2)
postmap: dict_ldap_debug: ldap_parse_result
postmap: dict_ldap_debug: ber_scanf fmt ({iAA) ber:
postmap: dict_ldap_debug: ber_scanf fmt (}) ber:
postmap: dict_ldap_debug: ldap_msgfree
postmap: dict_ldap_debug: ldap_free_connection 1 1
postmap: dict_ldap_debug: ldap_send_unbind
postmap: dict_ldap_debug: ber_flush2: 7 bytes to sd 4
postmap: dict_ldap_debug: ldap_free_connection: actually freed
x09
() автор топика
Ответ на: комментарий от blind_oracle

sub поставил, базу сменил, дебаг ничего не выводит, но поиск заработал. Юзеров находит, но проблема, в том, что в ou=mail есть 3 вложенных группы.. и задача искать в конкретной,а не во всех))

x09
() автор топика
Ответ на: комментарий от x09

Ну как бы да, так обычно и делается. Указывать базу поиска на объект, а не на контейнер - не самое лучшее решение.

blind_oracle ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.