Set Up Playit for Free RDP Forwarding Using GitHub: Complete Tutorial - Dave's Blog

Saturday, December 7, 2024

Set Up Playit for Free RDP Forwarding Using GitHub: Complete Tutorial

In this comprehensive guide, we’ll walk you through the process of setting up Playit for RDP forwarding with the help of GitHub Codespaces. This free solution allows you to access RDP without the need for a local server, using GitHub as the primary platform for configuration.


Prerequisites

  • Active GitHub and Playit accounts.
  • Basic knowledge of GitHub, Playit, and RDP.
  • A compatible operating system to support GitHub Codespaces and Playit (Linux, in this case).

What is PlayIt?

Playit is a third-party application similar to 'Ngrok'. It works to forward connections, whether TCP, UDP, or game servers. It is almost identical to 'Ngrok', but Playit offers the same functionality for free. (2024/12/7)


What is the relationship between GitHub, PlayIt, and RDP?

GitHub is the executor in this setup. It automates everything via GitHub Actions and Codespaces. It will install PlayIt and configure RDP forwarding using scripts I've written before running.

PlayIt is the forwarder, specifically it forwards TCP connections (e.g. RDP) over a secure tunnel. Similar to Ngrok except it's free to do so with your own provider using PlayIt without having to deal with more network configuration fun.

RDP is the protocol that allows you to access your Windows computer remotely, it lets you control the desktop from anywhere. PlayIt simply forwards the RDP traffic so your remote connections remain secure and uninterrupted.


Step 1: Create a GitHub Codespace

Head over to GitHub and navigate to the GitHub Codespaces interface. From here, create a new blank Codespace. This will be the cloud-based development environment that we’re going to setup and run our script in. By using GitHub Codespaces, you’ll have access to a pre-configured and pre-setup workspace that you can manage your project through and run all of the commands required without needing to worry about local setup or dependencies (we’ll get everything you need installed in just a bit!). It’s important that we do this as it’s completely isolated from your local environment ensuring everything is compartmentalized.

Tutorial Image

Step 2: Install Playit on GitHub Codespace (Linux)

Once your GitHub Codespace is up and ready to use, go to the terminal in the Codespace environment where you can execute commands within your virtual workspace. To install Playit for Linux, run this set of commands in the terminal given below. These commands will download and setup Playit tool for you so that you could start using its features of secure tunneling and port forwarding. Kindly follow each install step carefully to avoid any inconvenience in setup.

curl -SsL https://playit-cloud.github.io/ppa/key.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/playit.gpg >/dev/null
echo "deb [signed-by=/etc/apt/trusted.gpg.d/playit.gpg] https://playit-cloud.github.io/ppa/data ./" | sudo tee /etc/apt/sources.list.d/playit-cloud.list
sudo apt update
sudo apt install playit

If Playit has been installed correctly on your system, running the command playit help in the terminal will display a list of available commands and options. This serves as a helpful guide to understand the various functionalities of Playit, allowing you to explore and utilize different features for your tunneling and port forwarding needs. Be sure to check the output to ensure that all commands are available and functioning properly.

Tutorial Image

Step 3: Link Playit Agent with Your Playit Account

Once Playit has been successfully installed on your system, the next step is to connect the Playit agent to your Playit account. To establish this connection, use the following code provided below. This will link your local setup to your Playit account, ensuring that you can start utilizing Playit's features for secure tunneling and port forwarding. Make sure to replace any placeholders with your actual account details for a seamless integration.

playit

Wait for the installation process to complete successfully. Once the setup is finished, you will need to create a secure tunnel that will allow you to forward the RDP connection. The tunnel should be configured to forward the connection specifically through port 3389, which is the default port used for Remote Desktop Protocol (RDP). This step is crucial for ensuring that your RDP connection is securely forwarded, allowing remote access to your machine without exposing it to unnecessary risks.

Tutorial Image

To obtain your Playit secret code, run the following command in the terminal:

playit secret-path

