fix: alice/ionosのVIP・BGP prefix・WireGuard AllowedIPs・/etc/wireguard権限の不一致を修正 - #62
Open
kigawa01 wants to merge 2 commits into
Open
fix: alice/ionosのVIP・BGP prefix・WireGuard AllowedIPs・/etc/wireguard権限の不一致を修正#62kigawa01 wants to merge 2 commits into
kigawa01 wants to merge 2 commits into
Conversation
k8s4の192.168.1.x→10.0.0.x移行(PR #59)でalice-ingress Serviceの loadBalancerIPが10.0.0.240/241に変わったが、hardware/aliceモジュール (inuyama_ingress_vip, minecraft_backend_vip, inuyama_accepted_prefixes) は192.168.1.240/241, 192.168.1.0/24のまま据え置かれていたため、 aliceのHAProxyが新VIPに到達できず(BGP prefix-listでも拒否されており 経路自体が無い状態)、外部からWebサイトにアクセスできなくなる 障害が発生した。 あわせて、hardware/alice/main.tf の bws secret get 呼び出しに --color no が無く、k8s1/k8s2/k8s4/ionosで対応済みの色出力バグが未修正だった (このままapplyするとinuyama/k8s1/k8s2の公開鍵が全て空文字に フォールバックし、WireGuard設定を壊す可能性があった)ため修正。 k8s1_wireguard_public_key/k8s2_wireguard_public_key変数も デフォルトが空文字のままcommitされていたため、実際の値を デフォルトとして設定した。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…d権限バグを修正 k8s4の192.168.1.x→10.0.0.x移行後、以下の障害が連鎖的に発生した (https://kigawa.net が525エラーで到達不能に): 1. hardware/alice の inuyama_ingress_vip/minecraft_backend_vip が 192.168.1.240/241のままで、K8s側は10.0.0.240/241に移行済みだった 2. alice/k8s4双方のBGP prefix-listが "10.0.0.0/16" を指定していたが、 実際のルーティングテーブルには/24しか存在せず(export filterが 完全一致のため)経路が一切広告されていなかった。"/24"に修正。 3. aliceのWireGuard AllowedIPsに10.0.0.0/24が含まれておらず、経路が あってもトンネル内で暗号化できなかった ("sendmsg: Required key not available") 4. hardware/alice/main.tf 自体にbwsカラー出力バグの修正が 未適用だった(alice/ionos/k8s1/k8s2/k8s4で対応済みの--color no) 同様の問題をionos側にも適用(k8s1/k8s2向けピア追加時に発見した 別バグ経由で発覚): hardware/modules/wireguard, alice, ionos, k8s4の `install -d -m 700 /etc/wireguard` が、design doc (docs/network.md記載の711)と食い違っており、非rootユーザーが publickeyを読めず(Permission denied)、alice/ionosからのk8s1/k8s2 公開鍵取得が失敗して空文字にフォールバックしていた。711に修正。 全て実際にapplyし、alice・ionos双方でBGP Established・経路受信・ バックエンドVIPへのHTTP疎通・外部からの実サイトアクセス(200 OK)を 確認済み。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Terraform Plan
|
Terraform Plan
|
Terraform Plan
|
Terraform Plan
|
Terraform Plan
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
緊急度: 高(本番Webサイト障害の修正、既に適用・復旧確認済み)
背景
k8s4の192.168.1.x→10.0.0.x移行(PR #59, #61)後、
https://kigawa.netがCloudflare経由で525エラー(オリジンとのTLSハンドシェイク失敗)を返し、外部からアクセス不能になった。発見・修正した問題
hardware/aliceのVIP不一致:inuyama_ingress_vip/minecraft_backend_vipが192.168.1.240/241のままで、K8s側のService(alice-ingress)は既に10.0.0.240/241に移行済みだった。10.0.0.0/16を指定していたが、実際のルーティングテーブルには/24しか存在せず、export filter(完全一致)が何もマッチせず経路が一切広告されていなかった。/24に修正。wireguard_peer_allowed_ipsに10.0.0.0/24が含まれておらず、たとえBGP経路があってもWireGuardトンネル内で暗号化できなかった(sendmsg: Required key not available)。hardware/alice/main.tf自体に、他モジュールで対応済みの--color noが適用されていなかった。このままapplyするとinuyama/k8s1/k8s2の公開鍵が空文字にフォールバックし、WireGuard設定を壊すリスクがあった。/etc/wireguardの権限バグ:hardware/modules/wireguard,alice,ionos,k8s4の全てでinstall -d -m 700 /etc/wireguardとなっており、design doc(docs/network.md)記載の711と食い違っていた。700だと非rootユーザー(kigawa)がpublickeyを読めず(Permission denied)、alice/ionosからのk8s1/k8s2公開鍵取得(SSH経由)が失敗して空文字にフォールバックしていた。ionos経由の接続不能はこれが原因だった。適用・検証済み
Established・経路受信(PfxRcd: 1)・バックエンドVIPへのHTTP疎通(404、接続成功)・https://kigawa.netの外部アクセス(200 OK)を確認Established・経路受信・バックエンドVIPへのHTTP疎通を確認/etc/wireguardの権限を711に修正(直接SSH、緊急対応)/24に修正・適用済みTest plan
terraform fmt -check/terraform validate(alice, ionos, k8s4)200 OK)🤖 Generated with Claude Code