-
Notifications
You must be signed in to change notification settings - Fork 1
Fix/remove conflict markers #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,251 @@ | ||
| >>>>>> main | ||
| <div align="center"> | ||
|
|
||
| - **Issues**: [GitHub Issues](https://github.com/TimInTech/Pi-hole-Unbound-PiAlert-Setup/issues) | ||
| - **Discussions**: [GitHub Discussions](https://github.com/TimInTech/Pi-hole-Unbound-PiAlert-Setup/discussions) | ||
| - **Documentation**: This README and inline code comments | ||
| # 🛡️ Pi-hole + Unbound + NetAlertX | ||
| ### **One-Click DNS Security & Monitoring Stack** | ||
|
|
||
| [](https://github.com/TimInTech/Pi-hole-Unbound-PiAlert-Setup/actions) | ||
| [](LICENSE) | ||
| [](https://pi-hole.net/) | ||
| [](https://nlnetlabs.nl/projects/unbound/) | ||
| [](https://github.com/jokob-sk/NetAlertX) | ||
| [](https://debian.org/) | ||
| [](https://python.org/) | ||
|
|
||
| **🧰 Tech Stack** | ||
| <img src="https://skillicons.dev/icons?i=linux,debian,ubuntu,raspberrypi,bash,python,fastapi,sqlite,docker" alt="Tech Stack" /> | ||
|
|
||
| **🌐 Languages:** 🇬🇧 English (this file) • [🇩🇪 Deutsch](README.de.md) | ||
|
|
||
| </div> | ||
|
|
||
| --- | ||
|
|
||
| ## ✨ Features | ||
|
|
||
| ✅ **One-Click Installation** - Single command setup | ||
| ✅ **DNS Security** - Pi-hole + Unbound with DNSSEC | ||
| ✅ **Network Monitoring** - NetAlertX device tracking | ||
| ✅ **API Monitoring** - Python FastAPI + SQLite | ||
| ✅ **Production Ready** - Systemd hardening & auto-restart | ||
| ✅ **Idempotent** - Safe to re-run anytime | ||
|
|
||
| --- | ||
|
|
||
| ## ⚡ Quickstart | ||
|
|
||
| ```bash | ||
| git clone https://github.com/TimInTech/Pi-hole-Unbound-PiAlert-Setup.git | ||
| cd Pi-hole-Unbound-PiAlert-Setup | ||
| chmod +x install.sh | ||
| sudo ./install.sh | ||
| ```` | ||
|
|
||
| **Done!** 🎉 Your complete DNS security stack is now running. | ||
|
|
||
| --- | ||
|
|
||
| ## 🧰 What’s Installed | ||
|
|
||
| | Component | Purpose | Access | | ||
| | ----------------- | ------------------------- | ------------------------ | | ||
| | **🕳️ Pi-hole** | DNS ad-blocker & web UI | `http://[your-ip]/admin` | | ||
| | **🔐 Unbound** | Recursive DNS + DNSSEC | `127.0.0.1:5335` | | ||
| | **📡 NetAlertX** | Network device monitoring | `http://[your-ip]:20211` | | ||
| | **🐍 Python API** | Monitoring & stats API | `http://127.0.0.1:8090` | | ||
|
|
||
| --- | ||
|
|
||
| ## 🗺️ Architecture | ||
|
|
||
| ``` | ||
| ┌─────────────┐ ┌──────────────┐ ┌─────────────┐ | ||
| │ Clients │───▶│ Pi-hole │───▶│ Unbound │ | ||
| │ 192.168.x.x │ │ :53 │ │ :5335 │ | ||
| └─────────────┘ └──────┬───────┘ └─────────────┘ | ||
| │ │ | ||
| ▼ ▼ | ||
| ┌─────────────┐ ┌─────────────┐ | ||
| │ NetAlertX │ │ Root Servers│ | ||
| │ :20211 │ │ + Quad9 │ | ||
| └─────────────┘ └─────────────┘ | ||
| │ | ||
| ▼ | ||
| ┌─────────────┐ | ||
| │ Python API │ | ||
| │ :8090 │ | ||
| └─────────────┘ | ||
| ``` | ||
|
|
||
| **Data Flow:** | ||
|
|
||
| 1. **Clients** → Pi-hole (DNS filtering) | ||
| 2. **Pi-hole** → Unbound (recursive resolution) | ||
| 3. **Unbound** → Root servers (DNSSEC validation) | ||
| 4. **NetAlertX** → Network monitoring | ||
| 5. **Python API** → Aggregated monitoring data | ||
|
|
||
| --- | ||
|
|
||
| ## 🔌 API Reference | ||
|
|
||
| ### Authentication | ||
|
|
||
| All endpoints require the `X-API-Key` header: | ||
|
|
||
| ```bash | ||
| curl -H "X-API-Key: your-api-key" http://127.0.0.1:8090/endpoint | ||
| ``` | ||
|
|
||
| ### Endpoints | ||
|
|
||
| #### `GET /health` | ||
|
|
||
| ```json | ||
| { | ||
| "ok": true, | ||
| "message": "Pi-hole Suite API is running", | ||
| "version": "1.0.0" | ||
| } | ||
| ``` | ||
|
|
||
| #### `GET /dns?limit=50` | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "timestamp": "Dec 21 10:30:45", | ||
| "client": "192.168.1.100", | ||
| "query": "example.com", | ||
| "action": "query" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| #### `GET /devices` | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "id": 1, | ||
| "ip": "192.168.1.100", | ||
| "mac": "aa:bb:cc:dd:ee:ff", | ||
| "hostname": "laptop", | ||
| "last_seen": "2024-12-21 10:30:00" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| #### `GET /stats` | ||
|
|
||
| ```json | ||
| { | ||
| "total_dns_logs": 1250, | ||
| "total_devices": 15, | ||
| "recent_queries": 89 | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🛠️ Optional Manual Steps | ||
|
|
||
| ### Pi-hole | ||
|
|
||
| 1. Open `http://[your-ip]/admin` | ||
| 2. Go to **Settings → DNS** | ||
| 3. Verify **Custom upstream**: `127.0.0.1#5335` | ||
| 4. Configure devices to use Pi-hole as DNS server | ||
|
|
||
| ### NetAlertX | ||
|
|
||
| * Dashboard: `http://[your-ip]:20211` | ||
| * Configure scan schedules and notifications | ||
| * Review network topology and device list | ||
|
|
||
| --- | ||
|
|
||
| ## 🧪 Health Checks & Troubleshooting | ||
|
|
||
| ### Quick Checks | ||
|
|
||
| ```bash | ||
| dig @127.0.0.1 -p 5335 example.com # Test Unbound | ||
| pihole status # Test Pi-hole | ||
| docker logs netalertx # Test NetAlertX | ||
| curl -H "X-API-Key: $SUITE_API_KEY" http://127.0.0.1:8090/health # Test API | ||
| ``` | ||
|
|
||
| ### Service Management | ||
|
|
||
| ```bash | ||
| systemctl status pihole-suite unbound pihole-FTL | ||
| journalctl -u pihole-suite -f | ||
| journalctl -u unbound -f | ||
| docker ps | ||
| ``` | ||
|
|
||
| ### Common Issues | ||
|
|
||
| | Issue | Solution | | ||
| | ----------------------- | -------------------------------------------------- | | ||
| | **Port 53 in use** | `sudo systemctl stop systemd-resolved` | | ||
| | **Missing API key** | Check `.env` file or regenerate with installer | | ||
| | **Database errors** | Run `python scripts/bootstrap.py` | | ||
| | **Unbound won’t start** | Inspect `/etc/unbound/unbound.conf.d/pi-hole.conf` | | ||
|
|
||
| --- | ||
|
|
||
| ## 🧯 Security Notes | ||
|
|
||
| ### 🔐 API Security | ||
|
|
||
| * Auto-generated API keys (16-byte hex) | ||
| * CORS restricted to localhost | ||
| * Authentication required for all endpoints | ||
|
|
||
| ### 🛡️ Systemd Hardening | ||
|
|
||
| * **NoNewPrivileges** prevents escalation | ||
| * **ProtectSystem=strict** read-only protection | ||
| * **PrivateTmp** isolated temp dirs | ||
| * **Memory limits** to prevent exhaustion | ||
|
|
||
| ### 🔒 Network Security | ||
|
|
||
| * Unbound bound to localhost only | ||
| * DNS over TLS to upstream resolvers | ||
| * DNSSEC validation enabled | ||
|
|
||
| --- | ||
|
|
||
| ## 🤝 Contributing | ||
|
|
||
| 1. **Fork** the repository | ||
| 2. **Create** a feature branch: `git checkout -b feature/amazing-feature` | ||
| 3. **Commit** changes: `git commit -m 'feat: add amazing feature'` | ||
| 4. **Run tests**: `ruff check . && pytest` | ||
| 5. **Push** and create a Pull Request | ||
|
|
||
| --- | ||
|
|
||
| ## 📜 License | ||
|
|
||
| This project is licensed under the **MIT License** - see [LICENSE](LICENSE). | ||
|
|
||
| --- | ||
|
|
||
| ## 📈 Changelog | ||
|
|
||
| See [CHANGELOG.md](CHANGELOG.md) for history and updates. | ||
|
|
||
| --- | ||
|
|
||
| <div align="center"> | ||
|
|
||
| **Made with ❤️ for the Pi-hole community** | ||
|
|
||
| [🐛 Report Bug](https://github.com/TimInTech/Pi-hole-Unbound-PiAlert-Setup/issues) • | ||
| [✨ Request Feature](https://github.com/TimInTech/Pi-hole-Unbound-PiAlert-Setup/issues) • | ||
| [💬 Discussions](https://github.com/TimInTech/Pi-hole-Unbound-PiAlert-Setup/discussions) | ||
|
|
||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| """FastAPI API module.""" | ||
| """API package for the Pi-hole suite.""" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security (curl-auth-header): Ein potenzielles Autorisierungstoken wurde in einem Curl-Befehlsheader entdeckt, was die über Curl aufgerufene Ressource kompromittieren könnte.
Quelle: gitleaks
Original comment in English
security (curl-auth-header): Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
Source: gitleaks