This command will display the path to the file containing your Playit secret code. Once you have the path, navigate to that location to access the secret code. Copy the secret code from the file, as it will be necessary for the next steps in configuring Playit and connecting it to your account.

Tutorial Image

Step 4: Keep the Codespace Running

While you are working in the Codespace, please make sure that you shutdown the Codespace when you don't actively work with it so we save resources but do not close the Codespace window as it will still be needed. The secret code has been already fetched for you and it is displayed inside Codespace window and that secret code will be used in one of next steps to configure Playit, hence keeping this window open will just allow easier use of the secret code while doing next steps setup.


Step 5: Create a New GitHub Repository

After you have turned off your Codespace, go to the GitHub homepage and create a new repository. Be sure that the repository is set to public when you are prompted choose how to configure this repo as it is needed during setup. A public repository allows others access to your project files as well as being able to be linked back within your GitHub Actions workflow later on in this setup. This is where we will store and manage our project files in GitHub.

Tutorial Image

Step 6: Add GitHub Workflow for Playit Configuration

After creating the repository, the next step is to create a new file for the GitHub workflow. This file should be placed at the following path: .github/workflows/rdp.yml. Inside this file, you will write the script to configure Playit and set up RDP forwarding using the secret code that you previously obtained. This configuration is key to establishing a connection for RDP forwarding, and the script will ensure that everything is set up correctly for the next steps.


For a detailed example of the Playit configuration and the complete workflow for setting up Playit and RDP forwarding, you can refer to my GitHub repository. The repository contains the source code, including the workflow configuration files, which will guide you through the process of setting up Playit and ensuring that RDP forwarding is correctly configured. This will help you avoid common pitfalls and follow the setup with a clear and working example.

Tutorial Image

Step 7: Add Your Playit Secret Code to GitHub Secrets

Go to your repository on GitHub. Navigate to Settings > Secrets and Variables > Actions. Click New repository secret, name it PL, and paste the secret code you obtained earlier into the value field. This secret will be used later in your GitHub Actions workflow to securely reference your Playit secret code without exposing it publicly.

Tutorial Image

Step 8: Run the GitHub Action Workflow

Go to the Actions tab in your repository on GitHub and manually run the workflow you’ve set up. If everything is configured correctly, the workflow will start the RDP server and configure Playit as the port forwarder on Windows. This process ensures that your RDP server is accessible through the Playit tunnel, allowing for a seamless connection to your Windows machine over the internet.

Tutorial Image

Step 9: Test RDP Connection

After the workflow is complete, Playit will provide you with a public URL or IP address. This URL or IP is the address you’ll use to establish your RDP (Remote Desktop Protocol) connection. You can access your Windows machine remotely by using this public address as the connection endpoint.


To log in, simply enter the username and password you configured earlier for your RDP session. Once you’ve entered the credentials, you should be able to connect to your Windows machine seamlessly through the Playit public URL or IP address.


Step 10: Finalizing the Setup

If you encounter a certificate error when attempting to connect, this indicates that the RDP connection has been successfully established and is functioning as expected. This error is common when connecting to a remote server for the first time, as the certificate is not verified by a trusted authority. However, it confirms that your RDP server and Playit tunnel are both set up correctly and actively working.

Tutorial Image

Conclusion

In this tutorial, we set up Playit for RDP forwarding with GitHub Actions. After following the steps, you could now remotely access your Windows virtual machine over RDP with Playit acting as a secure tunnel.


At the end of the workflow, you received a public URL or IP address from Playit which you needed to use to connect to your RDP server. If you got a certificate error after trying to connect, everything was set up correctly! You also checked if your connection was fast and stable!


With this, you now have the capability to access your Windows machine securely and conveniently from the internet. A cheap and good method for RDP access without any complicated networking setup required.


For a more in-depth walkthrough, I also posted a full tutorial on YouTube that covers everything we do here but in a video format. Feel free to check it out and work along with the guide.


I hope this tutorial was helpful and that you were able to complete the process with ease. As always, feel free to change and tweak the setup as needed for your specific project. If you have any questions or run into any issues, please don’t hesitate to leave them down below in the comments!

2 comments: