コンテンツにスキップ

RDP

リモートデスクトッププロトコル(RDP)は、ユーザーがコンピュータにリモートで接続するためのグラフィカルインターフェースを提供します。RDPは、ユーザーが物理的にアクセスできないマシンやワークステーションへの簡単なリモートアクセスを促進するために最も一般的に使用されます。しかし、これによりRDP接続は攻撃の頻繁な対象となります。なぜなら、誤った設定が不正アクセスを許可してしまう可能性があるからです。

Cloudflare Zero Trustを使用すると、ローカルサーバーの受信ポートを開くリスクなしに、インターネット上でRDPサーバーを利用できる便利さを享受できます。

Cloudflare Zero Trustは、RDPサーバーへの安全なアクセスを提供するための2つのソリューションを提供します:

GCPにRDPサーバーをセットアップする

この例では、Google Cloud Platform(GCP)の仮想マシン(VM)にRDPサーバーをセットアップする方法を説明しますが、RDP接続をサポートする任意のマシンを使用できます。

  1. Google Cloud Consoleにアクセスし、新しいプロジェクトを作成します。
  2. Compute Engine > VMインスタンスに移動します。
  3. インスタンスを作成を選択します。
  4. VMインスタンスに名前を付けます(例:windows-rdp-server)。
  5. VMインスタンスを構成します:
    1. ブートディスクまでスクロールし、変更を選択します。
    2. オペレーティングシステムとして_Windows Server_を選択します。
    3. デスクトップエクスペリエンスを持つバージョンを選択します(例:Windows Server 2016 Datacenter)。
  6. VMが起動したら、RDPの横にあるドロップダウンを開き、_パスワードをリセットするためのgcloudコマンドを表示_を選択します。
  7. Cloud Shellで実行を選択します。
  8. Cloud Shellターミナルでコマンドを実行します。パスワードリセットの確認を求められます。
  9. 自動生成されたパスワードとユーザー名を安全な場所にコピーします。

Microsoft Remote Desktopをインストールする

任意のRDPクライアントを使用してRDPサーバーにアクセスし、構成できます。

Microsoft Remote Desktopを使用してサーバーにアクセスするには:

  1. Microsoft Remote Desktopをダウンロードしてインストールします。
  2. ダウンロードが完了したら、Microsoft Remote Desktopを開き、PCを追加を選択します。
  3. PC名にRDPサーバーのパブリックIPアドレスを入力します。GCPでは、これはVMインスタンスの外部IPです。
  4. ユーザーアカウントとして、ユーザーアカウントを追加を選択し、自動生成されたパスワードとユーザー名を入力します。
  5. 追加を選択します。PCがMicrosoft Remote Desktopに表示されます。
  6. 基本的な接続性をテストするために、新しく追加したPCをダブルクリックします。
  7. 続行するかどうか尋ねられたら、続行を選択します。

これで、リモートでRDPサーバーにアクセスし、構成できるようになりました。

WARPを使用してRDPサーバーに接続する

You can use Cloudflare Tunnel to create a secure, outbound-only connection from your server to Cloudflare’s edge. This requires running the cloudflared daemon on the server. Users reach the service by installing the Cloudflare WARP client on their device and enrolling in your Zero Trust organization. Remote devices will be able to connect as if they were on your private network. By default, all devices enrolled in your organization can access the service unless you build policies to allow or block specific users.

1. サーバーをCloudflareに接続する

  1. Create a Cloudflare Tunnel for your server by following our dashboard setup guide. You can skip the connect an application step and go straight to connecting a network.

  2. In the Private Networks tab for the tunnel, enter the private IP address of your server (or a range that includes the server IP). In GCP, the server IP is the Internal IP of the VM instance.

  3. (Optional) Set up Zero Trust policies to fine-tune access to your server.

2. クライアントをセットアップする

To connect your devices to Cloudflare:

  1. Deploy the WARP client on your devices in Gateway with WARP mode. The Cloudflare certificate is only required if you want to display a custom block page or filter HTTPS traffic.
  2. Create device enrollment rules to determine which devices can enroll to your Zero Trust organization.

