Show Table of Contents
第3章 API 呼び出しの認証
Satellite API と対話するには、認証が必要です。各 API 要求で使用するためにローカルホストに Satellite サーバー CA 証明書をダウンロードして、SSL 認証を提供することができます。各 API 要求には、有効なユーザー名とパスワードが必要です。以下のセクションで、これらの点について説明します。
3.1. SSL 認証の使用
Red Hat Satellite は HTTPS を使用して、Red Hat Satellite サーバーと通信する際に一定の暗号化レベルを提供し、ID の確認を行います。SSL 以外の通信は、Satellite 6 ではサポートしていません。
Red Hat Satellite サーバーはそれぞれ、自己署名の証明書を使用します。この証明書は、暗号化キーを検証するサーバーの証明書と、Satellite サーバーの ID を信頼する証明局 (CA) の両方の役割を果たします。以下の手順は、Satellite サーバーの SSL 認証を設定する方法です (以下の例では satellite6.example.com)。
- 以下のオプションの 1 つを使用して、通信する Satellite サーバー (satellite6.example.com) からの証明書を取得します。
- SSH を使用して証明書を取得するには、以下のコマンドを実行します。
$
scp root@satellite6.example.com:/var/www/html/pub/katello-server-ca.crt ./ - Satellite サーバーで直接コマンドを実行する場合は、以下のコマンドを実行してローカルで利用可能なコピーから証明書を取得します。
$
cp /var/www/html/pub/katello-server-ca.crt ./ - HTTP を使用して証明書を取得するには、以下のコマンドを実行します。
$
curl -O http://satellite6.example.com/pub/katello-server-ca.crt警告
暗号化されていない HTTP 接続を使用して証明書を取得すると、セキュリティーリスクにさらされる可能性があります。
- クライアント上の証明書を証明局として使用して、Satellite サーバーの ID を検証します。
$
curl -X GET -u sat_username:sat_password \-H "Accept:application/json" --cacert katello-server-ca.crt \https://satellite6.example.com/katello/api/organizationsGETはデフォルトのアクションであるため、-X GET属性はここでは省略可能です。 - Network Security Services (NSS) データベースを作成して証明書を保存します。
$
certutil -N -d sql:$HOME/.pki/nssdbEnter a password which will be used to encrypt your keys. The password should be at least 8 characters long, and should contain at least one non-alphabetic character. Enter new password: Re-enter password:NSS データベースがすでに存在する場合には、以下のようにパスワードが求められます。Enter Password or Pin for "NSS Certificate DB":
- 以下のコマンドを使用して、NSS データベースに永続的に証明書を追加します。
$
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "Red Hat Satellite" \-i katello-server-ca.crtこれで、NSS データベースに証明書がインポートされ、要求ごとに--cacertオプションを指定する必要がなくなります。これは、以下のようにテストできます。$
curl -X GET -u sat_username:sat_password https://satellite6.example.com/api/v2/hosts{ "total": 2, ..., "results": [ ... ] }出力省略

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.