LoginSignup
1
2

More than 3 years have passed since last update.

CloudArmorのIP制限とGCEのファイアウォールルールで、GCPのロードバランサーのヘルスチェックが失敗する

Last updated at Posted at 2019-09-03

2019/12/3 追記

別件で同じ構成をしたら、cloudarmorの許可IPになくても成功したので、cloudarmorの箇所は取り消し線しました。

はまったこと

マークダウンで書けるWiki「Growi」をGCP上に構築している最中に、GCPのロードバランサーのヘルスチェックではまったことのメモ。
はまったポイントは2つ。
- GCEのファイアウォールにロードバランサーのIPの許可が必要だったこと
- アクセスを社内限定にしようと、CloudArmorでIP制限をしたら、ロードバランサーの許可が必要になったこと

GCPのCloud Load BalancingのヘルスチェックのIP

GCPのロードバランサーは、下記のIPを使う
- 130.211.0.0/22
- 35.191.0.0/16

参考:https://qiita.com/munaita_/items/26469999c0d4f2ac1df8
公式:https://cloud.google.com/load-balancing/docs/https/

公式からの抜粋

Firewall rules
You must create a firewall rule that allows traffic from 130.211.0.0/22 and 35.191.0.0/16 to reach your instances. These are IP address ranges that the load balancer uses to connect to backend instances. This rule allows traffic from both the load balancer and the health checker. The rule must allow traffic on the port your global forwarding rule has been configured to use, and your health checker should be configured to use the same port. If your health checker uses a different port, then you must create another firewall rule for that port.

GCEのファイアウォールルール

上記のとおり、許可IPに130.211.0.0/22と35.191.0.0/16を加える。
ちなみに、ファイアウォールルールにロードバランサーの名前を入れても許可はされない。
AWSと同じようにロードバランサーの名前で許可できると思うと間違う。

CloudArmorのIP許可

2019/12/3 別件で同じ構成をしたら、cloudarmorの許可IPになくても成功したので、下記内容は取り消し線しました。
CloudArmorで社内のグローバルIP以外をdenyにしたら、ロードバランサーのヘルスチェックが失敗した。
CloudArmor→Cloud Load Balancing→GCEという構造でIPを拒否しているのかと思ったら違う模様。

参考:https://apps-gcp.com/cloudarmor-ip-restriction/
参考:https://qiita.com/ikutaN/items/e29c07413b78ca8c2fb9
公式:https://cloud.google.com/armor/docs/security-policy-concepts

CloudArmorの許可IPに130.211.0.0/22と35.191.0.0/16を加えたらうまくいった。
ただ、ググッても公式でも、
CloudArmorでIP制限しているときに、ロードバランサーのIPを許可に追加するという情報が見つからない。

自分は何か勘違いしているのだろうか。

1
2
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
1
2