Network whitelist/blacklist

I run WireGuard on my laptop and tunnel all my traffic to my home network when I’m not at home. I would like to configure Kopia to disable automated snapshots while i’m connected to my WireGuard mesh.

I can do this via firewall rules but Kopia will still try to run at the scheduled times and fail with connectivity issues. Would be nice instead to have Kopia simply not run when the machine is connected to a specific network.

Example: my home network uses 192.168.1.x and mesh uses 192.168.2.x. A network blacklist feature would let me enter 192.168.2.0/24 so that when my IP address is within the 192.168.2.0 subnetwork, Kopia doesn’t run scheduled backups. Or vice versa: whitelist feature so that if I enter 192.168.1.0/24 Kopia will only run scheduled backups when i’m at home.

I use SFTP to backup to a local NAS, so thats the protocol i’d primarily want this feature to apply to, but I imagine this would be useful in general. For example, if backing up to a cloud storage and connected to a low speed/public wifi or a metered connection, you might not want to run backups.

Kopia allows to perform specific actions before and after running backup.

What you want is simple script returning error if you are on network you want to ignore. Run it as a “Before Action” with Command Mode “must succeed”.

1 Like

Managed to get it working (had to do this Before Snapshot Action mode is set to 'must succeed' but snapshot proceeds afterwards - #2 by peter). Thanks for the tip!

2 Likes