many of the linux utilities/programs support mail reporting. This ,of course, will be useless without sending your e-mail to the real world.
Here is a short guide how to turn your machine into a relay server for your lan and also to relay all mails (not destined to you) via gmail.
1.Enable "less secure apps" on the following link (I will try to set it up with the 2-step auth,but for now - this is it)
2.You may need to install additional software. Here are my versions:
Code: Select all
# rpm -qa | grep sasl
cyrus-sasl-plain-2.1.26-21.el7.x86_64
cyrus-sasl-2.1.26-21.el7.x86_64
cyrus-sasl-lib-2.1.26-21.el7.x86_64
cyrus-sasl-md5-2.1.26-21.el7.x86_64
cyrus-sasl-scram-2.1.26-21.el7.x86_64
cyrus-sasl-gssapi-2.1.26-21.el7.x86_64
Code: Select all
# cat /etc/postfix/sasl_passwd
[smtp.gmail.com]:587 <my_email>@gmail.com:<my_password>
Code: Select all
# cat /etc/postfix/tls_policy
[smtp.gmail.com]:587 encrypt
Code: Select all
chmod 600 /etc/postfix/{sasl_passwd,tls_policy}
Code: Select all
postmap /etc/postfix/sasl_passwd && postmap /etc/postfix/tls_policy
Code: Select all
# grep -Ev "^$|^#" /etc/postfix/main.cf
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = <Desktop.example.com>
mydomain = <example.com>
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
mynetworks = <192.168.122.0/24, 192.168.100.0/24, 127.0.0.0/8>
relayhost = [smtp.gmail.com]:587
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/pki/tls/cert.pem
Code: Select all
systemctl restart postfix.service
Code: Select all
echo TEST | mail -s TEST some_email@somedomain.com && postqueue -p
If you have any ideas,comments,remarks - don't hesitate to comment.