SSH, Inbound, WebSocket, Windows, and Ephemeral Agents: Connectivity, Remoting, and Agent Lifecycle: Configuration, Design Choices, and Tradeoffs
Choose SSH, inbound TCP, WebSocket, service/interactive process, and static/ephemeral lifecycle patterns by network direction, identity, trust, observability, maintenance, and rollback—not by habit.
Learning objectives
- Choose SSH, inbound TCP or WebSocket using explicit network and identity constraints.
- Decide when an agent should run as a service, scheduled task, interactive process or ephemeral container.
- Separate static-worker maintenance from ephemeral-image/provisioning maintenance.
- Define host-key, inbound-secret and process-account trust prerequisites.
- Predict rollback and observable evidence before changing transport or lifecycle.
1. There is no universally best launcher
Launcher choice follows topology. Ask who can initiate a connection, where identity is anchored, what firewall/proxy path exists, who owns the agent process, how often workers are replaced and which failure evidence operators can actually observe.
2. SSH vs inbound TCP vs WebSocket
| Choice | Connection direction | Identity/trust | Network prerequisite | Best fit | Common failure evidence |
|---|---|---|---|---|---|
| SSH Build Agents | Controller → worker | SSH user key/password + verified server host key | Controller reaches SSH port | Stable Unix-like hosts | SSH auth/host-key/startup log |
| Inbound TCP | Worker → controller | Agent name + inbound secret + controller instance identity/protocol | HTTP(S) plus inbound-agent TCP port unless direct settings are used | Stable inbound workers where separate port is acceptable | TCP reachability / Remoting handshake |
| WebSocket inbound | Worker → controller | Agent name + inbound secret over authenticated Jenkins endpoint | HTTP(S) path and WebSocket-capable proxy | NAT/firewall/proxy environments | HTTP Upgrade / proxy close / channel logs |
Do not translate this table into a ranking. The useful evidence is whether the selected path matches actual network direction, identity policy and operator support model.
3. SSH host trust is separate from SSH user authentication
An SSH private key proves which client identity is being presented. Host-key verification proves which server Jenkins reached. Both are required. If a host is rebuilt and its key legitimately changes, review the infrastructure change and update the known fingerprint; do not suppress verification to “make it connect.”
Scope the SSH credential to the lab/folder where feasible and run the remote process under a dedicated account. The account needs a writable agent root and build tools; it should not need root/admin or access to the controller filesystem.
4. Inbound secret is node bootstrap identity
Inbound connection material is generated for a configured node.
Treat it like a credential. The command can read the secret from a
file using the @ form so it is not a literal process
argument.
Remoting documentation warns that a compromised secret should not be “rotated” by blindly reusing the same affected node name. In a disposable environment, retire that node identity and create a replacement name/material.
5. WebSocket moves firewall complexity into the HTTP path
WebSocket often reduces open ports, but it increases reliance on the reverse proxy/load balancer path. Preserve:
- controller URL actually used by the agent;
- TLS hostname/certificate validity;
- proxy WebSocket Upgrade handling;
- idle/read timeout behavior;
- agent and controller timestamps around disconnects.
Do not change low-level ping or Remoting tuning properties until ordinary proxy/network evidence demonstrates a need.
6. Service vs interactive process
| Mode | Advantages | Risks/constraints | Evidence |
|---|---|---|---|
| OS service / scheduled task | Defined identity, automatic startup, OS-managed recovery | Usually non-interactive; permission drift can be hidden | Service account, startup policy, event/service logs |
| Interactive process | Easy for a temporary lab and direct console logs | User session dependence, accidental privilege/desktop access | User/session/process tree |
| Ephemeral container/VM | Fresh filesystem/image, reproducible provisioning | Provisioning latency, image trust, externalized evidence required | Image/template digest, instance ID, teardown event |
7. Static vs ephemeral lifecycle
Static agent: you patch Java/tools/OS in place, monitor disk/workspace drift and preserve stable host identity. Ephemeral agent: you rebuild from an image/template, treat the workspace as disposable, and rely on archived/external evidence. The latter reduces persistent drift but moves trust to the image supply chain and provisioning definition.
A hybrid fleet is normal: stable hardware workers for specialized devices plus ephemeral general-purpose CI. Keep trust labels and credentials aligned with the lifecycle.
8. Windows choices
Windows can use inbound TCP/WebSocket with
agent.jar like other platforms. Run persistent agents
under a dedicated Windows account and a managed startup mechanism.
If builds require interactive GUI behavior, isolate that into a
specialized agent pool and document the session dependency; do not
turn every Windows agent into a logged-in administrator.
The official inbound-agent image also publishes Windows variants for supported Windows container environments, but those are optional. A Windows host/VM is not required to learn the process/identity/lifecycle model.
9. Controller-supplied agent.jar vs pinned image
For a directly launched JVM, controller-supplied
agent.jar is the simplest compatibility anchor. For
container fleets, pin a reviewed official image tag/digest and
include its Remoting/Java identity in your evidence. Avoid mutable
image tags for reproducibility.
10. Design each transport change with rollback
| Change | Predict | Verify | Rollback |
|---|---|---|---|
| Inbound TCP → WebSocket | Separate TCP port no longer needed for this agent | Agent connects via HTTPS path; proxy logs show upgrade | Restore prior tested inbound path, not controller builds |
| SSH key/host key rotation | Old identity stops connecting; new reviewed identity works | SSH launcher log/fingerprint and node online state | Restore reviewed previous key only if still authorized |
| Static → ephemeral | Workspace disappears after each worker | Artifacts remain while worker instance/root is gone | Recreate from previous pinned image/template |
| Interactive → service | Different OS identity/session semantics | Service account, path permissions, non-interactive test | Stop service and restore prior controlled lab launch |
11. Worked scenario
A company has Linux build workers in a private subnet, Windows UI-test workers behind an outbound-only firewall, and short-lived generic CI containers. A reasonable design can use SSH for stable Linux hosts where controller-to-worker SSH is permitted and host keys are managed; WebSocket inbound for Windows workers that can only reach HTTPS; and ephemeral inbound containers for burst CI. The protected Windows/SSH pools remain separate from untrusted pull-request agents.
Evidence must show endpoint direction, agent/Java/Remoting identity, OS account, labels/trust classification, workspace root and teardown behavior for each pool.
Knowledge check
Answer before revealing the explanation.
1. When is WebSocket commonly preferable to inbound TCP?
When agents can reach the controller over HTTPS but a separate inbound-agent TCP port is undesirable or blocked. WebSocket keeps the agent-initiated flow on the web path, with the proxy configured for WebSocket upgrades.
2. What is the main network-direction difference between SSH and inbound launch?
SSH is controller-initiated: the controller reaches the agent host. Inbound is agent-initiated: the agent reaches Jenkins. That difference affects firewall rules, credentials, host identity and failure diagnosis.
3. Why can a Windows service be safer operationally than a manually opened terminal?
A service provides a defined process identity, startup policy and lifecycle managed by the OS. It should still use a least-privilege account and non-interactive assumptions; a service is not a reason to grant desktop or administrator privileges.
4. What is the key reliability advantage of ephemeral agents?
Recreation replaces accumulated workspace/tool drift with a known image or provisioning definition. Durable evidence must therefore live outside the ephemeral workspace.
5. Why should the controller not silently fall back to its built-in node when an agent transport fails?
That crosses the controller isolation boundary and hides the real capacity/connectivity failure. Preserve the queue/agent error and repair the worker path instead.
Official references and version notes
-
Jenkins LTS changelog
and
Java support policy
— lab baseline
Jenkins 2.568.3 LTS; Jenkins system components, including agents, require Java 21 or 25 on this baseline. - Using Jenkins agents and Managing Nodes — distributed execution, node configuration, Windows agent examples, and lifecycle concepts.
-
Jenkins Remoting
and
Launching inbound agents
— obtain
agent.jarfrom the controller; inbound command,-webSocket, work directory, and direct TCP guidance. -
SSH Build Agents plugin
— baseline
3.1097.v868116049892; SSH launch requires verified server identity and least-privilege agent credentials. -
Official Jenkins inbound-agent images
— reviewed lab image line
jenkins/inbound-agent:3391.va_37fa_a_305d6d-2-jdk21. Pin a reviewed tag/digest for repeatable labs rather than usinglatest. - Controller Isolation — keep the built-in node at zero executors and do not use controller-local builds as a connectivity workaround.
- Installing Jenkins — standalone Jenkins uses the supported Jetty/Winstone stack; WebSocket-agent support depends on a compatible servlet/proxy path.
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this
address.