第 8 章 生成加密密钥对
为确保 Red Hat Update Appliance(RHUA)、内容交付系统(CDS)和 HAProxy 节点之间的安全数据传输,并使用 rhui-manager
设置这些节点,您必须在 RHUA 节点上生成一个密钥对,并将公钥复制到 CDS 和 HAProxy 节点。
根据您的用例,您可以生成 RSA 或 ECDSA 密钥。
8.1. 生成 RSA 密钥对
以下步骤解释了如何为 SSH 协议的版本 2 生成 RSA 密钥对。
流程
在 RHUA 节点上,使用 RSA 参数运行
ssh-keygen
命令,并将密钥保存在默认位置。警告将 passphrase 字段留空。如果您在生成密钥对时提供了密码短语,CDS 安装和注册会失败。
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/USER/.ssh/id_rsa): Created directory '/home/USER/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/USER/.ssh/id_rsa. Your public key has been saved in /home/USER/.ssh/id_rsa.pub. The key fingerprint is: e7:97:c7:e2:0e:f9:0e:fc:c4:d7:cb:e5:31:11:92:14 USER@rhua.example.com The key's randomart image is: +--[ RSA 2048]----+ | E. | | . . | | o . | | . .| | S . . | | + o o ..| | * * +oo| | O +..=| | o* o.| +-----------------+
确认
~/.ssh/
目录的权限已设置为rwx------
或700
(数值表示法)。$ ls -ld ~/.ssh drwx------. 2 USER USER 54 Nov 25 16:56 /home/USER/.ssh/
将公钥复制到 CDS 和 HAProxy 节点。
$ ssh-copy-id user@<haproxy1> $ ssh-copy-id user@<cds1> $ ssh-copy-id user@<cds2>