User Tools

Site Tools


hpc:gateway_-_poc

Accessing Services via the HPC Gateway (POC)

Purpose

The goal of this system (the HPC Gateway with Rathole) is to make local services hosted on private compute nodes (which are not directly connected to the Internet) accessible via a secure public address.

The main objectives are:

  1. Secure Remote Access: Allow external users to access web applications, APIs, or development tools (such as LM Studio) installed on HPC clusters, without exposing the compute nodes directly to the Internet.
  2. Simplified Access: Provide a single URL (gatewaypoc.hpc.unige.ch) and a specific port for each service, instead of managing complex IP addresses or advanced network configurations.
  3. Encryption (SSL/TLS): Ensure that communication between the end user and the gateway is encrypted (HTTPS), even if the internal service does not use SSL.
  4. Isolation and Security: Compute nodes remain in a secure internal network. The gateway acts as a controlled bridge, where authentication and routing are managed by the HPC team.

In summary: It is a secure bridge that allows remote access to powerful but isolated computing services.

1. Final Access URL

All services exposed through this Proof of Concept are accessible via the single address:

https://gatewaypoc.hpc.unige.ch

The final access port is specified in the Rathole configuration file (e.g., `rathole.client.toml`) provided by the HPC team. It is indicated as a comment at the beginning of the file.

2. Prerequisites and Authorization Procedure

Before any technical configuration, you must follow these steps:

1. Contact the HPC Team: Send an email to [support email] with the following information:

  • Your username.
  • The local port on which your service listens (e.g., 11200).
  • The service name (unique identifier for the Rathole configuration).
  • The nature of the service (for security assessment).

2. Validation: The HPC team will validate your request. 3. SSL Configuration:

  • If your service already handles SSL (HTTPS): No changes are needed.
  • If your service does not use SSL: The HPC team will configure SSL termination on the gateway. Traffic between the end user and the gateway will be encrypted (HTTPS). Traffic between the gateway and your compute node will be unencrypted (secure internal network).

3. Tunnel Configuration (User Side)

Once authorized, you must install and configure Rathole on your compute node.

Step 1: Install Rathole

Rathole is available via the cluster's environment modules. Load it with the following command:

ml rathole

Verify that the command is available:

which rathole

Step 2: Create the Configuration File

The HPC team will provide you with a client configuration file (rathole.client.toml). This file contains two crucial pieces of information:

  1. The final access port (in a comment).
  2. The local port on which your service must listen.

Here is an example of the file you will receive:

## https://gatewaypoc.hpc.unige.ch:1200

[client]
# HPC Gateway address (Rathole connection port)
remote_addr = "gatewaypoc.hpc.unige.ch:2333"

[client.services.sagon_lm_studio]
# Unique authentication token provided by the HPC team
token = "61d4d8fdc96e641140ddf66******************6e9d733b0ce95bd21"
# Protocol type (tcp for most web/API services)
type = "tcp"
# Local address where your service listens on the compute node
# IMPORTANT: Your service MUST listen on this port (here 11200).
local_addr = "127.0.0.1:11200"

Field Explanations:

  • ## https://gatewaypoc.hpc.unige.ch:1200: This is the final URL to use to access your service. The port 1200 is the public exposure port.
  • remote_addr: Points to the HPC Gateway.
  • token: Secret key to authenticate your tunnel. Do not share this token.
  • local_addr: The IP address and port on which your service runs on the compute node.
    • *Important Note:* You must ensure that your application is listening on the port indicated in local_addr (here 11200). This port is not used by end users, but is used for the internal tunnel.

Step 3: Start the Tunnel

Run Rathole with the provided configuration file:

rathole rathole.client.toml

Check the logs to ensure the connection is established successfully (look for messages indicating “connected” or “listening”).

Step 4: Verification and Access

Your service is now accessible via the URL indicated in the comment of the configuration file.

*Example: If the file contains `## https://gatewaypoc.hpc.unige.ch:1200`, the URL will be:* https://gatewaypoc.hpc.unige.ch:1200

4. Security and Authentication

  • Application Authentication: The security of access to your service (login, token, API key, etc.) is entirely your responsibility. The HPC Gateway only handles secure transport (SSL/TLS) and routing.
  • Confidentiality: Ensure that your service does not expose sensitive data without appropriate protection at the application level.
  • Token: The provided token is unique to your service. Do not reuse it for other services.

5. Support and Limitations (POC)

  • This gateway is in the Proof of Concept phase. Performance and availability are not guaranteed.
  • The Rathole tunnel must remain active as long as the service is in use.
  • In case of issues, contact the HPC team with the logs of your Rathole process.

6. Example to launch LM-Studio

  1. Open a session on OpenOnDemand and start an advanced desktop session with a GPU.
  2. Launch lm-studio using the example script below
  3. Setup LM-Studio to start the server using the correct port and auth (see screenshot)

Script to launch the tunnel and lm-studio:

# start rathole tunnel and lm-studio

ml purge

ml LMStudio/0.4.26 rathole/0.5.0 

rathole --client client.toml &

lm-studio --no-sandbox
hpc/gateway_-_poc.txt · Last modified: by Yann Sagon