説明
publicly_accessible: yes を指定すると、ルートとセキュリティグループが許可する接続元からインターネット経由で Redshift に接続できます。データを読むにはデータベースの認証と権限が必要です。
想定される影響
外部から到達できるエンドポイントには不要なログイン試行が届きます。認証情報が漏れると、そのアカウントで読めるデータが露出するおそれがあります。
対処方法
- プライベート接続のみを使うクラスターでは、必要なクライアントのプライベート経路を用意してから
publicly_accessible: falseを指定します。クラスターのデータベースポートには必要なクライアントだけを許可します。公開接続が必要な場合も接続元を絞ります。 - 既存のクラスターには、AWS の
ModifyClusterAPI など、publicly_accessibleを更新できる方法を使います。community.aws11.1.0 ではcreateの再実行でもmodifyでもこの設定は変わりません。 - 適用後の設定を確認します。許可したクライアントから TLS で接続して権限のあるクエリを実行し、許可していない接続元からは接続できないことを確認します。
例
新しいシングルノードクラスターには、モジュールと対象リージョンの両方がサポートする redshift_single_node_type を指定します。redshift_admin_password はシークレットストアから取得し、サブネットとセキュリティグループを確認します。
変更前
yaml
- name: Basic cluster provisioning example
community.aws.redshift:
command: create
node_type: "{{ redshift_single_node_type }}"
cluster_type: single-node
identifier: new-cluster
username: cluster_admin
password: "{{ redshift_admin_password }}"
encrypted: true
publicly_accessible: yes
yes は new-cluster に公開エンドポイントを要求します。
変更後
yaml
- name: Basic cluster provisioning example
community.aws.redshift:
command: create
node_type: "{{ redshift_single_node_type }}"
cluster_type: single-node
identifier: new-cluster
username: cluster_admin
password: "{{ redshift_admin_password }}"
encrypted: true
publicly_accessible: false
false はプライベートエンドポイントを作成します。どちらのタスクも保存時の暗号化を有効にしています。