fix(awg2): resolve issue #50 client key generation and install timeout
Issue #50 (AmneziaWG 2.0 / awg2): "Failed to generate client keys" when creating clients, and "Invalid server response" on first install. - VpnClient::generateClientKeys() built its own password-only SSH command (PubkeyAuthentication=no, no sudo), bypassing VpnServer::executeCommand. That broke key-based servers and hosts where docker requires sudo. Route it through executeCommand so SSH-key auth and docker sudo auto-detection apply, matching every other remote operation. - VpnClient::getNextClientIP() read /opt/amnezia/awg/wg0.conf only; AWG2 uses awg0.conf. Read awg0.conf first, fall back to wg0.conf. - deploy route: lift PHP time limit (set_time_limit(0) + ignore_user_abort) so the multi-minute awg2 docker build is not killed mid-request, which produced the truncated, non-JSON "Invalid server response". - migration 070: drop `--no-cache` from the awg2 docker build so layers are reused, making installs and retries fast and idempotent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -568,6 +568,13 @@ Router::post('/servers/{id}/deploy', function ($params) {
|
||||
requireAuth();
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Some protocols (e.g. AmneziaWG 2.0 / awg2) build a Docker image from source
|
||||
// on the remote host, which can take several minutes. Without lifting the PHP
|
||||
// time limit the request is killed mid-build and the browser receives a
|
||||
// truncated, non-JSON body shown as "Invalid server response" (issue #50).
|
||||
@set_time_limit(0);
|
||||
@ignore_user_abort(true);
|
||||
|
||||
$serverId = (int) $params['id'];
|
||||
$rawBody = file_get_contents('php://input');
|
||||
$options = [];
|
||||
|
||||
Reference in New Issue
Block a user