Making it easier to get started with rdpgw by integrating with Keycloak, NGINX, and Cloudflare Tunnels.
- A domain hosted on Cloudflare
- A computer or VM with Docker and Docker Compose installed
- Must be on a separate computer (not the Windows computer you are accessing remotely)
- We will refer to this computer your Gateway
- Clone this repository on your Gateway
- Log in to Cloudflare One, and select 'Networks' > 'Connectors'
- Create a tunnel
- Choose 'Cloudflared'
- Name your tunnel
- Follow the instructions to install and run the connector on your Gateway
- Pick your Hostname e.g.,
gateway.example.com; this will be yourSERVER_HOSTNAME - Use
https://localhost:443for the Service - Expand 'Additonal application settings' > 'TLS' > and set the 'No TLS Verify' to 'ON'
- Save
Tip
You can see your tunnels as DNS records in your regular Cloudflare Dashboard.
- Go to your Cloudflare Dashboard, and select your domain
- Go to 'SSL/TLS' (use the search bar for SSL if you need to), then click 'Origin Server' > 'Create Certificate'
- Accept the defaults and click 'Create'
- Copy both the Certificate as
cloudflare.pemand the Key ascloudflare.key; place them in the certs folder
- Copy .env.example to
.env - Set your bootstrap admin credentials for Keycloak
- Set
SERVER_HOSTNAMEto the hostname from Cloudflare Tunnel step #6 - Set
RDP_HOSTNAMEto the hostname of your Windows computer
- You should have the following tasks complete:
- A working cloudflare tunnel
- Cloudflare cert and key saved to the certs folder
- Your own
.envfile configured
- Once those are all done, run
docker compose up -dto start the Gateway
- Go to
https://SERVER_HOSTNAME/auth/admin/master/consoleand log in with your Keycloak bootstrap admin credentials - Click 'Manage realms'
- Click 'rdpgw'
- Click 'Users'
- Click 'Create new user' to add your first user
- Fill in your username (for convenience, use your Windows username; you can get it with
$env:USERNAMEin PowerShell) and click 'Create' - Click on your user
- Click 'Credentials'
- Click 'Set password'
- Enter your password and confirm it (uncheck 'Temporary', or else you will be forced to change your password when you log in), then click 'Save'
Now that your user is created, you can navigate to https://SERVER_HOSTNAME and log in with your new user. The RDP file will automatically download once you are authenticated.
The default RDP template has been customized for speed and simplicity. You can edit the options in default.rdp to your liking. A good reference for the options is available at https://www.donkz.nl/overview-rdp-file-settings/. Be sure to rebuild the rdpgw container after you make any changes.