> For the complete documentation index, see [llms.txt](https://wiki.datadike.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.datadike.com/pam/administration/connectivity/jump-host-setup.md).

# Prepare a Linux jump host

Prepare an Ubuntu machine with one leg in each network as the jump host of a proxy, and reach an isolated Windows host over RDP through it.

## What this is and when to use it

A [gateway](https://wiki.datadike.com/pam/administration/connectivity/gateways.md) is a machine the solution logs in to over SSH and forwards traffic through, so that assets with no route from the solution can still be reached. This page builds one from a plain Ubuntu server and uses it to reach a Windows host that sits in an isolated network, over RDP.

The jump is made **at the application layer**: the solution opens an SSH session on the jump host and, inside it, forwards the connection to the target's address and port as seen from the jump host. The jump host never acts as a router. That is what keeps the isolated network isolated: the only way in is the mediated, recorded session.

The example uses these addresses. Replace them with your own.

| Element            | Role                | Address                                                                                              |
| ------------------ | ------------------- | ---------------------------------------------------------------------------------------------------- |
| Jump host (Ubuntu) | Carries the SSH hop | `eth0` `10.0.0.10` on the network the solution reaches; `eth1` `172.16.20.1` on the isolated network |
| Target (Windows)   | Isolated host       | `172.16.20.50`, one interface, on the isolated network only                                          |

{% hint style="info" %}
**The jump host needs two legs; the target needs one.** One interface on the network the solution reaches, so the solution can talk to the jump host, and one on the isolated network, so the jump host can talk to the target. Add the second interface to the jump host; do not replace the existing one.
{% endhint %}

## Before you start

* An Ubuntu server with two network interfaces, one on each network, and an account with `sudo` on it.
* The solution able to reach the jump host on SSH, port 22 by default.
* An account on the jump host for the solution to log in with. Its credential is registered in the console and the hop is made with it.
* The target's address on the isolated network, and an account on the target.
* The **SYSADMIN** profile in the console.

## Steps

### On the jump host

1. Make sure the SSH server is installed and running:

   ```bash
   sudo systemctl status ssh
   # if it is not installed:
   sudo apt update && sudo apt install openssh-server -y
   sudo systemctl enable --now ssh
   ```

   Minimal images also lack an editor and `ping`. Install them if you need them: `sudo apt install nano iputils-ping -y`.
2. Find the interface names:

   ```bash
   ip a
   # eth0 -> has an address on the network the solution reaches
   # eth1 -> no address, DOWN: the isolated network
   ```
3. Edit the netplan file. Its name varies; list the directory first:

   ```bash
   ls /etc/netplan/
   sudo nano /etc/netplan/00-installer-config.yaml
   ```

   Keep the existing `eth0` block as the installer wrote it and add `eth1` with a static address. Use the MAC addresses that `ip a` reports.

   ```yaml
   network:
     version: 2
     ethernets:
       eth0:
         # existing block, unchanged
         dhcp4: true
         match:
           macaddress: 00:15:5d:00:00:01
         set-name: eth0
       eth1:
         dhcp4: false
         match:
           macaddress: 00:15:5d:00:00:02
         set-name: eth1
         addresses:
           - 172.16.20.1/24
   ```

   The isolated interface has **no default gateway and no DNS**. That is intended: that network leads nowhere. Indent with spaces only, two per level. A tab makes the file invalid.
4. Apply the configuration with a safety net, then check it:

   ```bash
   sudo netplan try   # applies, and rolls back by itself if you lose access
   # press ENTER to keep the configuration when prompted
   ip a               # eth1 must show 172.16.20.1 and state UP
   ```
5. Confirm the jump host does **not** route between the two networks:

   ```bash
   cat /proc/sys/net/ipv4/ip_forward   # must return 0
   # if it returns 1:
   sudo sysctl -w net.ipv4.ip_forward=0
   ```

   `sysctl -w` lasts until the next reboot. If forwarding was on, find the setting that turned it on, usually a file under `/etc/sysctl.d/`, and remove it. With forwarding on, the solution could reach the target directly and the jump would be pointless.
6. Check that the jump host reaches the target on the port the session will use, 3389 for RDP:

   ```bash
   timeout 3 bash -c "cat < /dev/null > /dev/tcp/172.16.20.50/3389" \
     && echo "RDP reachable" || echo "RDP NOT reachable"
   ```

   A port test is better than `ping` here: it checks the port the session actually uses, and a firewall that drops ICMP does not affect it.

### In the console

7. In **Environment › Assets**, register the jump host on the **Gateway** platform, with its address on the network the solution reaches (`10.0.0.10`), and add the SSH account the solution will log in with.
8. Register the target on the **Windows** platform, at its isolated address (`172.16.20.50`), with its local account.
9. In **Environment › Platforms**, open **Windows** and confirm that **Gateway enabled** is on under **Quick update** and that RDP 3389 is among its protocols. If you use a copy of that platform, check the copy.
10. Optional, and worth doing once: try an RDP session to the target now. It must fail, because nothing yet tells the solution to use the jump host. Note the message: it is what a missing jump path looks like.
11. In **Console › Gateway › Proxy**, create a proxy for the isolated network, for example `isolated-network`, and attach the target to it. On the proxy's **Gateways** tab, add the jump host, with its address on the network the solution reaches and its SSH account.
12. In **Policies › Authorization**, grant the users who need the target access to it, with the RDP protocol. See [Authorizations](https://wiki.datadike.com/pam/administration/access/authorizations.md).
13. Open an RDP session to the target. The desktop opens through the jump host.

## Example target: a Windows host reached over RDP

Prepare the target while it is still on the network you normally reach it on. Run these in PowerShell as administrator.

1. Create a local administrator account. The text after `Read-Host` is only the prompt shown on screen; the password is what you type at the hidden prompt that follows. That password is the one registered in the console.

   ```powershell
   New-LocalUser -Name "localadmin" `
     -Password (Read-Host -AsSecureString "Password") `
     -FullName "Local administrator"
   Add-LocalGroupMember -Group "Administrators" -Member "localadmin"
   ```

   To reset the password later:

   ```powershell
   Set-LocalUser -Name "localadmin" `
     -Password (Read-Host -AsSecureString "New password")
   ```
2. Enable RDP and its firewall rule:

   ```powershell
   Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' `
     -Name fDenyTSConnections -Value 0
   Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
   ```

   <div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><p>Group names are localized. On a Windows installed in another language, <code>Administrators</code> and <code>Remote Desktop</code> have other names; in Portuguese, for example, <code>Administradores</code> and <code>Área de Trabalho Remota</code>. To find the name of the firewall group, search for it: <code>Get-NetFirewallRule | Where-Object DisplayName -like "*Remote*"</code>, adjusting the pattern to the system language.</p></div>
3. Move the target to the isolated network, then give it its address. **Keep this order**: changing the address first drops both your RDP connection and the solution's access at once, before the new network is in place. With the interface already on the isolated network, sign in through the hypervisor console and run:

   ```powershell
   Get-NetAdapter   # note the Name, for example Ethernet
   # if the interface already has an IPv4 address, remove it first:
   Get-NetIPAddress -InterfaceAlias "Ethernet" -AddressFamily IPv4
   Remove-NetIPAddress -InterfaceAlias "Ethernet" `
     -IPAddress <old_address> -Confirm:$false
   # then add the new one:
   New-NetIPAddress -InterfaceAlias "Ethernet" `
     -IPAddress 172.16.20.50 -PrefixLength 24
   ```

   The target defines no default gateway and no DNS. It only has to exist on the isolated network; the jump host bridges it, at the application layer.

   When signing in at the console, use `.\localadmin`. The `.\` forces a local login; without it, a domain-joined Windows tries the domain, which the isolated host can no longer reach.

## Reproduce it in a Hyper-V lab

The same topology can be built on a single Hyper-V host, to evaluate the jump path before touching a production network.

* **Create the isolated network as a Private switch.** In **Hyper-V Manager**, **Virtual Switch Manager › New virtual network switch › Private**. An *Internal* switch also connects the Hyper-V host itself, so if the solution runs on that host the network is not isolated from it. A *Private* switch excludes the host, and the isolation is enforced by the hypervisor.
* **Add the jump host's second interface with the VM off**: **Settings › Add Hardware › Network Adapter**, connected to the private switch.
* **Move the target's only interface** to the private switch, also with the VM off: **Settings › Network Adapter › Virtual switch**.
* **Ubuntu on a Generation 2 VM**: before installing, go to **Settings › Security** and either set the Secure Boot template to **Microsoft UEFI Certificate Authority** or clear **Enable Secure Boot**. Otherwise the installer stops with *The signed image's hash is not allowed*.

## What you should see

On the jump host, `ip a` shows `eth0` on the network the solution reaches and `eth1` with `172.16.20.1`, both `UP`, and `ip_forward` reads `0`. In the console, the proxy lists the target on its **Assets** tab and the jump host on its **Gateways** tab. An RDP session to the target opens the Windows desktop, and the session is recorded like any direct one.

## How to verify it worked

1. From the jump host, run the port test in step 6. It must report the target as reachable.
2. From a machine on the solution's network, run the same test against the target. It must **fail**. If it succeeds, the network is not isolated and the session is not proving anything about the jump.
3. On the target asset, run **Test asset connectivity** from its **Quick update** block. This exercises the jump path.
4. Open an RDP session as an authorized user, then confirm the record in **Audit › Sessions**.

## Common errors

| Symptom                                                                  | Cause                                                                                                                | Fix                                                                                              |
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| The session fails even with the proxy and the gateway in place           | **Gateway enabled** is off on the target's platform, so the solution ignores the proxy and tries to connect directly | Turn on **Gateway enabled** for that platform. This is the step most often missed                |
| `netplan try` reports an error, or the file is rejected                  | A tab in the YAML, or wrong indentation                                                                              | Indent with spaces only, two per level                                                           |
| `eth1` stays without an address after applying                           | The MAC in the `match` block does not match the interface                                                            | Copy the MAC from `ip a`                                                                         |
| The target is reachable from the solution's network without the proxy    | Forwarding is on in the jump host, or another route exists                                                           | Set `ip_forward` to `0` and remove the route                                                     |
| Login to the jump host fails                                             | SSH is not running, or the account registered in the console has the wrong credential                                | Check `systemctl status ssh` and the account on the jump host's asset                            |
| The jump host accepts the login but the target is unreachable            | The jump host cannot reach the target's port: the Windows firewall rule is off, or the target has the wrong address  | Run the port test from the jump host, then check the firewall rule and the address on the target |
| The jump host accepts the login but the forwarded connection is refused  | The SSH server on the jump host does not allow TCP forwarding                                                        | Make sure `AllowTcpForwarding` is not set to `no` in `/etc/ssh/sshd_config`, then restart SSH    |
| You lost access to the Windows target while isolating it                 | The address was changed before the interface was moved                                                               | Sign in through the hypervisor console and finish the configuration from there                   |
| The Ubuntu installer stops with *The signed image's hash is not allowed* | Secure Boot with the Windows template on a Generation 2 VM                                                           | Use the **Microsoft UEFI Certificate Authority** template, or disable Secure Boot                |

## Field reference

| Item                  | Where                               | What it does                                                       |
| --------------------- | ----------------------------------- | ------------------------------------------------------------------ |
| **Gateway** platform  | **Environment › Platforms**         | Platform for the jump host. Same protocols as **Linux**            |
| **Gateway enabled**   | Target's platform, **Quick update** | Lets connections to assets of that platform pass through a gateway |
| Proxy                 | **Console › Gateway › Proxy**       | The zone the target is attached to                                 |
| **Gateways** tab      | The proxy's detail panel            | The jump hosts that serve the zone                                 |
| `net.ipv4.ip_forward` | Jump host kernel setting            | Must be `0`: the hop is made over SSH, not by routing              |

## Related pages

* [Gateways](https://wiki.datadike.com/pam/administration/connectivity/gateways.md): the jump host and what is usually reached through it
* [Proxy](https://wiki.datadike.com/pam/administration/connectivity/proxy.md): the zone the jump host and the target belong to
* [Platforms](https://wiki.datadike.com/pam/administration/assets/platforms.md): where **Gateway enabled** is set
* [RDP sessions](https://wiki.datadike.com/pam/administration/sessions/rdp.md): the session opened at the end
* [Ports and protocols](https://wiki.datadike.com/pam/reference/ports.md): the ports to open on each leg
