パブリックDNS
Cloudflare Tunnelの設定を使用できない場合は、キーボードサーバーのためにパブリックDNSレコードを作成することもできます。
この設定オプションは理想的ではなく、DNSレコードはプロキシ化できないため、結果としてキーボードサーバーのオリジンIPアドレスが公開されてしまいます。
Keyless has been tested on amd64 and arm architectures. The key server binary will likely run on all architectures that Go supports. Code support may exist for other CPUs too, but these other architectures have not been tested.
In addition to running on bare metal, the key server should run without issue in a virtualized or containerized environment. Care will need to be taken to configure ingress access to the appropriate TCP port and file system access to private keys (if using filesystem storage).
You will need to have a supported operating system (OS) to run Keyless. Supported operating systems include:
- Ubuntu 14.04 LTS, 16.04 LTS, 18.04 LTS, 20.04 LTS, 22.04 LTS, 22.10
- Debian 8, 9, 10, 11, 12
- RHEL and CentOS 6, 7, 8, 9
- Amazon Linux 1, 2
We strongly recommend that you use an operating system still supported by the vendor (still receiving security updates) as your key server will have access to your private keys.
- ターミナルを開き、
openssl rand -hex 24を実行して、11aa40b4a5db06d4889e48e2f738950ddfa50b7349d09b5f.example.comのような長いランダムホスト名を生成します。 - このレコードをDNSプロバイダーのインターフェースを介して、キーレスSSLサーバーのIPアドレスを指すAまたはAAAAレコードとして追加します。
- このホスト名をキーレスSSLサーバーの初期化中のサーバーホスト名として使用します。
Before your key servers can be configured, you must next upload the corresponding SSL certificates to Cloudflare’s edge. During TLS termination, Cloudflare will present these certificates to connecting browsers and then (for non-resumed sessions) communicate with the specified key server to complete the handshake.
Upload certificates to Cloudflare with only SANs that you wish to use with Cloudflare Keyless SSL. All Keyless SSL hostnames must be proxied.
You will have to upload each certificate used with Keyless SSL.
ダッシュボードでキーレス証明書を作成するには:
- Cloudflareダッシュボード ↗にログインし、アカウントとゾーンを選択します。
- SSL/TLS > エッジ証明書に移動します。
- キーレスSSL証明書のアップロードを選択します。
- アップロードモーダルに証明書とその他の詳細を入力し、追加を選択します。
| ラベル | 説明 | 例の値 |
|---|---|---|
| キーサーバーラベル | キーサーバーのための任意の一意の識別子。 | “test-keyless”, “production-keyless-1” |
| キーサーバーホスト名 | この証明書のためのキーを保持するキーサーバーのホスト名(前に生成したランダムホスト名など)。 | 11aa40b4a5db06d4889e48e2f738950ddfa50b7349d09b5f.example.com |
| キーサーバーポート | キーサーバーで変更していない限り2407に設定します。 | 2407 |
| SSL証明書 | プライベートキーを保持している有効なX509v3 SSL証明書(PEM形式)。 | (PEMバイト) |
| バンドル方法 | これはほぼ常にCompatibleであるべきです。詳細についてはカスタム証明書のアップロードを参照してください。 | Compatible |
APIでキーレス証明書を作成するには、POSTリクエストを送信します。
Finally, you need to install the key server on your infrastructure, populate it with the SSL keys of the certificates you wish to use to terminate TLS at Cloudflare’s edge, and activate the key server so it can be mutually authenticated.
These steps are also at pkg.cloudflare.com ↗.
sudo mkdir -p --mode=0755 /usr/share/keyringscurl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
# Add this repo to your apt repositoriesecho 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/gokeyless buster main' | sudo tee /etc/apt/sources.list.d/cloudflare.list
# install gokeylesssudo apt-get update && sudo apt-get install gokeylessUse either of the following examples to install the gokeyless package for RHEL or CentOS.
Option 1
sudo yum makecachesudo yum-config-manager --add-repo https://pkg.cloudflare.com/gokeyless.repo && sudo yum-config-manager --setopt=gokeyless-stable.gpgkey=https://pkg.cloudflare.com/cloudflare-ascii-pubkey.gpg --savesudo yum install gokeylessOption 2
sudo dnf install dnf-plugins-core && dnf clean allsudo dnf config-manager --add-repo https://pkg.cloudflare.com/gokeyless.reposudo dnf install gokeylessAdd your Cloudflare account details to the configuration file located at /etc/keyless/gokeyless.yaml:
- Set the hostname of the key server, for example,
11aa40b4a5db06d4889e48e2f.example.com. This is also the value you entered when you uploaded your keyless certificate and is the hostname of your key server that holds the key for this certificate. - Set the Zone ID (found on Overview tab of the Cloudflare dashboard).
- Set the Origin CA API key.
Install your private keys in /etc/keyless/keys/ and set the user and group to keyless with 400 permissions. Keys must be in PEM or DER format and have an extension of .key:
ls -l /etc/keyless/keys-r-------- 1 keyless keyless 1675 Nov 18 16:44 example.com.keyWhen running multiple key servers, make sure all required keys are distributed to each key server. Customers typically will either use a configuration management tool such as Salt or Puppet to distribute keys or mount /etc/keyless/keys to a network location accessible only by your key servers. Keys are read on boot into memory, so a network path must be accessible during the gokeyless process start/restart.
To activate, restart your keyless instance:
- systemd:
sudo service gokeyless restart - upstart/sysvinit:
sudo /etc/init.d/gokeyless restart
If this command fails, try troubleshooting by checking the logs.
TLSハンドシェイク中に、Cloudflareのキーレスクライアントは、証明書アップロード中に指定したキーサーバーホスト名またはIPアドレスに接続を開始します。デフォルトでは、キーレスクライアントは宛先TCPポート2407を使用しますが、これは証明書アップロード中に変更することも、アップロード後に証明書の詳細を編集することで変更することもできます。
Cloudflareからのみ接続を受け入れるようにキーサーバーが許可するWAFカスタムルールを作成します。私たちは、IPv4およびIPv6アドレスをAPIを介して公開しています。