Route OPNsense library and custom jobs through the standard order composer
This commit is contained in:
@@ -81,7 +81,7 @@ function resumeTicket(key: string): Ticket | null {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
export async function verifiedScriptOrder(value: unknown, tenantId: string, principal: string) {
|
||||
async function verifiedScriptOrder(value: unknown, tenantId: string, principal: string) {
|
||||
const plan = record(value, 'Auftragsplan');
|
||||
await verifyPlanIntegrity(plan);
|
||||
await verifyScriptPlan(plan);
|
||||
@@ -143,7 +143,7 @@ export function OrderComposer({ tenantId, auth, initialAssetIds, onSubmitted, cu
|
||||
const [libraryIdentity, setLibraryIdentity] = useState<Identity | null>(null);
|
||||
const [linux, setLinux] = useState<Script>(() => emptyScript('posix_sh'));
|
||||
const [windows, setWindows] = useState<Script>(() => emptyScript('powershell'));
|
||||
const [opnsense,setOpnsense] = useState<Script>(() => ({...emptyScript('posix_sh'),execution_identity:'root'}));
|
||||
const [opnsense,setOpnsense] = useState<Script>(() => emptyScript('posix_sh'));
|
||||
const [reason, setReason] = useState('');
|
||||
const [start, setStart] = useState(() => localDate(Date.now()));
|
||||
const [end, setEnd] = useState(() => localDate(Date.now() + 3600000));
|
||||
@@ -236,8 +236,6 @@ export function OrderComposer({ tenantId, auth, initialAssetIds, onSubmitted, cu
|
||||
);
|
||||
const issues: string[] = [];
|
||||
if (hasOPNsense && (hasLinux || hasWindows)) issues.push('OPNsense-Geräte bitte in einem eigenen Auftrag planen.');
|
||||
if (hasOPNsense && (!allowed(auth,'root:execute') || identity!=='root'))
|
||||
issues.push('OPNsense-Skripte benötigen die Ausführungsidentität root und das Recht root:execute.');
|
||||
if (targets.some((d) => !d?.current))
|
||||
issues.push('Ein Zielgerät fehlt im aktuellen Bestand. Entfernen Sie es aus der Auswahl.');
|
||||
const unidentified = targets.filter((d) => d && !d.platform);
|
||||
@@ -710,7 +708,8 @@ export function OrderComposer({ tenantId, auth, initialAssetIds, onSubmitted, cu
|
||||
{hasLinux && <ScriptFieldsForPlatform script={linux} change={setLinux} auth={auth} windows={false} />}
|
||||
{hasWindows && <ScriptFieldsForPlatform script={windows} change={setWindows} auth={auth} windows />}
|
||||
{hasOPNsense && <fieldset><legend>OPNsense-Skript</legend>
|
||||
<ScriptFields script={opnsense} change={setOpnsense} ids={['root']} interpreters={['posix_sh']} />
|
||||
<ScriptFields script={opnsense} change={setOpnsense}
|
||||
ids={allowed(auth,'root:execute') ? ['agent_service','root'] : ['agent_service']} interpreters={['posix_sh']} />
|
||||
</fieldset>}
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user