duplicity backup - IFTTT notifications

This is one post in a series of tutorials on Duplicity. If you are just getting started with duplicity, I recommend to first read the first and second part to get a basic overview of duplicity and get GPG keys setup properly (this will not be covered in this post). You should also visit the duplicity overview post, which contains a list of all posts in this series. The basic configuration of this post will be used in this post to configure duplicity-backup.sh.

When relying on a backup system it is important to be confident that everything worked. The easiest solution to accomplish this is by testing your backup on a regular basis, and by getting notified if something goes astray. The duplicity backup script does offer several notification methods for notifications, email, Slack, pushover, IFTTT and Telegram. In this post, we will see how to setup IFTTT notifications for duplicity.

IFTTT notifications

In order to use IFTTT you’ll need an account on the site. If you don’t have one, please register yourself with the service to continue with the tutorial. Go to My applets and click on “New Applet” (or use this link to get to this page directly). Click on the This link, search for “webhooks” and select it. duplicity_ifttt1 Click on Receive a web request.

Insert an event name (keep note of it - we’ll need this again later) and click on Create Trigger. duplicity_ifttt2

Click on That and select a service you’d like to Trigger.

I’m using Send me an email in this case, but feel free to experiment with other notification methods. duplicity_ifttt3 Click on “Send me an email”. For now, keep all fields identical - you can change the template later if you wish to receive a different subject or content. duplicity_ifttt4 Confirm the template by clicking on create action, then review and confirm the applet by clicking on Finish in the next screen.

duplicity-backup.sh

Implementing this into the duplicity-backup.sh script requires the configuration from the duplicity-backup.sh post.

Scroll all the way down (or search for “IFTTT”).

# Provider: IFTTT
IFTTT_KEY="" # Key for MAKER channel at IFTTT
IFTTT_MAKER_EVENT="duplicity" # name the event to trigger at IFTTT Maker Channel
IFTTT_HOOK_URL="https://maker.ifttt.com/trigger/$IFTTT_MAKER_EVENT/with/key/$IFTTT_KEY" # ONLY change this if IFTTT changes it
IFTTT_VALUE2="" # general purpose value to pass to your maker channel (optional)

The settings we are interested in are IFTTT_KEY and IFTTT_MAKER_EVENT (and eventually IFTTT_VALUE2 - we can use this to tell us the name of the backup job). IFTTT_MAKER_EVENT will be set to the event name we configured on IFTTT earlier. Next, go to IFTTT Webhook settings to get value for the IFTTT_KEY. You’ll see an URL - the last part of the URL https://maker.ifttt.com/use/c734bdvJ5afSlnwVRukZZ2 (in bolt) is your key and goes to the IFTTT_KEY variable.

Next, search for NOTIFICATION_SERVICE and insert “ifttt” there. The relevant section will then look as follows:

# Possible values for NOTIFICATION_SERVICE are: slack, pushover, ifttt, telegram
NOTIFICATION_SERVICE="ifttt"
NOTIFICATION_FAILURE_ONLY="yes" # send notifications only if there was an error while creating backup

# ...

# Provider: IFTTT
IFTTT_KEY="c734bdvJ5afSlnwVRukZZ2" # Key for MAKER channel at IFTTT
IFTTT_MAKER_EVENT="duplicity" # name the event to trigger at IFTTT Maker Channel
IFTTT_HOOK_URL="https://maker.ifttt.com/trigger/$IFTTT_MAKER_EVENT/with/key/$IFTTT_KEY" # ONLY change this if IFTTT changes it
IFTTT_VALUE2="Server11" # general purpose value to pass to your maker channel (optional)

wrapping up

While from a security perspective, using mail might be seen favorable as it does not involve trusting an external service, the convenience by not having to setup your own mail client on a server (which may not need it for anything else) out weights the concerns. Also, IFTTT is a well established service (in operation since 2011), so i feel safe in trusting them with this little information. No password other than the one to IFTTT has been shared.

Both methods work perfectly fine - however I personally prefer the IFTTT method, as it’s easier to setup as it has no additional requirements. In this post I’ve also shown how to configure email notifications directly, so please choose whichever method seems favorable to you. The most important thing is to be notified should something go wrong with the backup (apart from having a backup!!) - which method is chosen is completely up to the user.


comments powered by Disqus