Skip to content

Conversation

@01rabbit
Copy link
Owner

Summary

  • Forward all Suricata detections directly to OpenCanary without relying on threat scoring or combined control presets
  • Decouple Mock LLM/Ollama analysis into an asynchronous Mattermost notification path
  • Keep only portal/shield style mode changes while scoring remains disabled

Testing

  • python -m pytest tests/core/test_traffic_control.py (fails: missing ensure_nft_table_and_chain helper in azazel_pi.core.enforcer.traffic_control expected by tests)

Codex Task

Changes:
- Disabled nftables service and minimized /etc/nftables.conf
- Migrated NAT rules to iptables (172.16.0.0/24, 172.16.10.0/24 MASQUERADE)
- Updated installer scripts (setup_wireless.sh, install_azazel.sh)
- Converted ai_policy_block.sh from nftables to iptables
- Rewrote azazel_update_dnat.sh to use iptables DNAT
- Deprecated nft_apply.sh with migration notice
- Updated documentation (README.md, README_ja.md, scripts/README.md)
- Added configs/nftables/README.md explaining the migration
- Created iptables_save.sh for rule persistence
- Updated OpenCanary config to use loopback (127.0.0.1:2222, 8081)
- Updated docker-compose.yml to publish OpenCanary ports on all interfaces
- Fixed traffic_control.py to avoid duplicate redirect entries
- Added watch_eve_redirect.py and manual_monitor.sh for testing

This resolves the issue where inet filter/forward policy drop was
blocking Docker container traffic including OpenCanary SSH (port 2222).
Major improvements:
- Fixed DNAT rules to properly redirect SSH (port 22 -> 2222) to OpenCanary container
- Updated OpenCanary IP from loopback (127.0.0.1) to direct container IP (172.16.10.3)
- Added interface specification (-i wlan1) to DNAT rules for external traffic only
- Fixed port translation in iptables DNAT rules (--to-destination 172.16.10.3:2222)
- Moved AI evaluation under notification cooldown control to prevent spam
- Added idempotency check for DNAT redirects to prevent duplicate rules

Technical changes:
1. traffic_control.py: Enhanced _try_add_iptables_dnat() with proper rule format
2. main_suricata.py: Moved notify_ai_analysis_async() inside should_notify() block
3. All config files: Updated canary IP to 172.16.10.3 and port to 2222
4. notify_config.py, delay_action.py: Updated default OpenCanary IP

This ensures:
- Attackers are properly redirected to honeypot regardless of their IP
- Dynamic WAN interface detection via get_active_wan_interface()
- No duplicate notifications/AI evaluations (60s cooldown respected)
- Docker container networking compatibility
@01rabbit 01rabbit closed this Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants