|
| 1 | +# NetAlertX Installation Guide for Proxmox VE |
| 2 | + |
| 3 | +## Quick Start (ProxmoxVE LXC Container) |
| 4 | + |
| 5 | +To create a NetAlertX LXC container on Proxmox VE, run this command on your Proxmox host: |
| 6 | + |
| 7 | +```bash |
| 8 | +bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/netalertx.sh)" |
| 9 | +``` |
| 10 | + |
| 11 | +This will: |
| 12 | +- Create a Debian 13 LXC container |
| 13 | +- Install all dependencies automatically |
| 14 | +- Configure NetAlertX with NGINX on port 20211 |
| 15 | +- Start the service automatically |
| 16 | + |
| 17 | +### Update Existing Installation |
| 18 | + |
| 19 | +To update an existing NetAlertX container: |
| 20 | + |
| 21 | +```bash |
| 22 | +bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/netalertx.sh)" -s update |
| 23 | +``` |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Installation Process Overview |
| 28 | + |
| 29 | +### 1. **System Preparation** |
| 30 | +- Updates system packages |
| 31 | + |
| 32 | +### 2. **Dependency Installation** |
| 33 | +- Installs NGINX web server |
| 34 | +- Installs Python 3 and development tools |
| 35 | +- Installs network scanning tools (nmap, arp-scan, fping, etc.) |
| 36 | +- Installs system utilities (sqlite3, dnsutils, avahi-daemon, etc.) |
| 37 | + |
| 38 | +### 3. **Application Setup** |
| 39 | +- Clones NetAlertX repository to `/app` |
| 40 | +- Creates Python virtual environment at `/opt/netalertx-env` |
| 41 | +- Installs Python dependencies from requirements.txt |
| 42 | +- Configures NGINX with default port 20211 |
| 43 | + |
| 44 | +### 4. **File Structure Creation** |
| 45 | +- Creates persistent directories for `/app/log` and `/app/api` |
| 46 | +- Creates log files and plugin directories |
| 47 | +- Copies initial database and configuration files |
| 48 | +- Sets secure file permissions (www-data user/group) |
| 49 | +- Configures systemd RuntimeDirectory (`/run/netalertx`) for volatile service files |
| 50 | + |
| 51 | +### 5. **Service Configuration** |
| 52 | +- Creates startup script at `/app/start.netalertx.sh` |
| 53 | +- Installs systemd service (`netalertx.service`) |
| 54 | +- Enables auto-start on boot |
| 55 | +- Starts NetAlertX and NGINX services |
| 56 | + |
| 57 | +### 6. **Hardware Vendor Database** |
| 58 | +- Updates IEEE OUI database for MAC address vendor identification (if not present) |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Post-Installation |
| 63 | + |
| 64 | +### Accessing NetAlertX |
| 65 | + |
| 66 | +After successful installation, access the web interface at: |
| 67 | + |
| 68 | +``` |
| 69 | +http://YOUR_SERVER_IP:YOUR_PORT |
| 70 | +``` |
| 71 | + |
| 72 | +**Default port**: 20211 |
| 73 | + |
| 74 | +To find your server IP: |
| 75 | +```bash |
| 76 | +ip -4 route get 1.1.1.1 | awk '{for(i=1;i<=NF;i++) if ($i=="src") {print $(i+1); exit}}' |
| 77 | +``` |
| 78 | + |
| 79 | +### Service Management |
| 80 | + |
| 81 | +```bash |
| 82 | +# Check service status |
| 83 | +systemctl status netalertx.service |
| 84 | + |
| 85 | +# View real-time logs |
| 86 | +journalctl -u netalertx.service -f |
| 87 | + |
| 88 | +# Restart service |
| 89 | +systemctl restart netalertx.service |
| 90 | + |
| 91 | +# Stop service |
| 92 | +systemctl stop netalertx.service |
| 93 | +``` |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## Important File Locations |
| 98 | + |
| 99 | +| Component | Location | |
| 100 | +|-----------|----------| |
| 101 | +| Installation Directory | `/app` | |
| 102 | +| Configuration File | `/app/config/app.conf` | |
| 103 | +| Database File | `/app/db/app.db` | |
| 104 | +| NGINX Configuration | `/etc/nginx/conf.d/netalertx.conf` | |
| 105 | +| Web UI (symlink) | `/var/www/html/netalertx` → `/app/front` | |
| 106 | +| Python Virtual Env | `/opt/netalertx-env` | |
| 107 | +| Systemd Service | `/etc/systemd/system/netalertx.service` | |
| 108 | +| Startup Script | `/app/start.netalertx.sh` | |
| 109 | +| Application Logs | `/app/log/` (persistent) | |
| 110 | +| API Files | `/app/api/` (persistent) | |
| 111 | +| Service Runtime | `/run/netalertx/` (tmpfs, systemd-managed) | |
| 112 | + |
| 113 | +### Storage Strategy (Hybrid Approach) |
| 114 | + |
| 115 | +**Persistent Storage** (survives reboots): |
| 116 | +- `/app/log/app.log` - Main application log |
| 117 | +- `/app/log/execution_queue.log` - Task execution log |
| 118 | +- `/app/log/app_front.log` - Frontend log |
| 119 | +- `/app/log/app.php_errors.log` - PHP error log |
| 120 | +- `/app/log/stderr.log` - Standard error output |
| 121 | +- `/app/log/stdout.log` - Standard output |
| 122 | +- `/app/log/db_is_locked.log` - Database lock log |
| 123 | +- `/app/api/user_notifications.json` - User notification data |
| 124 | + |
| 125 | +**Volatile Storage** (tmpfs, cleared on reboot): |
| 126 | +- `/run/netalertx/` - Systemd-managed runtime directory for service temporary files |
| 127 | + |
| 128 | +Systemd service logs are always available via: `journalctl -u netalertx.service` |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +## Environment Variables |
| 133 | + |
| 134 | +The installation script supports the following environment variables: |
| 135 | + |
| 136 | +| Variable | Description | Default | |
| 137 | +|----------|-------------|---------| |
| 138 | +| `NETALERTX_ASSUME_YES` | Skip all interactive prompts | (not set) | |
| 139 | +| `ASSUME_YES` | Alternative to NETALERTX_ASSUME_YES | (not set) | |
| 140 | +| `PORT` | HTTP port for web interface | 20211 | |
| 141 | +| `NETALERTX_FORCE` | Force installation without prompts | (not set) | |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## Security Considerations |
| 146 | + |
| 147 | +- **Runtime directory**: Systemd manages `/run/netalertx/` as tmpfs with `noexec,nosuid,nodev` flags |
| 148 | +- **File permissions**: Application files restricted to `www-data` user/group only (mode 0750) |
| 149 | +- **Service isolation**: Runs as unprivileged `www-data` user |
| 150 | +- **Automatic restart**: Service configured to restart on failure |
| 151 | +- **Persistent logs**: Application logs survive reboots for debugging and audit trails |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## Additional Resources |
| 156 | + |
| 157 | +- **GitHub Repository**: https://github.com/jokob-sk/NetAlertX |
| 158 | +- **Issue Tracker**: https://github.com/jokob-sk/NetAlertX/issues |
| 159 | +- **Documentation**: `/app/docs/` directory |
0 commit comments