Skip to content

Commit 43839e0

Browse files
authored
Update USAGE_GUIDE.md
1 parent f2b4bab commit 43839e0

1 file changed

Lines changed: 28 additions & 8 deletions

File tree

USAGE_GUIDE.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,24 @@ sudo ./apotropaios.sh --backend nftables add-rule --dst-port 80 --action accept
5959

6060
## Interactive Menu Mode
6161

62-
Launch with `sudo ./apotropaios.sh` or `sudo ./apotropaios.sh menu`.
62+
Launch the interactive menu using the `--interactive` flag:
63+
64+
```bash
65+
sudo ./apotropaios.sh --interactive # Preferred — explicit interactive mode
66+
sudo ./apotropaios.sh --interactive --backend iptables # Pre-select backend
67+
sudo ./apotropaios.sh --interactive --log-level trace # Debug mode
68+
```
69+
70+
**Backward compatibility:** `sudo ./apotropaios.sh menu` and `sudo ./apotropaios.sh` (no arguments) also launch the interactive menu.
71+
72+
**Mutual exclusivity:** The `--interactive` flag cannot be combined with CLI commands (e.g., `--interactive add-rule` is an error) or `--non-interactive`.
6373

6474
The main menu presents numbered options. Enter the number and press Enter.
6575

6676
**Main Menu Options:**
6777

6878
1. **Firewall Management** — Select and configure firewall backends. Start, stop, reload, reset firewalls. View current rules and status. Backend-specific configuration submenus.
69-
2. **Rule Management** — Create rules through a 5-step guided wizard. List, remove, activate, deactivate tracked rules. Import/export rule configurations. Rule expiry watcher.
79+
2. **Rule Management** — Create rules through a 5-step guided wizard with cancel support (type `q`, `quit`, `cancel`, or `back` at any prompt to abort without applying). List, remove, activate, deactivate tracked rules. Import/export rule configurations. Rule expiry watcher.
7080
3. **Quick Actions** — One-click block-all or allow-all traffic with automatic restore point creation.
7181
4. **Backup & Recovery** — Create timestamped backups, list available backups, restore from backup, manage immutable snapshots.
7282
5. **System Information** — View detected OS, installed firewalls, framework status, active log file.
@@ -379,13 +389,23 @@ sudo ./apotropaios.sh add-rule --protocol tcp --dst-port 8080 --action accept \
379389

380390
TTL range: 60 seconds (1 minute) to 2,592,000 seconds (30 days).
381391

392+
### Automatic Expiry Monitoring
393+
394+
In interactive mode, a **background expiry monitor** runs every 30 seconds and automatically deactivates rules when their TTL expires — no manual intervention required. The monitor also writes proactive terminal alerts when a rule is within 10 minutes of expiring, showing the rule ID, description, and time remaining.
395+
396+
Additionally, the **main menu displays inline warnings** for near-expiry and expired rules every time it renders, with guidance to extend timers via the Rule Expiry Watcher.
397+
398+
In CLI mode, `rule_check_expired` runs once at startup. For ongoing CLI-only use, schedule periodic checks via cron: `*/5 * * * * /usr/local/bin/apotropaios check-expired 2>/dev/null`.
399+
382400
### Expiry Watcher
383401

384-
The interactive menu includes a **Rule Expiry Watcher** (Rule Management > View rule expiry) that displays:
402+
The interactive menu includes a **Rule Expiry Watcher** (Rule Management > Rule expiry watcher) that displays:
385403

386-
- Color-coded time remaining (green > 50%, yellow > 20%, red < 20%)
404+
- Color-coded time remaining (green > 30min, yellow < 30min, red < 10min)
405+
- `** EXPIRING SOON **` alert for rules within 10 minutes
406+
- `** EXPIRED **` for overdue rules
387407
- Option to extend TTL on expiring rules
388-
- Automatic cleanup of expired rules on framework startup
408+
- Option to process all expired rules immediately
389409

390410
---
391411

@@ -395,15 +415,15 @@ Each firewall backend has a dedicated configuration submenu accessible via **Fir
395415

396416
### iptables (7 options)
397417

398-
Check/view/save/restore iptables configuration, show table summary, view chain policies.
418+
Check/view/save/restore iptables configuration, show rules in a selected table (filter/nat/mangle/raw/security), show chain policies across all tables, view full ruleset for all tables.
399419

400420
### nftables (5 options)
401421

402422
Check/view/save nftables configuration, list tables, list chains.
403423

404-
### firewalld (6 options)
424+
### firewalld (8 options)
405425

406-
Show default zone, list all zones, list active zones, list services, list rich rules, compare runtime vs permanent configuration.
426+
Show default zone, list all zones, list active zones, list services in a selected zone, show rich rules in a selected zone, show full zone configuration, compare runtime vs permanent configuration for a selected zone, change default zone. All zone-specific queries present a dynamic zone selection menu.
407427

408428
### ufw (9 options)
409429

0 commit comments

Comments
 (0)