Add an HTTPS installer for the OPNsense agent and show its command in the WebUI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 09:25:51 +01:00
co-authored by Claude Opus 5.5
parent 20bf40adce
commit 7201b18300
9 changed files with 468 additions and 10 deletions
+9 -4
View File
@@ -165,7 +165,7 @@ test('shows the execution stop and prepares the Windows restart through a versio
expect(writes).toHaveLength(2);
});
test('offers one Linux command for x86-64 and ARM64, a root command for Proxmox VE and keeps the code outside all installer commands', async ({ page }) => {
test('offers one Linux command for x86-64 and ARM64, root commands for Proxmox VE and OPNsense and keeps the code outside all installer commands', async ({ page }) => {
const token = 'f'.repeat(64), api = '/api/v1/tenants/' + tenantId;
const requests: string[] = [];
await page.route(origin + '/auth/config', r => r.fulfill({ json: { dev_login_enabled: true, oidc_configured: false, oidc_login_url: null } }));
@@ -176,7 +176,8 @@ test('offers one Linux command for x86-64 and ARM64, a root command for Proxmox
if (url.pathname === '/api/v1/tenants') return r.fulfill({ json: listing(auth.tenants) });
if (url.pathname === api + '/enrollment-tokens') return r.fulfill({ json: {
token, expires_at: new Date(Date.now() + 900000).toISOString(), bootstrap_origin: 'https://bootstrap.example',
release_platforms: ['x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'x86_64-pc-windows-gnu']
release_platforms: ['x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'x86_64-pc-windows-gnu'],
opnsense_installer: true
} });
return r.fulfill({ json: { ...listing([]), pending_count: 0 } });
});
@@ -187,16 +188,20 @@ test('offers one Linux command for x86-64 and ARM64, a root command for Proxmox
await enroll.getByRole('button', { name: 'Einmalcode erstellen' }).click();
await expect(enroll.getByRole('heading', { name: 'Linux (x86-64 und ARM64)' })).toBeVisible();
const commands = enroll.locator('pre');
await expect(commands).toHaveCount(3);
await expect(commands).toHaveCount(4);
await expect(commands.nth(0)).toContainText("&& sudo sh linux.sh 'https://bootstrap.example'");
await expect(enroll.getByRole('heading', { name: 'Proxmox VE' })).toBeVisible();
await expect(commands.nth(1)).toHaveText("curl --fail --show-error --silent 'https://bootstrap.example/install/linux.sh' -o linux.sh && sh linux.sh 'https://bootstrap.example'");
await expect(enroll.getByRole('heading', { name: 'OPNsense' })).toBeVisible();
await expect(commands.nth(2)).toHaveText("fetch -o opnsense.sh 'https://bootstrap.example/install/opnsense.sh' && sh opnsense.sh 'https://bootstrap.example'");
expect((await commands.allTextContents()).join(' ')).not.toMatch(/enable-admin-scripts|EnableAdministratorScripts/);
await option.check();
await expect(commands.nth(0)).toContainText('--enable-admin-scripts');
await expect(commands.nth(1)).toContainText("sh linux.sh 'https://bootstrap.example' --enable-admin-scripts");
await expect(commands.nth(1)).not.toContainText('sudo');
await expect(commands.nth(2)).toContainText('-EnableAdministratorScripts');
await expect(commands.nth(2)).not.toContainText('admin');
await expect(enroll.getByText(/Root-Helper/)).toBeVisible();
await expect(commands.nth(3)).toContainText('-EnableAdministratorScripts');
await expect(enroll.getByText(/Für jeden Auftrag gelten zusätzlich/)).toBeVisible();
expect((await commands.allTextContents()).join(' ')).not.toContain(token);
expect(requests).toEqual([api + '/enrollment-tokens']);