Skip to content

quarantine_client

Block a client and log the quarantine action with a reason.

Side effects:

  • Step 1: adds the MAC to the controller’s user-block list (same as block_client). The client is immediately disconnected and prevented from re-associating until unblock_client is called.
  • Step 2: appends a WARNING-level structured log entry capturing mac and reason for later forensics.
  • Mutates controller state. Use dry_run=True to preview the change without applying.
  • Rollback: if any sub-step fails, all prior sub-steps are reverted (the log entry is best-effort and not unwound; only step 1 mutates the controller).
quarantine_client(mac="aa:bb:cc:00:00:01", reason="suspected malware c2")
ParameterTypeRequiredDefaultDescription
macstringyesClient MAC address (e.g. "aa:bb:cc:00:00:01").
reasonstringno""Free-form justification (kept in logs only, e.g. "suspected malware c2").
controllerstringno”default”Name of the UniFi controller to target. Defaults to "default".
dry_runbooleannofalsePreview the change without applying it. Returns the predicted change set.