Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [/etc/hosts]
- 127.0.0.1 localhost.localdomain localhost
- ::1 localhost6.localdomain6 localhost6
- <serverip> <machinename>.<mydomain>.<tld>
- <serverip> <mydomain>.<tld>
- # The following lines are desirable for IPv6 capable hosts
- ::1 ip6-localhost ip6-loopback
- fe00::0 ip6-localnet
- ff00::0 ip6-mcastprefix
- ff02::1 ip6-allnodes
- ff02::2 ip6-allrouters
- ff02::3 ip6-allhosts
- ---
- Using postfix -
- [/etc/postfix/main.cf]
- ...
- myhostname = <machinename>.<mydomain>.<tld>
- mydomain = <mydomain>.<tld>
- myorigin = $mydomain
- ...
- relay_domains = hash:/etc/postfix/relay_domains
- ...
- readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
- smtpd_sasl_local_domain = $myhostname
- smtpd_sasl_auth_enable = yes
- smtpd_sasl_security_options = noanonymous
- broken_sasl_auth_clients = yes
- smtpd_sasl_authenticated_header = yes
- smtpd_recipient_restrictions =
- check_sender_access hash:/etc/postfix/sender_access,
- permit_sasl_authenticated,
- permit_mynetworks,
- reject_unauth_destination,
- regexp:/etc/postfix/banned-regexp
- #,check_relay_domains
- mynetworks = 127.0.0.0/8
- inet_protocols=ipv4
- smtpd_tls_auth_only = no
- smtp_use_tls = yes
- smtpd_use_tls = yes
- smtp_tls_note_starttls_offer = yes
- smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
- smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
- smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
- smtpd_tls_loglevel = 1
- smtpd_tls_received_header = yes
- smtpd_tls_session_cache_timeout = 3600s
- tls_random_source = dev:/dev/urandom
- home_mailbox = Maildir/
- unverified_sender_reject_code = 550
- #parent_domain_matches_subdomains = debug_peer_list,fast_flush_domains,mynetworks,permit_mx_backup_networks,qmqpd_authorized_clients,relay_domains,smtpd_access_maps
- parent_domain_matches_subdomains = mynetworks,permit_mx_backup_networks,smtpd_access_maps
- #,relay_domains
- mailbox_command =
- smtp_sasl_path = smtp
- smtp_sasl_auth_enable = yes
- smtp_sasl_security_options = noanonymous #noplaintext
- smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
- smtpd_sender_restrictions =
- permit_mynetworks,
- reject_non_fqdn_sender,
- reject_unknown_sender_domain,
- permit
- sendmail_path = /usr/sbin/sendmail
- data_directory = /var/lib/postfix
- TBH, I haven't looked at this in years, so it may not be configured optimally.
- [/etc/postfix/mydestinations]
- /localhost/ ACCEPT
- /<mydomain>\.<tld>/ ACCEPT
- /.*\.<mydomain>\.<tld>/ ACCEPT
- [/etc/postfix/relay_domains]
- <machinename>.<mydomain>.<tld> OK
- *.<mydomain>.<tld> OK
- <mydomain>.<tld> OK
- [/etc/postfix/sasl_passwd]
- smtp.gmail.com:587 <gmailnick>@gmail.com:<mygmailpass>
- These files need to be hashed:
- /usr/sbin/postmap hash:/etc/postfix/relay_domains
- /usr/sbin/postmap hash:/etc/postfix/mydestinations
- /usr/sbin/postmap hash:/etc/postfix/sasl_passwd
- After changing any of these files and hashing them, you need to restart postfix to pick up the changes.
- /sbin/service dovecot restart #I don't remember if this is necessary
- /sbin/service postfix restart
- Then I run a quick php script:
- <?php
- $to = '<mynick>@newrelic.<mydomain>.<tld>';
- $subject = 'Super Serious Offer';
- $message = 'hello there you, do you scam?';
- $headers = 'From: [email protected]' . "\r\n";
- mail($to, $subject, $message, $headers);
- ?>
- Then I test from say a gmail or yahoo mail account. There's additional work to get gmail working, iirc.
- This is also how I test blocking domains, which can be done:
- vi /etc/postfix/banned-regexp
- /<mynick>@ably\.<mydomain>\.<tld>/ REJECT
- I have lots of this. Add a line then restart postfix.
- /sbin/service postfix restart
- Test with the php script and see if it arrives.
Advertisement
Add Comment
Please, Sign In to add comment