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:
+14
-4
@@ -194,7 +194,7 @@ function AgentReleaseCatalog({ tenantId, auth }: { tenantId: string; auth: Sessi
|
||||
}
|
||||
|
||||
function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string; auth: Session; customerName: string }) {
|
||||
const [enrollment, setEnrollment] = useState<{ token: string; expires: string; origin: string | null; platforms: string[] } | null>(null);
|
||||
const [enrollment, setEnrollment] = useState<{ token: string; expires: string; origin: string | null; platforms: string[]; opnsense: boolean } | null>(null);
|
||||
const [enrollmentError, setEnrollmentError] = useState<string | null>(null);
|
||||
const [issuing, setIssuing] = useState(false);
|
||||
const [copied, setCopied] = useState(false);
|
||||
@@ -209,6 +209,7 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
/** Proxmox VE is Debian on x86-64 and ships without sudo; the installer then runs from a root shell. */
|
||||
const proxmoxInstaller = linuxInstaller && enrollment?.platforms.includes('x86_64-unknown-linux-gnu') ? linuxInstaller : null;
|
||||
const adminFlag = adminScripts ? ' --enable-admin-scripts' : '';
|
||||
const opnsenseInstaller = origin && enrollment?.opnsense ? `${origin}/install/opnsense.sh` : null;
|
||||
const windowsPlatforms = ['x86_64-pc-windows-gnu', 'x86_64-pc-windows-msvc'].filter(platform => enrollment?.platforms.includes(platform));
|
||||
const windowsInstaller = origin && windowsPlatforms.length > 0 ? `${origin}/install/windows.ps1` : null;
|
||||
return <section aria-label="Gerät aufnehmen"><h2>Gerät aufnehmen</h2>
|
||||
@@ -220,6 +221,7 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
if (typeof result.token !== 'string' || !/^[a-f0-9]{64}$/.test(result.token) || typeof result.expires_at !== 'string') throw new Error('Ungültiger Einmalcode');
|
||||
const bootstrap = typeof result.bootstrap_origin === 'string' ? new URL(result.bootstrap_origin) : null;
|
||||
setEnrollment({ token: result.token, expires: result.expires_at, origin: bootstrap?.protocol === 'https:' ? bootstrap.origin : null,
|
||||
opnsense: result.opnsense_installer === true,
|
||||
platforms: Array.isArray(result.release_platforms) ? result.release_platforms.filter((p): p is string => typeof p === 'string') : [] });
|
||||
} catch (error) { setEnrollmentError(errorText(error)); } finally { setIssuing(false); }
|
||||
}}>Einmalcode erstellen</button>
|
||||
@@ -235,9 +237,9 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
<article>
|
||||
<h3>Installation auf dem neuen Gerät</h3>
|
||||
<ol>
|
||||
<li>Öffnen Sie auf dem neuen Linux-Gerät ein Terminal mit <code>sudo</code>-Rechten, auf einem Proxmox-VE-Host eine Shell als <code>root</code> oder auf dem neuen Windows-Gerät Windows PowerShell 5.1 (64 Bit) als Administrator.</li>
|
||||
<li>Öffnen Sie auf dem neuen Linux-Gerät ein Terminal mit <code>sudo</code>-Rechten, auf einem Proxmox-VE-Host oder einer OPNsense-Firewall eine Shell als <code>root</code> oder auf dem neuen Windows-Gerät Windows PowerShell 5.1 (64 Bit) als Administrator.</li>
|
||||
<li>Führen Sie den passenden Befehlsblock unten aus. Er lädt das Installationsskript per HTTPS vom Server und startet es.</li>
|
||||
<li>Fügen Sie den oben angezeigten Einmalcode ein, sobald das Skript nach <strong>Einmalcode</strong> (Linux) oder <strong>One-time enrollment token</strong> (Windows) fragt. Bestätigen Sie mit Enter. Eine vorherige Passwortabfrage von <code>sudo</code> gehört zur Anmeldung mit Administratorrechten.</li>
|
||||
<li>Fügen Sie den oben angezeigten Einmalcode ein, sobald das Skript nach <strong>Einmalcode</strong> (Linux, Proxmox VE, OPNsense) oder <strong>One-time enrollment token</strong> (Windows) fragt. Bestätigen Sie mit Enter. Eine vorherige Passwortabfrage von <code>sudo</code> gehört zur Anmeldung mit Administratorrechten.</li>
|
||||
<li>Prüfen Sie nach der Installation, ob das neue Gerät unter <a href="#geraete">Geräte</a> beim gewählten Kunden erscheint.</li>
|
||||
</ol>
|
||||
<label className="check"><input type="checkbox" checked={adminScripts} onChange={e => setAdminScripts(e.target.checked)}/>
|
||||
@@ -247,7 +249,7 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
{' '}Für jeden Auftrag gelten zusätzlich die Skript- und Administratorrechte des Kunden und die Genehmigung in der WebUI.</p>}
|
||||
{!enrollment && <p className="muted">Die Downloadlinks und Befehle erscheinen hier, sobald ein Einmalcode angezeigt wird.</p>}
|
||||
{enrollment && !origin && <p role="status">Für die Geräteaufnahme ist keine HTTPS-Downloadadresse konfiguriert.</p>}
|
||||
{origin && !linuxInstaller && !windowsInstaller && <p role="status">Für diesen Kunden ist derzeit kein Linux- oder Windows-Installer verfügbar.</p>}
|
||||
{origin && !linuxInstaller && !windowsInstaller && !opnsenseInstaller && <p role="status">Für diesen Kunden ist derzeit kein Installer verfügbar.</p>}
|
||||
{linuxInstaller && <>
|
||||
<h4>Linux ({availableLinuxArchitectures.join(' und ')})</h4>
|
||||
<p>Installationsskript <a href={linuxInstaller} target="_blank" rel="noopener noreferrer">linux.sh</a></p>
|
||||
@@ -259,6 +261,14 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
{' '}Der Installer richtet zusätzlich einen nur lesenden Proxmox-Zugang für Gäste und Backups ein.</p>
|
||||
<pre>{`curl --fail --show-error --silent '${proxmoxInstaller}' -o linux.sh && sh linux.sh '${origin}'${adminFlag}`}</pre>
|
||||
</>}
|
||||
{opnsenseInstaller && <>
|
||||
<h4>OPNsense</h4>
|
||||
<p>Installationsskript <a href={opnsenseInstaller} target="_blank" rel="noopener noreferrer">opnsense.sh</a>.
|
||||
{' '}Führen Sie den Befehl als <code>root</code> aus, über SSH oder an der Konsole mit Option <strong>8) Shell</strong>.
|
||||
{' '}Der Installer lädt den Agenten, prüft jede Datei gegen die Prüfsumme des Servers, nimmt die Firewall auf und startet den Dienst.
|
||||
{adminScripts && <>{' '}Skripte mit <code>root</code>-Rechten brauchen auf OPNsense zusätzlich den separat eingerichteten Root-Helper; der Installer richtet ihn nicht ein.</>}</p>
|
||||
<pre>{`fetch -o opnsense.sh '${opnsenseInstaller}' && sh opnsense.sh '${origin}'`}</pre>
|
||||
</>}
|
||||
{windowsInstaller && <>
|
||||
<h4>Windows (x64)</h4>
|
||||
<p>Installationsskript <a href={windowsInstaller} target="_blank" rel="noopener noreferrer">windows.ps1</a>{windowsPlatforms.length > 1 && '. Führen Sie einen der beiden Befehlsblöcke aus.'}</p>
|
||||
|
||||
Reference in New Issue
Block a user