|
1 | | -# cod4x-web-rcon-tool |
2 | | -A modern, lightweight PHP web tool for managing Call of Duty 4x servers (CoD4X). Includes RCON command control, player management, bans, logs, multi-server support, first-time installer, secure auth, and clean UI. |
| 1 | +# CoD4X Web RCON Tool |
| 2 | + |
| 3 | +A lightweight, single-folder PHP RCON web tool for Call of Duty 4x servers. |
| 4 | + |
| 5 | +- Send RCON commands from a browser |
| 6 | +- Saved servers (name/IP/port/RCON) with per‑server logs |
| 7 | +- Kick / tempban / permaban players via `clientKick`, `tempBanClient`, and `banClient` |
| 8 | +- Simple website‑managed ban list backed by `config/bans.json` and mirrored to `rcon_logs/banlist.log` |
| 9 | +- Auth system with JSON‑backed users, login throttling, and admin / mod roles |
| 10 | + |
| 11 | +> **Status:** First public GitHub release (v1.0.0). Tool is designed to be dropped into `/var/www/html/rcon` on a typical Apache + PHP stack. |
| 12 | +
|
| 13 | +--- |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +### RCON Control |
| 18 | +- Select a saved server or manually type IP / port / RCON |
| 19 | +- Execute any RCON command |
| 20 | +- View raw RCON response in the browser |
| 21 | + |
| 22 | +### Player Management |
| 23 | +- Kick a player by slot |
| 24 | +- Tempban via `tempBanClient <slot> <seconds>` |
| 25 | +- Permanent ban via `banClient <slot>` |
| 26 | + |
| 27 | +All actions are logged to `rcon_logs/` (and per‑server subfolders when a saved server is used). |
| 28 | + |
| 29 | +### Logs Tab |
| 30 | +- View tail of auth, commands, kicks, tempbans, bans, etc. |
| 31 | +- Switch **scope** between: |
| 32 | + - **Global logs** (`rcon_logs/*.log`) |
| 33 | + - **Per‑server logs** (`rcon_logs/servers/<serverId>/*.log`) when a saved server is selected |
| 34 | + |
| 35 | +### Website Ban List |
| 36 | +- Bans page lets you: |
| 37 | + - View current website‑managed bans from `config/bans.json` |
| 38 | + - Unban by **GUID** or **Ban ID** |
| 39 | +- Bans are also mirrored to `rcon_logs/banlist.log` for auditing. |
| 40 | + |
| 41 | +### Users & Roles |
| 42 | +- Users stored in `config/users.json` |
| 43 | +- Supports: |
| 44 | + - **Admins**: full control; can see and edit RCON passwords and server list |
| 45 | + - **Moderators**: can use the panel without seeing raw RCON passwords |
| 46 | +- Login protection: |
| 47 | + - Throttling after too many failures |
| 48 | + - Logs login success/failure to `rcon_logs/auth.log` |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## Requirements |
| 53 | + |
| 54 | +- PHP 7.4+ (no external libraries required) |
| 55 | +- Apache or Nginx with PHP‑FPM |
| 56 | +- CoD4x server(s) reachable from the webserver |
| 57 | +- HTTPS strongly recommended (panel is security‑sensitive) |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## Installation |
| 62 | + |
| 63 | +1. **Copy files** |
| 64 | + |
| 65 | + ```bash |
| 66 | + sudo mkdir -p /var/www/html/rcon |
| 67 | + sudo cp -r . /var/www/html/rcon |
| 68 | + sudo chown -R www-data:www-data /var/www/html/rcon |
| 69 | + sudo chmod -R 750 /var/www/html/rcon |
| 70 | + ``` |
| 71 | + |
| 72 | +2. **Config & logs directories** |
| 73 | + |
| 74 | + ```bash |
| 75 | + sudo -u www-data mkdir -p /var/www/html/rcon/config /var/www/html/rcon/rcon_logs |
| 76 | + ``` |
| 77 | + |
| 78 | +3. **Create real config from examples** |
| 79 | + |
| 80 | + ```bash |
| 81 | + cd /var/www/html/rcon/config |
| 82 | + sudo -u www-data cp users.json.example users.json |
| 83 | + sudo -u www-data cp servers.json.example servers.json |
| 84 | + sudo -u www-data cp bans.json.example bans.json |
| 85 | + |
| 86 | + sudo chmod 640 /var/www/html/rcon/config/*.json |
| 87 | + ``` |
| 88 | + |
| 89 | + - Default login (first‑run) is: |
| 90 | + |
| 91 | + - **Username:** `admin` |
| 92 | + - **Password:** `changeme` |
| 93 | + |
| 94 | + Change this immediately after logging in. |
| 95 | + |
| 96 | +4. **Apache (example)** |
| 97 | + |
| 98 | + Make sure your VirtualHost points to `/var/www/html/rcon` and PHP is enabled. Example: |
| 99 | + |
| 100 | + ```apacheconf |
| 101 | + <VirtualHost *:80> |
| 102 | + ServerName yourpanel.example.com |
| 103 | + DocumentRoot /var/www/html/rcon |
| 104 | +
|
| 105 | + <Directory /var/www/html/rcon> |
| 106 | + AllowOverride All |
| 107 | + Require all granted |
| 108 | + </Directory> |
| 109 | + </VirtualHost> |
| 110 | + ``` |
| 111 | + |
| 112 | + Then: |
| 113 | + |
| 114 | + ```bash |
| 115 | + sudo a2enmod rewrite |
| 116 | + sudo systemctl reload apache2 |
| 117 | + ``` |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## Usage |
| 122 | + |
| 123 | +1. Browse to the panel’s URL (e.g. `http://yourpanel.example.com`). |
| 124 | +2. Log in with the admin account. |
| 125 | +3. Go to **Users** and update the admin password (and/or create more users). |
| 126 | +4. Go to **Servers** and: |
| 127 | + - Add each CoD4x server by name, host/IP, port, and RCON password. |
| 128 | +5. Use the **Control** tab to: |
| 129 | + - Select a saved server |
| 130 | + - Send RCON commands |
| 131 | + - Kick / tempban / ban players from the live player list |
| 132 | +6. Use the **Logs** tab to monitor auth, commands, kicks, and bans. |
| 133 | +7. Use the **Bans** tab to manage website‑stored bans. |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +## Security Notes |
| 138 | + |
| 139 | +- **Always use HTTPS** in production. |
| 140 | +- Restrict access: |
| 141 | + - IP‑whitelist the panel if possible (e.g. only your home/office). |
| 142 | + - Or put it behind a VPN. |
| 143 | +- Change the default admin password on first login. |
| 144 | +- Keep `config/` and `rcon_logs/` owned by the web user (e.g. `www-data`) and not world‑readable. |
| 145 | +- Never expose this panel directly to the public internet without additional protections. |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## Development |
| 150 | + |
| 151 | +This project is intentionally simple: |
| 152 | + |
| 153 | +- No database – all state is JSON (`config/*.json`) and text logs (`rcon_logs/*.log`). |
| 154 | +- No frameworks – plain PHP and a single CSS file in `assets/`. |
| 155 | + |
| 156 | +If you want to hack on it: |
| 157 | + |
| 158 | +- Start a PHP built‑in server: |
| 159 | + |
| 160 | + ```bash |
| 161 | + php -S 127.0.0.1:8080 -t . |
| 162 | + ``` |
| 163 | + |
| 164 | +- Point your browser at `http://127.0.0.1:8080/login.php`. |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## Roadmap / Ideas |
| 169 | + |
| 170 | +- Optional 2FA for admin accounts |
| 171 | +- Per‑user permissions (e.g. ban‑only mods) |
| 172 | +- JSON export/import for bans |
| 173 | +- Dark theme toggle |
| 174 | +- Dockerfile for one‑command deployment |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +## License |
| 179 | + |
| 180 | +Released under the **MIT License**. See [`LICENSE`](LICENSE) for details. |
0 commit comments