Skip to content

Commit cea30ff

Browse files
committed
Add manual backup and restore
1 parent 65f8698 commit cea30ff

10 files changed

Lines changed: 782 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## v1.6.0
4+
5+
IP Ban Manager 1.6.0 adds manual backup/restore for managed settings and exact bans, and fixes default-deny access when a local Home Assistant hostname resolves to IPv6 link-local instead of IPv4.
6+
7+
### Added
8+
9+
- Added **Export** and **Import** buttons to the live panel. Export writes `/config/ip_ban_manager/ip-ban-manager-backup.yaml`; Import validates and restores that same file manually.
10+
- Added `ip_ban_manager.export_config` and `ip_ban_manager.import_config` services for automations/scripts that want the same manual backup/restore behavior.
11+
- Backup files include IP Ban Manager's managed settings plus a timestamp-preserving copy of Home Assistant's exact IP bans.
12+
13+
### Fixed
14+
15+
- Treats enabled-adapter IPv6 link-local networks as local access paths, so the safe local-network default can include them.
16+
- Keeps enabled-adapter IPv6 link-local access out of managed blocks/default-deny at runtime, matching the behavior users expect when `homeassistant.local` resolves to IPv6 on the same LAN.
17+
318
## v1.5.6
419

520
IP Ban Manager 1.5.6 cleans up the bad nested folder layout left behind by the broken `v1.5.2` package.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ IP Ban Manager turns the original YAML-only allowlist wrapper into a practical m
2929

3030
| Release | Highlights |
3131
| --- | --- |
32+
| **v1.6.0** | Adds manual export/import buttons and services for `/config/ip_ban_manager/ip-ban-manager-backup.yaml`, plus the IPv6 link-local default-deny fix. |
3233
| **v1.5.6** | Deletes the invalid nested `custom_components` folder left behind by the broken `v1.5.2` package layout. |
3334
| **v1.5.5** | Keeps Home Assistant OS add-ons and Supervisor Docker traffic out of managed blocks/default-deny without exposing those internal addresses in Allowed IPs. |
3435
| **v1.5.4** | Corrects default-deny safety validation so Home Assistant's own addresses are protected internally while valid local allowlists are not rejected for unrelated detected adapter paths. |
@@ -81,6 +82,7 @@ Core management features include:
8182
- **Allowed subnet auto-bans:** optional exact automatic bans for failed logins inside allowed IP ranges, useful when a broad trusted carrier/VPN subnet should bypass network blocks but individual bad-login sources should still be banned.
8283
- **Advanced controls:** lockout-sensitive choices are separated from everyday options and marked clearly in the live panel.
8384
- **Emergency disable:** `ip_ban_manager: disabled` or `/config/ip_ban_manager.disabled` lets local file access disable IP Ban Manager if you need a recovery path after a bad setting.
85+
- **Manual backup:** export/import buttons and services write and restore `/config/ip_ban_manager/ip-ban-manager-backup.yaml` after validating the file.
8486
- **Ordering and persistence:** `ip_bans.yaml` rewrites stay oldest-first so new exact bans appear at the bottom, matching Home Assistant's normal file behavior.
8587
- **Notifications:** branded IP Ban Manager login/ban notifications include an embedded compact icon header, direct settings link where action is useful, stale-notification cleanup when bans are removed, optional automatic-ban notification suppression, earlier failed-login capture, and quieter allowlisted-login notifications that can still escalate if a trusted source keeps failing authentication.
8688
- **GeoIP labels:** optional local DB-IP City Lite lookups can show approximate city/country labels for public IPs in notifications and the live panel, with no online lookup during request handling.
@@ -168,6 +170,7 @@ Open **Settings > Devices & services > IP Ban Manager > Configure** to:
168170
- edit **Blocked networks**, one IPv4/IPv6 CIDR network or IPv4 wildcard network per line
169171
- enable **Block everything outside Allowed IPs** for guarded default-deny mode
170172
- enable **GeoIP location labels** and download/update the local DB-IP City Lite database
173+
- export or import a readable backup at `/config/ip_ban_manager/ip-ban-manager-backup.yaml`
171174
- view existing block timestamps as readable local times in **Blocked IPs**
172175
- clear exact bans or managed blocked networks by emptying the matching field and submitting
173176

@@ -183,13 +186,27 @@ The options UI validates edits before changing Home Assistant. It rejects all-In
183186

184187
The live hooks are installed at setup even if the initial allowlist is empty, so adding your first allowed IP later works immediately. If the integration is unloaded, those hooks are restored so Home Assistant is left in its normal state.
185188

189+
## Manual Backup And Restore
190+
191+
The live panel includes **Export** and **Import** buttons in **Options**. Export writes a readable YAML file to:
192+
193+
```text
194+
/config/ip_ban_manager/ip-ban-manager-backup.yaml
195+
```
196+
197+
That file contains IP Ban Manager's managed settings plus a copy of Home Assistant's current exact IP bans from `ip_bans.yaml`. It is not written automatically; use **Export** when you want an offline copy over SMB, SSH, Studio Code Server, or a normal Home Assistant backup.
198+
199+
Import reads the same file, validates the allowlist, blocked networks, exact bans, default-deny safety, and booleans, then applies the settings live. If validation fails, IP Ban Manager rejects the import before changing the running configuration.
200+
186201
The integration also adds services for automations and scripts:
187202

188203
- `ip_ban_manager.add_ip_ban`
189204
- `ip_ban_manager.remove_ip_ban`
190205
- `ip_ban_manager.remove_all_ip_bans`
191206
- `ip_ban_manager.add_allowlist_network`
192207
- `ip_ban_manager.remove_allowlist_network`
208+
- `ip_ban_manager.export_config`
209+
- `ip_ban_manager.import_config`
193210

194211
Adding an IP ban updates Home Assistant's live ban manager and persists to `ip_bans.yaml`. Removing a ban updates the live ban manager, clears any failed-login counter for that IP, and rewrites `ip_bans.yaml`. Clearing every ban requires `confirm: true`.
195212

0 commit comments

Comments
 (0)