Miércoles Octubre 21 , 2020
Text Size
   

postfix recibir o enviar correos de un dominio especifico

manuales - Linux

Cuando tenemos un servidor de correo saliente, y sobre todo, si lo queremos usar para algo concreto, podemos indicar al postfix que restrinja orígenes y destinos a voluntad. Si se da el caso, una forma sencilla, es seguir estos pasos

fuente: http://serverfault.com/questions/62189/postfix-only-receive-emails-from-specific-domains

 

 

It depends how you want to restrict it. I'm not sure whether those are the mail relays you're talking about or the sending addresses.

Sending addresses

You can use the check_sender_access directive within an appropiate smtpd_*_restrictions. It's normally best practice to apply all sender, host checks etc. within the recipient restrictions (i.e. after the client has sent 'RCPT To:' )

e.g. to allow only mail from senders @gmail.com and @hotmail.com ...

set smtpd_recipient_restrictions to the following:

smtpd_recipient_restrictions =
    check_sender_access hash:/etc/postfix/access,
    reject

Now /etc/postfix/access should be of the form:

gmail.com OK
hotmail.com OK

use postmap hash:/etc/postfix/access to create the hash table.

Relay hostname or IP

smtpd_recipient_restrictions =
    check_client_access hash:/etc/postfix/client_access,
    reject

The format of client_access is similar:

host.name.of.system.com  OK
ip.addr.of.system        OK

Reading your logs

The following is a full excerpt from my mail.log for an example message. I picked a message and got the queue id - 31AF4761F3. It will be in the headers of the mail as well as your mail log file.

$ grep 31AF4761F3 /var/log/mail.log
Sep  4 09:30:38 cutoffs postfix/smtpd[7912]: 31AF4761F3: client=russian-caravan.cloud9.net[w.x.y.z]
Sep  4 09:30:38 cutoffs postfix/cleanup[7915]: 31AF4761F3: message-id=
Sep  4 09:30:38 cutoffs postfix/qmgr[19172]: 31AF4761F3: from=, size=4225, nrcpt=1 (queue active)
Sep  4 09:30:39 cutoffs postfix/pipe[7916]: 31AF4761F3: to=, relay=spamassassin, delay=1.4, delays=0.19/0.01/0/1.3, dsn=2.0.0, status=sent (delivered via spamassassin service)
Sep  4 09:30:39 cutoffs postfix/qmgr[19172]: 31AF4761F3: removed

You can see in the first line, we have client=russian-caravan.cloud9.net (which is the mail server that sends mail for the postfix mailing list) and the IP address is in brackets. You can use the hostname or the IP in the access file but remember if they have multiple mail relays or ever change their mail relays, you'll need to figure that out.

 

Usar puntuación: / 2
MaloBueno 



who

Tenemos 68 invitados conectado(s)