LawlietRequest demo ↗

13. Remote deployment from the console

This guide describes Lawliet 1.6.3.b (the current release, a beta: earlier releases are beta. The first stable release will be 2.0.0). Screens, commands and procedures may change in later versions; the usage guide is updated with each release. Check the version your server runs under Settings > Platform or with ./lawliet version, and see the Releases page for what changed.

Remote deployment installs the agent on many hosts from the console. The server logs in to each host with a stored technical account (SSH for Linux and macOS, WinRM for Windows), checks the host, and runs the same installer as the copy-paste command, with a one-time token in place of the enrolment secret.

Where: Environment > Hosts, panel Deploy agents remotely below the agent list. The Install agent > Remote deployment tab has an Open remote deployment button that scrolls to it.

Prepare the hosts first: Windows hosts (WinRM), Linux hosts (SSH, below in 13.2).

13.1 Permissions and four-eyes#

ActionPermissionFour-eyes
See the panel, add, edit and delete credentials, see deployments, cancel hosts not yet startedManage deployment credentialsOnly for the weakening changes below
Test connectionManage deployment credentials and Deploy agents remotelyYes
Deploy agents, Retry a hostDeploy agents remotelyYes
Create a WinRM credential that uses HTTP 5985, or switch one to HTTPManage deployment credentialsYes
Turn off certificate validation (API only), replace the WinRM CA, move a credential from Kerberos only to a mode that allows NTLMManage deployment credentialsYes
Change Kerberos realmsManage deployment credentialsYes

Four-eyes is the critical action Deploy agents remotely. A test and a deployment log in with the stored secret, so a second person signs them first. Deployment is part of the agents feature of the licence.

How a four-eyes action runs here: you press the button; the console says "Sent for approval"; a second administrator approves under Approvals > Waiting for me; you then open Approvals > My requests, open the request and press Execute now (within the execution window, 15 minutes by default). See chapter 15.6.

13.2 Procedure: add a credential#

Required permission: Manage deployment credentials.

  1. Environment > Hosts > Deploy agents remotely > Credentials > Add credential.

  2. Fill in:

    FieldWhat to enter
    NameA name for the account, for example "svc-lawliet-deploy (workstations)"
    TypeSSH, password; SSH, private key; SSH, key and certificate; WinRM, password; WinRM, client certificate
    AccountDomain: DOMAIN\user or [email protected]. Local: HOST\user or .\user
    Port (optional)Empty for the default: 22 (SSH), 5986 (WinRM HTTPS), 5985 (WinRM HTTP)
    PasswordFor the password types
    Private key (PEM or OpenSSH), Key passphrase (if any)For the key types (RSA, ECDSA or Ed25519)
    OpenSSH user certificate / Client certificate (PEM)For the certificate types
    Privilege (SSH)Logs in as root, sudo without a password, sudo with a password
    sudo passwordShown for a key with "sudo with a password"
    WinRM connection (WinRM, password)HTTPS 5986 (default, recommended) or HTTP 5985 (insecure)
    Login (WinRM, password)Kerberos first, NTLM if Kerberos is not possible (default); Kerberos only (domains that restrict NTLM); NTLM only (workgroup hosts, local accounts)
    WinRM server CA (PEM, optional)The CA that issued the hosts' WinRM certificates (your AD CS root), or the hosts' self-signed certificates. Empty: the public CA store is used
  3. Click Save credential.

What you see: 'Credential "<name>" stored. Its secrets cannot be read back.' The credential appears in the table (Name, Type, Account, Privilege, Last used). Secrets are encrypted and never shown again.

If you chose HTTP 5985 (insecure): a red warning appears before you save. Saving says "Sent for approval: a credential that uses WinRM over plain HTTP (insecure) needs a second administrator." The credential shows an Insecure: HTTP chip once created.

If it fails:

MessageFix
"Port 5985 is WinRM's plain-HTTP port, but this credential connects to WinRM over HTTPS..."Clear the port (5986 is used) and add an HTTPS listener on the hosts, or switch the connection to HTTP 5985 (insecure, four-eyes)
"Port 5986 is WinRM's HTTPS port, but this credential connects over plain HTTP..."Leave the port empty, or switch back to HTTPS

