Send email secure PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Bart Dorlandt   
Tuesday, 01 November 2011 11:38

Just to summarize what needs to be done to have your linux machine send email securely with postfix from anywhere. This way your machine can output it messages it generates to your email. This can be any desktop or laptop which will be on different networks.

What you need on the client side is a fairly simple postfix configuration. An example below. In this configuration i use google mail as the smtp server.

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no

# TLS parameters
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtp_tls_received_header = yes
smtp_tls_loglevel = 1
tls_random_source = dev:/dev/urandom

# SASL
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myhostname = 
myorigin = $myhostname
mydestination = localhost.bamweb.nl, localhost
relayhost = [smtp.gmail.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
next you have to fill in the file /etc/postfix/sasl_passwd . It will look like this:
[smtp.gmail.com]:587 :

To secure this file execute the following. After that we make a postmap which will create a .db file of it which postfix needs.

chown root:root /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
postmap hash:
/etc/postfix/sasl_passwd

Once that is done we can restart postfix and we are good to go.

service postfix restart

 

If you have your own server, make sure you have TLS configured for smtp, smtpd and allow sasl connections. You also have to uncomment submission in master.cf.

 


Related items: