0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【IBM Cloud】KubernetesのSysdigエージェントをCloud MonitoringからSCCWPへ移行する

Posted at

Security and Compliance Center Workload Protection(SCCWP)について

SCCWPとは、クラウドネイティブなアプリケーション保護プラットフォームCNAPP)サービスで、Sysdig Secure(Sysdig社)のIBM Cloudマネージド版である。

  • Cloud Security Posture Management(CSPM)
    IBM CloudだけでなくAWS/Azure/GCPやオンプレ環境のリソース設定を評価し準拠性のチェックが行える

  • Cloud Workload Protection(CWPP)+脆弱性管理
    Kubernetes/OpenShiftやVMに対し、Sysdigエージェント経由でランタイム脅威検知・防御とソフトウェア脆弱性スキャンを実行する

  • インシデント対応・フォレンジック
    検知した異常動作の詳細ログ/コンテナフォレンジック情報を収集し、迅速なトラブルシュートを行う(異常動作に対する対処も設定できる)

…ざっくり言うと以下を組み合わせたサービス。

CSPM:クラウド設定の甘い部分を自動で発見して「ここ直して」と教えてくれる
CWPP:サーバーやコンテナ上で動く「怪しい動き」をリアルタイムでキャッチしてブロックできる

詳細についてはIBMCloudのドキュメントからどうぞ:

SCCWPの導入

私の環境では従来のIBM Cloud Monitoringを使用していたが、IBM Cloud Monitoringに加えてコンプライアンス監査やランタイム保護が手に入るとのことで、IBM Cloudアカウント+IBM Kubernetes Serviceへ導入してみた。
Cloud Monitoringから移行する際に若干わかりづらい点があったため、誰かの役に立つことを祈りこの記事を残す。

インスタンスの作成

インスタンスは通常通り、カタログより作成する

  • ロケーションとTierを選択

    • ただし既存のIBM Cloud MonitoringやApp Configurationが存在するロケーションを選択すること
      image.png
  • 名前とリソースグループを選択

    • 同様に既存の(ry
      image.png
  • CSPMの有効化とモニターインスタンスの接続
    image.png

    • CSPMの有効化
      • トラステッド・プロファイルとApp Configurationの作成が必要となる
      • 私の環境ではApp Configurationを使用していなかったのでここで作成を行なった
    • モニターインスタンスの接続
      • 既存のインスタンスの接続を選択し、すでに使用しているIBM Cloud Monitoringを選択した

作成し、しばらく待つとダッシュボードが開けるようになる。
image.png

Kubernetes sysdig-agentの接続先をSCCWPへ変更する

IBM Cloud Monitoringを使用していた場合、Kubernetesクラスタにsysdig-agentをデプロイしているはずだ。
KubernetesをSCCWPから監視するためには同じsysdig-agentを使用するが、このままではログが適切に送信されないため、新しい設定で再デプロイを行う必要がある。

(またこの時点でSCCWPのダッシュボードを開き、左下のIntegrations -> (Environment) -> Sysdig Agentsを開いてみると、k8s上のsysdig-agentはOut of Dateとなっていた。)
image.png

ターゲットとなるKubernetesクラスタ上の操作

ターゲットとなるクラスター(ここではtarget-clusterとする)を操作できる環境へ入り、kubectlを使えるようにしておくこと。
IBM Cloud上のKubernetes(IBM Kubernetes Service)の場合、

  • IBM Cloud CLIへのログイン($ ibmcloud login
  • $ ibmcloud ks cluster config -c target-cluster

これでkubectlによるクラスタ操作が行えるようになる。

$ kubectl get all -n ibm-observeを行うと既存のsysdig-agentの様子が見れる。このsysdig-agentを一旦削除し、新しいyamlファイルでsysdig-agentを再デプロイする。
image.png

古いsysdig-agentの削除

$ helm list -Aを叩いてsysdig-agentが存在していた場合は、$ helm uninstall sysdig-agent -n ibm-observeで一度古いデプロイメントをアンインストールする。
image.png

helm listでsysdig-agentが出てこない場合

手動でsysdig-agent関連のリソースを削除する。
私の環境では以下リソースの削除でOKだった。
$ kubectl delete serviceaccount sysdig-agent -n ibm-observe
$ kubectl delete clusterrole sysdig-agent -n ibm-observe
$ kubectl delete clusterrolebinding sysdig-agent -n ibm-observe
$ kubectl delete daemonset sysdig-agent -n ibm-observe
$ kubectl delete secret sysdig-agent -n ibm-observe
$ kubectl delete configmap sysdig-agent -n ibm-observe

helm install時に邪魔なリソースがあると注意されるため、それを頼りに削除する
例:↓このようなエラーの場合sysdig-agentのsecretを削除する

# helm install -n ibm-observe sysdig-agent sysdig/sysdig-deploy -f agent-values-monitor-secure.yaml
Error: INSTALLATION FAILED: Unable to continue with install: Secret "sysdig-agent" in namespace "ibm-observe" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "sysdig-agent"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "ibm-observe"

helmでのインストール

$ helm repo add sysdig https://charts.sysdig.com
$ helm repo update
$ helm install -n ibm-observe sysdig-agent sysdig/sysdig-deploy -f agent-values-monitor-secure.yaml
sysdig-agentがデプロイされることを確認する。

[root@vpc-vsi ~]# kubectl get pods -n ibm-observe
NAME                                          READY   STATUS              RESTARTS         AGE
logdna-agent-fqj95                            1/1     Running             13 (26h ago)     191d
logdna-agent-s4d7x                            1/1     Running             11 (5d19h ago)   191d
logger-agent-ds-bxqnm                         1/1     Running             133 (13d ago)    191d
logger-agent-ds-l5hxj                         1/1     Running             113 (13d ago)    191d
sysdig-agent-clustershield-75f65545f7-6c7xl   0/1     ContainerCreating   0                25s
sysdig-agent-clustershield-75f65545f7-htgtp   0/1     ContainerCreating   0                25s
sysdig-agent-g2rvl                            0/1     Init:0/1            0                25s
sysdig-agent-node-analyzer-r5rz7              0/2     ImagePullBackOff    0                25s
sysdig-agent-node-analyzer-xj6h9              0/2     ContainerCreating   0                25s
sysdig-agent-p2cvf                            0/1     Init:0/1            0                25s
[root@vpc-vsi ~]#

接続確認

その後SCCWPを開き、Threats -> Activity -> Kubernetesを開くとクラスターの脅威解析情報が表示されていて、無事に接続できていることが分かった。

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?