Linux hosts (SSH). The account must reach root. With "sudo with a password" the password goes only to sudo's own prompt on standard input, never on a command line. Recommended: a NOPASSWD rule for a dedicated group, for example in /etc/sudoers.d/lawliet-deployers:

%lawliet-deployers ALL=(root) NOPASSWD: ALL

For Linux joined to AD with sssd/realmd, log in as [email protected] or DOMAIN\user, whichever form sssd accepts.

Procedure: change or delete a credential#

Permission: Manage deployment credentials. Four-eyes: only for the weakening changes in 13.1 (for example switching a WinRM credential to plain HTTP).

To change a WinRM credential:

  1. In Deploy agents remotely > Credentials, press Edit on the row.
  2. The panel "Edit <name>" offers the WinRM connection (password credentials), Port (optional) and Login. Change them and press Save changes (Cancel discards).
  3. Test it again against one host (13.3). A change bumps the credential's revision, so a test approved before the change is refused and must be requested again.

The name, account and secret cannot be edited, and SSH credentials have no Edit. To change those, add a new credential (13.2) and delete the old one.

To delete a credential:

  1. Press Delete on the row (Delete <name>).
  2. A box asks "Delete credential "<name>" (<account>)?" and names the deployment jobs that used it ("Used by job(s): #7 wave 1 (finished). Their records stay; they can no longer be retried with it."). Agents it installed keep running; the stored secret is deleted and cannot be recovered.
  3. Press Delete credential (or Cancel). While a job that uses it is queued or running the button is disabled ("Job(s) #N still run with it: wait for them or cancel them first"), and the server refuses the delete the same way.

If it fails: the reason is shown above the table (for example a missing permission).

13.3 Procedure: test a credential against one host#

A test logs in and checks the host. It installs nothing.

Required permissions: Manage deployment credentials and Deploy agents remotely. Four-eyes: yes.

  1. In the Credentials table, click Test on the credential.
  2. In "Test against host (address or name; nothing is installed)", enter the host, for example 10.0.0.5 or ws01.corp.example.com (a DNS name for Kerberos).
  3. Click Test connection. What you see: "Sent for approval. A test logs in to the host with the stored secret, so someone else signs it first. Run it from Approvals; its result is shown there."
  4. A second administrator approves it under Approvals > Waiting for me.
  5. Open Approvals > My requests, open the request, click Execute now.
  6. The test runs in the background. The checklist fills in as each check is made. A slow Windows host can take a few minutes. Cancel test stops it at its next step.

What you see when it passes: "Connection test: ready, <os> <arch>, <privilege>. Host key ...". The checklist and verdict are kept 30 days and shown again when you reopen the request.

Rules:

  • One test at a time per credential (a second one is refused with 409 and its approval stays usable), at most 4 tests at once on the server (429).
  • The approval is bound to the credential as it was. If the credential is changed before the test runs, the test is refused; request it again.
  • A server restart fails a running test; request it again.

The checklist#

Each check ends ok, warning or failed, with one line saying what it means and the fix. Any failed check stops that host before anything is installed.

CheckWhat it looks atTypical verdicts and fixes
Host reachableServer -> host SSH or WinRM portRefused (start sshd or WinRM, open the port); timeout (a firewall drops it); name does not resolve
ConnectionOnly for a WinRM HTTP 5985 credentialAlways a warning: "WinRM over plain HTTP (insecure)"
WinRM HTTPS listenerOnly when the port answered in plain HTTPAdd an HTTPS listener, or switch the credential to HTTP 5985 (four-eyes)
Login acceptedThe credentialRefused (wrong password or key, or a locked, disabled or expired account); password expired
Administrator rightsroot, sudo, AdministratorsNot in sudoers; sudo asks for a password; a local Windows account stripped of rights over the network
Operating system supportedOS and CPULinux x86_64/aarch64 and Windows x64 ok; another CPU falls back to the Python agent (warning)
Free disk space/opt or C:Under 200 MB fails, under 1 GB warns
No agent installed yetA running agentUpgrade it from Agent versions instead
Host reaches this serverHost -> server, with the deployment's certificateCertificate does not name the address (sudo ./lawliet tls repair); host clock behind; "Invalid host header" (add the address to TRUSTED_HOSTS)
Clock in step with the serverHost clockOver 1 minute warns; over 5 minutes Kerberos fails too

