|
@@ -6,22 +6,30 @@ Backup and download scripts to compress with:
|
|
|
* XZ (LZMA2)
|
|
|
* 7Z (LZMA)
|
|
|
|
|
|
-The backup script (**backup-server**) compress with 7z server info like:
|
|
|
+The backup script (**backup-server**) backup the following server configuration:
|
|
|
* Web Sites (/var/www)
|
|
|
* SQL Databases (MySQL or MariaDB)
|
|
|
-* HTTP Server Configuration (/etc/nginx)
|
|
|
-* Let's Encrypt Certificates (/etc/letsencrypt)
|
|
|
-* Mail Mailboxes (/var/mail)
|
|
|
+* HTTP Server Configuration (Nginx)
|
|
|
+* Let's Encrypt Certificates
|
|
|
* Home Directory (/home)
|
|
|
-* GOGS Git Repository (/opt/gogs)
|
|
|
+* GOGS Git Repository
|
|
|
+* Mail Mailboxes (/var/mail)
|
|
|
+* Postfix MTA Configuration (SMTP mail server)
|
|
|
+* Dovecot MDA Configuration (POP3/IMAP server)
|
|
|
+* OpenDKIM Configuration (Anti email spoofing)
|
|
|
+* postfix-policyd-spf-python Configuration (Anti email spoofing)
|
|
|
+* OpenDMARC Configuration (Anti email spoofing)
|
|
|
+* Amavis Configuration (Antivirus)
|
|
|
+* SPAM Assasin (AntiSPAM)
|
|
|
|
|
|
Also it's:
|
|
|
* Autoremove old backups
|
|
|
* Set backup dir
|
|
|
* Encrypt backup (gpg2)
|
|
|
+* Create SHA512 Hash (to check integrity)
|
|
|
|
|
|
## Instalation
|
|
|
-`# curl "https://code.castanedo.es/guzman/backup-server/archive/2.0.tar.gz" | tar -xz`
|
|
|
+`# curl "https://code.castanedo.es/guzman/backup-server/archive/2.1.tar.gz" | tar -xz`
|
|
|
|
|
|
`# cp ./backup-server/backup-server /usr/local/bin/backup-server`
|
|
|
|
|
@@ -42,8 +50,9 @@ Edit `/etc/cron.d/backup-server` to automatic backups as desired.
|
|
|
|
|
|
###### Backup Options:
|
|
|
* `-p`, `--prefix name`: prefix for the name of the backup
|
|
|
- * Default: backup-castanedo.es
|
|
|
-* `--no-postfix`: disable the postfi: the full name will be the prefix
|
|
|
+ * Default: backup-'hostname'
|
|
|
+* `--postfix name`: postfix for the name of the backup.
|
|
|
+ * To unset default postfix: `--postfix ""`
|
|
|
* Default: prefix-yyyy-mm-dd(date)-XXXXXX(random)
|
|
|
* `--no-remove`: no remove old files
|
|
|
* Default: false
|
|
@@ -114,7 +123,56 @@ Edit `/etc/cron.d/backup-server` to automatic backups as desired.
|
|
|
* `--no-gogs`: disable gogs backup
|
|
|
* Default: false
|
|
|
|
|
|
+###### Postfix Options:
|
|
|
+* `--postfix-dir dir`: set Postfix configuration directory to backup
|
|
|
+ * Default: /etc/postfix
|
|
|
+* `--no-postfix`: disable Postfix backup
|
|
|
+ * Default: false
|
|
|
+
|
|
|
+###### Dovecot Options:
|
|
|
+* `--dovecot-dir dir`: set Dovecot configuration directory to backup
|
|
|
+ * Default: /etc/dovecot
|
|
|
+* `--no-dovecot`: disable Dovecot backup
|
|
|
+ * Default: false
|
|
|
+
|
|
|
+###### OpenDKIM Options:
|
|
|
+* `--opendkim-conf file`: set OpenDKIM configuration file to backup
|
|
|
+ * Default: /etc/opendkim.conf
|
|
|
+* `--opendkim-default file`: set OpenDKIM socket configuration file to backup
|
|
|
+ * Default: /etc/default/opendkim
|
|
|
+* `--opendkim-keys dir`: set OpenDKIM keys dir to backup
|
|
|
+ * Default: /etc/dkimkeys
|
|
|
+* `--no-opendkim`: disable OpenDKIM backup
|
|
|
+ * Default: false
|
|
|
+
|
|
|
+###### SPF Options:
|
|
|
+* `--spf-dir dir`: set SPF configuration directory to backup
|
|
|
+ * Default: /etc/postfix-policyd-spf-python
|
|
|
+* `--no-spf`: disable SPF backup
|
|
|
+ * Default: false
|
|
|
+
|
|
|
+###### OpenDMARC Options:
|
|
|
+* `--opendmarc-conf file`: set OpenDMARC configuration file to backup
|
|
|
+ * Default: /etc/opendmarc.conf
|
|
|
+* `--opendmarc-default file`: set OpenDMARC socket configuration file to backup
|
|
|
+ * Default: /etc/default/opendmarc
|
|
|
+* `--no-opendmarc`: disable OpenDMARC backup
|
|
|
+ * Default: false
|
|
|
+
|
|
|
+###### Amavis Options:
|
|
|
+* `--amavis-dir dir`: set Amavis configuration directory to backup
|
|
|
+ * Default: /etc/amavis
|
|
|
+* `--no-amavis`: disable Amavis backup
|
|
|
+ * Default: false
|
|
|
+
|
|
|
+###### SPAM Assassin Options:
|
|
|
+* `--spamassassin-dir dir`: set SPAM Assassin configuration directory to backup
|
|
|
+ * Default: /etc/spamassasin
|
|
|
+* `--no-spamassassin`: disable SPAM Assassin backup
|
|
|
+ * Default: false
|
|
|
+
|
|
|
###### Other Options:
|
|
|
+* `--no-sha512`: not calculate SHA512 hash (to check integrity)
|
|
|
* `-h`, `--help`: shows this message and exit
|
|
|
|
|
|
## Examples
|
|
@@ -124,7 +182,7 @@ Edit `/etc/cron.d/backup-server` to automatic backups as desired.
|
|
|
* `backup-server -7 --7z-password 7zpass --sql-user root --sql-password toor /var/www/backup`
|
|
|
* Make a backup in `/var/www/backup` compressed with 7Zip and encrypted (`backup-castanedo.es-2018-03-19-abcedf.7z`)
|
|
|
* `backup-server -z --no-encryption --no-sql /var/backup`
|
|
|
- * Make a backup in `/var/backup` compressed with Gzip and no encrypted (`/var/backup/backup-castanedo.es-2018-03-19-qwerty.tar.gz`)
|
|
|
+ * Make a backup in `/var/backup` compressed with GZip and not encrypted (`backup-castanedo.es-2018-03-19-qwerty.tar.gz`)
|
|
|
|
|
|
## Automatic Backups (Cron.d)
|
|
|
It's possible to make backups automatic creating a cron.d task (`/etc/cron.d/backup-server`).
|
|
@@ -132,6 +190,11 @@ It's possible to make backups automatic creating a cron.d task (`/etc/cron.d/bac
|
|
|
There are an [example](https://code.castanedo.es/guzman/backup-server/src/master/scripts/cron.d/backup-server) in `scripts` folder.
|
|
|
|
|
|
## Download scripts
|
|
|
-The download script (**download-backup-http**) download all the compressed files in a remote machine, via http/https Auth Basic Aunthentication.
|
|
|
+The download script (**download-backup-http**) download all the compressed files in a remote machine, via http/https (with Auth Basic Aunthentication).
|
|
|
|
|
|
The download script (**download-backup-sftp**) download all the compressed files in a remote machine, via sftp (SSH File Transfer Protocol).
|
|
|
+
|
|
|
+### Autodownload
|
|
|
+To autodownload the backups from another machine there are multiple solutions.
|
|
|
+* Create autostart desktop file: to download backup when you login ([examples](https://code.castanedo.es/guzman/backup-server/src/master/scripts/autostart)).
|
|
|
+* Create a cron.d job: to download backups periodically.
|