Configurazione di Postfix + Ldap

main.cf

mail_owner = postfix
#
myhostname = proxy-tmp.pippo.it

mydomain = pippo.it
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost

mynetworks = 127.0.0.0/8 172.21.1.15/32 192.168.0.20/32 192.168.0.25/32 192.168.0.21/32 192.168.0.22/32

helpful_warnings = yes
inet_protocols = ipv4

#If this parameter is non-empty (the default), then the Postfix SMTP server will reject mail for unknown local users.
#To turn off local recipient checking in the Postfix SMTP server, specify “local_recipient_maps =” (i.e. empty).
local_recipient_maps =

local_transport = error:local mail delivery is disabled
virtual_alias_maps = hash:/etc/postfix/virtual

relay_domains =
relay_recipient_maps =
parent_domain_matches_subdomains = debug_peer_list smtpd_access_maps

# Filtri sul “client” smtp che si connette al server
#La connessione può avvenire dall’interno (solo x mail2k3 e le macchine in MZ e i server in DMZ) oppure da internet
# Il default o comunque l’ultima opzione è permettere l’accesso perchè se si connettono da internet non posso specificarli a mano.
##Devo specificare in access_client chi può fare cosa fra gli indirizzi che conosco.
smtpd_client_restrictions =
permit_mynetworks,
check_client_access hash:/etc/postfix/maps/access_client
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client zen.spamhaus.org,
permit

## Necessario per specificare il “next hop” verso exchange x mail in ricezione
transport_maps = hash:/etc/postfix/transport

# Filtri sul “RCPT TO” quindi sull’indirizzo di destinazione
smtpd_recipient_restrictions =
check_recipient_access ldap:/etc/postfix/maps/ldap-access.cf,
check_recipient_access hash:/etc/postfix/maps/access_recipient,
permit_mynetworks,
reject_non_fqdn_recipient,
reject_invalid_hostname,
reject

## Controllo degli header (da implementare)
header_checks = regexp:/etc/postfix/header_checks

readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
html_directory = no
setgid_group = postdrop
command_directory = /usr/sbin
manpage_directory = /usr/local/man
daemon_directory = /usr/libexec/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
queue_directory = /var/spool/postfix
data_directory = /var/lib/postfix
debug_peer_level = 4
———————————————————————————–
maps/access_recipient:

pippo.it 551 Indirizzo inesistente. Si prega di Telefonare al +39 055.5449
——————————————————————————————
maps/ldap-access.cf

version = 3
server_host = dc01.pippo.local
search_base = dc=pippo, dc=local
query_filter = (&(proxyAddresses=*smtp:%s*)(&(!(userAccountControl:1.2.840.113556.1.4.803:=2)))(objectClass=*)(!(displayNamePrintable=nomail)))

result_attribute = mail

### ATTENZIONE – Questa è la parte + importante e NON DOCUMENTATA! Occorre che la risposta ### sia: ” OK username o mail”

result_format = OK %s
bind = yes
bind_dn = CN=utente,CN=Users,DC=pippo,DC=local
bind_pw = password
#debuglevel = 1

——————————————————————————————–

##################################################################
ATTENZIONE – Questa è la parte + importante e NON DOCUMENTATA! Occorre che la risposta sia:
“OK username o mail”
e NON vicevers come è documentato:
“username o mail OK”
##################################################################

.