Exim4 LAN-relay on Debian Jessie with external smarthost

As part of a restructure at home I wanted to setup my router to be able to send email for all the servers on my LAN.
I tested it using Fastmail, but I know this will also work with Gmail. (I used the same setup when I had a gmail-account)

I did it like so:
:~# apt-get install exim4

:~# dpkg-reconfigure exim4-config

“Mail sent by smarthost; no local mail”

“System mail name: Home.Local”

IP-Address to listen on: Type in the LAN-IP of your router, or 0.0.0.0 if it’s entirely on a private/trusted LAN. (for example a standalone raspberry PI.)

“Other destinations for which mail is accepted: <leave blank>”

“Visible Domain name for local users: Home.Local”

IP-address or host name of the outgoing smarthost: This one depends on YOUR smarthost. Fastmail uses “mail.messagingengine.com::587”.

If you are lucky, you will get a prompt for, “Domains to relay mail for:” here, if that’s the case – Enter “*” and continue, otherwise we have to do something more.

Number-of-DNS-queries minimal, No.

Split configuration into small files, No.

If you were lucky, skip to configuring passwd.client, otherwise:

:~# editor /etc/exim4/update-exim4.conf.con
Fint and edit dc_relay_domains=” and add a *, so that it reads “dc_relay_domains=’*'”.
(Don’t just copy/paste that, quotes etc.)
Save the file, and re-run config to verify, then go ahead.

:~# editor /etc/exim4/passwd.client

And input using the following variables:
<servername>:<username>:<password>

For fastmail this equalls:
mail.messagingengine.com:leetuser@fastmail.com:leethax0rpassword
Save and restart exim using:

:~# systemctl restart exim4.service

Send a test-mail using:

:~# echo “testmail!” | mailx testmail@example.com

It should arrive!

Now for the clients in your LAN, the following should be done:

:~# apt-get install exim4

:~# dpkg-reconfigure exim4-config

“Mail sent by smarthost; no local mail”

“System mail name:” Leave as-is, should contain hostname+domain.

“IP-addresses to listen on for incoming SMTP connections:” Leave to something loopback-ish. (127.0.0.1, ::1)

“Other destinations for which mail is accepted:” Leave as-is.

“Visible domain name for local users:” Leave as-is.

“IP address or host name of the outgoing smarthost:” Enter the hostname/IP of the host created during the first part.

Number-of-DNS-queries minimal, No.

Split configuration into small files, No.

And then send a test-mail using the following command:

:~# echo “Testing mail via relay at <clock>” | mailx receiver@example.com

It can also be a good idea to update the mail-alias on the client.

:~# editor /etc/aliases

Replace the entry after root with a valid (and monitored) email, for example:
root: user+fileserver@example.com

Save the file, and you’re done.

Advertisements

Configure SMS Backup + for use with FastMail

I like to keep a backup of all my received/sendt texts and all info regarding my calls.
I do this by using SMS Backup + ( https://f-droid.org/repository/browse/?fdid=com.zegoggles.smssync ), but I don’t use Google – I use FastMail.
At the time of this writing (2015-07-14) there is an issue with the package in F-droid, so you have to use an APK from another source.
So the following is needed to use SMS Backup + with FastMail.

First login to FastMail, go to Advanced Settings, and select Alternative Logins. (You need to NOT use an alternative login when viewing this.)

Create a new login, type a friendly name, select Regular as “Login Type”, input a good and complex password (20+ plus) in “Base password”, select “Full access”, and input the Master password, press “Create alternative login”
If you’d like, (and you should) create a new folder in FastMail and name it something that “fits” with the backup. I created a folder named “Log” which I’ll put both call log and SMS in, but seperate folders also works.

Now open the app on your phone, and press “Advanced Settings”, then press “IMAP Server Settings”.
Press “Authentication”, and switch to “Plain Text” (no, it won’t be Plain Text.)

Several settings were now revealed to you, use the settings from this page ( https://www.fastmail.com/help/technical/servernamesandports.html ) to get the correct ones.
At the time of writing ( 2015-07-14 ) this was:
Server address: mail.messagingengine.com:993
Security: SSL
Username: <fastmail login>
Password: <password you created above>

When all done, go back and select “Backup Settings”, mark the settings you want to backup (exclude WhatsApp, which was discontinued).
Configure this as per your liking, but under “Call log settings” and “SMS” you set “GMail labels”, this corresponds to IMAP-folders, and you should input the folder-name you created above there.

I would also recommend that you enter “Restore settings” and select a max number of messages restored, so as to not restore several thousand messages later on.

Enable “Auto backup” on main screen, and tweak “Auto backup settings” to your liking.
All done.