]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
backup.pl: Fixes bug#13404 - Clear out OpenVPN certs before doing restore
authorAdolf Belka <adolf.belka@ipfire.org>
Mon, 26 Feb 2024 15:05:01 +0000 (16:05 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 28 Feb 2024 16:40:53 +0000 (16:40 +0000)
- Existing situation is if four new client connections are created and then it is decided
   to restore to an earlier stage the new certficates will be in the certs directory but
   not usable from the WUI page as they are no longer shown in the client connection table
   as that now shows the ones from the restored backup.
- This patch clears the /var/ipfire/ovpn/certs/ directory before restoring the contents
   of the backup so that the certs directory only holds what was in the backup.

Fixes: Bug#13404
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/backup/backup.pl

index 7992f21c58aba352c1c3548c2103b8d2f9ad2d66..b43420740037075b0b76173477333f86f0f8d90d 100644 (file)
@@ -75,6 +75,10 @@ make_backup() {
 restore_backup() {
        local filename="${1}"
 
+       # remove all openvpn certs to prevent old unusable
+       # certificates being left in directory after a restore
+       rm -f /var/ipfire/ovpn/certs/*
+
        # Extract backup
        if ! tar xvzpf "${filename}" -C / \
                        --exclude-from="/var/ipfire/backup/exclude" \