With Kerberos, the checklist also shows Server clock in step with the domain.

SSH host keys are pinned on first contact. A host that later shows a different key is refused with both fingerprints. After checking the key on the host's own console, remove the old key with the API (DELETE /api/v1/deployment/host-keys/{key_id}) and test again.

13.4 Procedure: configure Kerberos realms#

Use this when Windows hosts must be logged in to with Kerberos (domains that restrict NTLM). The server does not join the domain; it asks the named domain controllers for tickets.

Required permission: Manage deployment credentials. Four-eyes: yes (every change).

  1. In Deploy agents remotely > Kerberos realms, click Add realm (or Edit realms).

  2. Fill in:

    FieldExampleMeaning
    RealmCORP.EXAMPLE.COMThe AD DNS domain in capitals
    NetBIOS domain (as in DOMAIN\user)CORPHow accounts are written
    KDCs (domain controllers, host or host:port)dc1.corp.example.com, 10.0.0.11Asked on TCP 88. Nothing is looked up in DNS
    DNS domains (optional)corp.example.comHost names that belong to the realm (default: the realm in lower case)
  3. Click Save realms. What you see: "Sent for approval: the KDCs receive every WinRM login, so a second person signs the change. Apply it from Approvals."

  4. After approval and Execute now, click Check KDCs. Each KDC shows "answers; clock in step" (or how far the domain's clock is), or "not usable: <reason>". The check uses a non-existent account; no account is touched.

If the page says "Kerberos is not available on this server: ...", the server lacks the Kerberos libraries. Docker installs include them. With Kerberos first, deployments then use NTLM; with Kerberos only, they are refused.

Login modes:

ModeBehaviour
Kerberos first, NTLM if Kerberos is not possibleKerberos. NTLM only when Kerberos cannot start for that host (no realm, a local account, a host given by IP address, no KDC answering)
Kerberos onlyKerberos or nothing
NTLM onlyWorkgroup hosts and local accounts

Once a KDC has answered, NTLM is never tried for that login: a wrong password is not tried a second time by another method. Anyone who can block TCP 88 between the server and the KDCs can push Kerberos first down to NTLM; where that matters, use Kerberos only.

13.5 Procedure: deploy agents#

Required permission: Deploy agents remotely. Four-eyes: yes.

Risk: logs in to every listed host as root or Administrator and installs a service. Rollback: cancel hosts not yet started; uninstall the agent on hosts already done (chapters 11 and 12).

  1. Test the credential against one host first (13.3).

  2. Under New deployment, fill in:

    FieldWhat to enter
    CredentialThe stored credential. An HTTP credential shows "- Insecure: HTTP"
    Name (optional)For example "Floor 3 workstations"
    HostsOne per line, host or host,os (linux, macos, windows); a range as 10.0.1.0/28. At most 1024 hosts
    Address the hosts reach this server atFilled in from the server's settings. Change it when hosts reach the server differently (NAT). A localhost address shows a red warning
    Server certificate (PEM, only when it is not publicly trusted)The server certificate for a self-signed server (sudo ./lawliet tls --export), or the CA (or a bundle of CAs) that issued it; the server's certificate must then name the address. Over SSH to Windows hosts the preflight carries at most about 5 certificates; use WinRM or the installer directly for a larger bundle
    Allow operator custom commands on these hostsOff unless ticked. The install command then carries the installer's --allow-custom-commands / -AllowCustomCommands and each host records it; an agent installed without it refuses custom commands whatever the server says (36). Unticked, a host that already has an agent keeps its earlier choice; only the installer's --no-custom-commands / -NoCustomCommands (MSI ALLOWCUSTOMCOMMANDS=0) turns it off. The approver's summary names the choice. Part of the approved request
  3. Click Deploy agents. What you see: "Sent for approval. Once someone else signs it, run it from Approvals."

  4. A second administrator approves it; you click Execute now under Approvals > My requests.

  5. Watch Deployments: each row shows #, Name, Credential, Started, Hosts ("N of M enrolled, K failed") and Status. Click a row to see each host.

Per host, the State moves through: queued -> connecting -> checking -> installing -> waiting for enrolment -> enrolled (or failed, cancelled). An enrolled host links to its agent. Checks (N failed, M warnings) opens the host's checklist.

What happens on each host: connect, run the checklist, then run the installer with a one-time token (valid 2 hours, one enrolment, only its hash is stored). A server certificate given with the job is written to a root-only folder and removed afterwards. The host is done when its agent enrols.

Controls while it runs:

  • Cancel what has not started stops hosts not yet begun.
  • Retry on a failed or cancelled host runs it again. It is four-eyes ("Retry of <host> sent for approval; run it from Approvals once signed.").

Lockout protection. Hosts are logged in to one at a time until the credential has been accepted once, then at most two at a time (installs run 10 at a time). If the login is refused twice in one deployment, the remaining hosts are not attempted ("Not attempted: the credential was refused 2 times in this deployment..."). A wrong domain password costs two failed logons, not one per host. Fix the account, then retry those hosts.

If it fails:

Host showsFix
Failed at connectingReachability, firewall, name resolution
Failed at preflightOpen Checks: the failed check names the fix
Failed at installingThe installer output is kept on the host row (secrets removed)
Failed at enrolmentThe host could not reach the server address or trust its certificate: check the address and the certificate
Host already has an agentUpgrade it from Agent versions, or reinstall it (13.8)

13.6 Other ways into remote deployment#

  • Network map: an unmanaged host's details offer Deploy an agent to this host, which opens this panel with the host filled in.
  • Review queue: an unmanaged-host item offers the same link. An "Insecure WinRM in use - switch back to HTTPS" item links to the credential's editor.

13.7 Switch a credential back to HTTPS#

  1. Add an HTTPS listener on the hosts (chapter 12.8).
  2. Credentials > Edit on the credential. WinRM connection HTTPS 5986 (default, recommended), clear the port. Save changes.

Switching back to HTTPS needs no second signature. The review queue item resolves itself.

13.8 Procedure: reinstall agents#

For hosts that already have an agent that is offline, broken, or due a clean install. The server logs in with a stored credential, removes the agent the way the manual uninstaller does, installs the current agent, and enrols the host again as the same agent record: its history, groups, compliance and hardening records stay. Linux (SSH) and Windows (WinRM, or Windows OpenSSH) hosts; macOS hosts are reinstalled on the host itself.

Required permissions: Deploy agents remotely and Delete agents. Four-eyes: yes, signed as Delete an agent (or as Deploy agents remotely on a site where only that one needs approval). A sandbox account cannot reinstall.

Risk: the agent is removed before the new one is installed. If the install then fails, the host has no agent until it is retried; the console says so on the host row. The panel, the Reinstall choice under Deploy agents and the approval request all say it before anything runs: "The agent is removed first; if the install then fails the host has no agent until it is retried." Rollback: retry the host, or install the agent by hand (chapters 11 and 12).

Start it from Agents (one host or many)#

  1. Environment > Hosts: tick the hosts in the agent list, then Reinstall agent in the bar above the list. For one host: open its drawer, panel Reinstall agent, button Reinstall agent.
  2. The Reinstall agent panel lists each host with its agent (id, platform, version, status; "Protected: an uninstall code is issued for it." for a protected agent) and a Credential:
    • the credential that last deployed the host is chosen for you;
    • "No stored credential for this host: it was not deployed remotely, or the credential that deployed it was deleted. Choose one." - pick one in the list;
    • "No stored credential can reach a <platform> host: add one under Deploy agents remotely" - add a credential first (13.2); the host has no list;
    • "Reinstall from the console supports Linux and Windows hosts." - a macOS host.
  3. Check Address the hosts reach this server at and, for a self-signed server, Server certificate, as for a deployment (13.5).
  4. Click Reinstall N agents. One request is sent per credential. What you see: "Sent for approval (Delete agents) with "<credential>": <hosts>. Once someone else signs it, run it from Approvals; its progress shows under Deploy agents remotely."
  5. A second administrator approves it. The request reads "Reinstall N agents, credential #C. The agent is removed first; if the install then fails the host has no agent until it is retried. Hosts: agent #7 (web-07) at 10.0.0.7, ...": which agent is reinstalled at which address. You click Execute now under Approvals > My requests.
  6. Follow it under Deploy agents remotely > Deployments: the row is marked "(reinstall)" and counts "N of M reinstalled". If it ran at once (no second approver exists), the panel shows the hosts itself. Close closes the panel.

Start it from Deploy agents remotely#

Under New deployment, set What to do to Reinstall the agent (hosts that have one: online, offline or broken), list the hosts by address or name, and click Reinstall agents. Each line must match exactly one agent on record; a host with none is refused before anyone signs ("No agent is on record for <host>: deploy it instead of reinstalling it."), and so is a range.

Refused before anyone signs as well:

  • an address that is not the agent's own (its recorded address or name, or the address of a network map host recorded as that agent's): "<host> is not the host of agent #N (<name>)";
  • an agent already being reinstalled: "agent #N (<name>) is already being reinstalled (deployment D): wait for it to finish, or cancel it." One reinstall at a time per agent. A network map host that has an agent is reinstalled this way too; deploying over it is refused ("... already has an agent: reinstall it instead").

