Datensicherung von Kalendern und Adressbüchern von Nextcloud https://strobelstefan.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Stefan 30b3318837 Added Installation Option 3 months ago
LICENSE Initial commit 4 months ago
README-DE.md Added Installation Option 3 months ago
README.md Added Installation Option 3 months ago
kalenderbackup.sh Initial Commit 4 months ago

README.md

kalenderbackup

🇩🇪 README in Deutsch

What is the purpose of "kalenderbackup"?

This script calls calcardbackup from BernieO to automatically backup address books and calenders of your Nextcloud instance.

Hey, calcardbackup does the same as calcardbackup so why should I use "kaldenderbackup"?

That´s a good question! calcardbackup is a very powerful tool which provides a lot of features. So here are my BUTs to create kalenderbackup 😊

The script provides the following features:

  1. you can call the script from any location
  2. creates a detailed log file
  3. mounts an external storage which is attached to your server
  4. calls calcardbackup to export address books and calendars
  5. stores the export of your address books and contacts on the external storage
  6. sends the exports of address books and calenders, log files and this script via e-mail to a defined e-mail address in a single message
  7. checks for a new version of calcardbackup

That sounds very complicated!

You can easily customize the script because it is

  • easy to understand

  • uses variables which you can alter as needed

Can the whole process get automatized?

Of course, you can automatize the hole process by setting up a cron job to trigger kalenderbackup.sh.

Sounds like you created a double backup with the script?

Yes, you are right! A very nice feature is the double layer of security the script provides for your precious address books and calenders,

  • it stores the backup on an external storage

  • it sends the export to a defined e-mail address

so you have TWO backups on TWO separate storages which you can easily restore.

There are many other ways to store your exports on a physically separated device, too. Here are some examples:

What is required to use "kalenderbackup"?

Firstly, you need the most important calcardbackup which is also maintained on codeberg.org → https://codeberg.org/BernieO/calcardbackup

Secondly you have to have a working Mail Transfer Agent (MTA) like Postfix and an e-mail client like mutt installed on you server. Of course you find a detailed manual how to setup both on my website: → E-Mail-Versand für den Raspberry Pi konfigurieren

Are there any security issues?

To be honest, there can be some. But the issues are not really related to the script itself it is more related to the script permissions and you server admins.

The script requires some high permissions,

  • root permissions to mount external storage devices and
  • www-data permissions to call calcardbackup (www-data is needed because that is the users that runs Nextcloud on your server)

To achieve both that we have to use sudo crontab -e.

The high risk is therefore, if an user gains write access to the script, he/she can execute unauthorized commands though the crontab.

Please double check

  • the permissions of the script
  • users who can use sudo or root on your system are setup correctly
  • that personalized accounts for your admins are in use

If you are interested in securing your system in a good way with hardware tokens and certificates, please have a close look at the YubiKey category on my website

https://strobelstefan.org/yubikey/

All good! So how can I install the script?

Gladly, that is very simple!

This is a very short installation instruction. A more detailed one you can find on my website → Nextcloud – Datensicherung von Kalendern und Adressbüchern automatisch erstellen

  1. Make sure all dependencies for your external storage, MTA, etc. are dissolved.

  2. Clone the entire Git repository to your hard disk (optional)

    git clone https://codeberg.org/strobelstefan.org/kalenderbackup.git
    
  3. Create script directory

    sudo mkdir /etc/scripts
    
  4. Copy the script into the newly created directory (depending on point 2)

    cd kalenderbackup
    sudo cp kalenderbackup.sh /etc/scripts
    
  5. cd into that directory

    cd /etc/scripts/
    
  6. Set the correct permissions

    sudo chown root:root kalenderbackup.sh
    sudo chmod 0600 kalenderbackup.sh
    sudo chmod +x kalenderbackup.sh
    
  7. Test run

    sudo ./kalenderbackup.sh
    
  8. Setup a cron job

    # Calender & Address book backup
    00 20 * * * /bin/bash /etc/scripts/kalenderbackup.sh
    

Donation

Do you find the templates helpful, then feel free to buy me a coffee

Donate 😊 Donate 😎

Du findest meine Vorlagen hilfreich, dann kannst du mir gerne einen Kaffee ausgeben


You can find more exciting articles on IT topics on my website www.strobelstefan.org

There you can find more articles about Nextcloud and the popular Raspberry Pi:


⚠️ Disclaimer

EN

The working methods described here are based on my personal experience and my personal thought processes. I do not guarantee the results; trying out and implementing the described procedures is entirely at your own risk and responsibility.

Therefore, please make a backup before making any changes to your system or configuration so that you can restore it if the worst comes to the worst.

DE

Die hier geschilderten Arbeitsweisen basieren auf meiner persönlichen Erfahrung und meinen persönlichen Gedankengängen. Ich übernehme keine Garantie für die Resultate; Ausprobieren und Implementieren der beschriebenen Vorgehensweisen erfolgt ausschließlich auf eigene Verantwortung und Gefahr.

Bitte erstellt deshalb vor jeder Änderung an eurem System oder Konfiguration ein Backup, damit ihr im Fall der Fälle eine Wiederherstellung durchführen könnt.