3. WARPを介してプライベートネットワークIPをルーティングする

By default, WARP excludes traffic bound for RFC 1918 space, which are IP addresses typically used in private networks and not reachable from the Internet. In order for WARP to send traffic to your private network, you must configure Split Tunnels so that the IP/CIDR of your private network routes through WARP.

  1. First, check whether your Split Tunnels mode is set to Exclude or Include mode.

  2. If you are using Include mode, add your network’s IP/CIDR range to the list. Your list should also include the domains necessary for Cloudflare Zero Trust functionality.

  3. If you are using Exclude mode:

    1. Delete your network’s IP/CIDR range from the list. For example, if your network uses the default AWS range of 172.31.0.0/16, delete 172.16.0.0/12.
    2. Re-add IP/CDIR ranges that are not explicitly used by your private network. For the AWS example above, you would add new entries for 172.16.0.0/13, 172.24.0.0/14, 172.28.0.0/15, and 172.30.0.0/16. This ensures that only traffic to 172.31.0.0/16 routes through WARP.

By tightening the private IP range included in WARP, you reduce the risk of breaking a user’s access to local resources.

4. ユーザーとして接続する

WARPクライアントが構成されると、RDPクライアントを使用してサーバーのプライベートIPアドレスに接続できます(最初に使用したパブリックIPアドレスの代わりに)。

Microsoft Remote Desktopで接続するには:

  1. Microsoft Remote Desktopを開き、PCを追加を選択します。
  2. PC名にRDPサーバーのプライベートIPアドレスを入力します。GCPでは、これはVMインスタンスの内部IPです。
  3. ユーザーアカウントにRDPサーバーのユーザー名とパスワードを入力します。
  4. Zero Trust接続性をテストするために、新しく追加したPCをダブルクリックします。
  5. 続行するかどうか尋ねられたら、続行を選択します。

これで、RDPサーバーへの安全なリモートアクセスが可能になりました。

cloudflared accessを使用してRDPサーバーに接続する

Cloudflare Tunnel can also route applications through a public hostname, which allows users to connect to the application without the WARP client. This method requires having cloudflared installed on both the server machine and on the client machine, as well as an active zone on Cloudflare. The traffic is proxied over this connection, and the user logs in to the server with their Cloudflare Access credentials.

The public hostname method can be implemented in conjunction with routing over WARP so that there are multiple ways to connect to the server. You can reuse the same tunnel for both the private network and public hostname routes.

1. サーバーをCloudflareに接続する

  1. ダッシュボード設定ガイドに従ってCloudflareトンネルを作成します。

  2. パブリックホスト名タブで、ドロップダウンメニューからドメインを選択し、任意のサブドメインを指定します(例:rdp.example.com)。

  3. サービスとして_RDP_を選択し、サーバーのRDPリスニングポートを入力します(例:localhost:3389)。おそらくポートは3389です。

  4. ホスト名を保存を選択します。

  5. (推奨)自己ホスト型アプリケーションをCloudflare Accessに追加して、サーバーへのアクセスを管理します。

2. ユーザーとして接続する

  1. クライアントマシンにcloudflaredをインストールします。

  2. RDPリスニングポートを開くために次のコマンドを実行します:

    Terminal window
    cloudflared access rdp --hostname rdp.example.com --url rdp://localhost:3389

    このプロセスは、常に生き続け、自動起動するように構成する必要があります。プロセスが終了すると、ユーザーは接続できなくなります。

  1. cloudflared accessが実行中の間、Microsoft Remote DesktopなどのRDPクライアントから接続します:
    1. Microsoft Remote Desktopを開き、PCを追加を選択します。
    2. PC名localhost:3389を入力します。
    3. ユーザーアカウントにRDPサーバーのユーザー名とパスワードを入力します。
    4. 新しく追加したPCをダブルクリックします。
    5. 続行するかどうか尋ねられたら、続行を選択します。

クライアントが起動すると、ブラウザウィンドウが開き、ユーザーに認証を求めます。