What happens on each host#

queued -> connecting -> checking -> removing the old agent -> installing -> waiting for enrolment -> enrolled, waiting for it to come online -> reinstalled, online.

  • Checking: the usual checklist; "Agent to reinstall" says whether an agent is running.
  • Removing: the server's own installer runs with --uninstall (Linux) or -Uninstall (Windows). A protected agent gets a host-bound uninstall code issued for it under the job's approval (recorded in the audit trail by its digest, never in clear); the agent's own check on the host decides. Nothing is bypassed. The agent's log is removed with it, as the uninstaller does. Once it is removed, the old agent token stops working.
  • Installing / enrolment: the current agent for the host's OS is installed with a one-time token that enrols this agent record and no other: a different host offering it is refused, and the token is spent. The agent gets a new token.
  • Online: the host is done when the agent sends a heartbeat after enrolling (up to 4 minutes): "Reinstalled: agent #N is online again with <version> (was <version>)."
  • The host row keeps what the removal and the install printed (secrets removed).

If it fails:

Host showsMeaning and fix
removing: The agent on the host is protected and refused the uninstall code ...Nothing was removed and the old token still works. The agent's program could not check the code (for example it is broken or missing). Remove it on the host with the recovery key (16.4), then Retry
removing: This host is isolated by Lawliet ...A Windows host under isolation: release the isolation first, then reinstall
installing: Agent removed, install failed: <reason> and "No agent on this host until it is retried."Fix the reason (it is the installer's own output), then Retry. The retry finds nothing to remove and installs
enrolment: A host reporting itself as <name> (<address>) tried to enrol with this host's token and was refused ...Another host offered this host's token. Retry issues a new one
installed, not yet onlineInstalled and enrolled, but no heartbeat within 4 minutes: check the agent's log on the host; Retry reinstalls it again
The server restarted: "the host may have no agent now. Retry it."Retry
removing: The removal did not finish within 600 s. The agent is still on the host; nothing more was done.The uninstaller is not started a second time: the host is looked at again first (gone: the install goes ahead). Look at the host, then Retry
cancelled: the agent record was deleted while the host was being reinstalled ...Deleting the agent (10.7) cancels its reinstall and voids the host's one-time token; the host never enrols as a new agent. Deploy it again if it should have one

Retry on a reinstall host is four-eyes, signed like the reinstall.

More detail: remote deployment reference.