Azure / Azure/LinuxPatchExtension

Extension seems to unnecessarily checks if it has "sudo" access

オープン
#381 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
12
フォーク
20
平均マージ
6日 4時間
マージ済み PR(30日)
1

説明

Based on public docs everything the waagent runs, including VM extensions, are executed as root: https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/features-linux?tabs=azure-cli#agent-permissions

I checked the source code and found the method EnvHealthManager.check_sudo_status that basically runs a "sudo id" command and checks if it gets a prompt for root password ("[sudo] password for username"). If so, the error "Sudo status check failed..." is raised and LinuxPatchExtension installation fails. Why?

I see there is an argument named raise_if_not_sudo that can skip /etc/sudoers validation, but it is hardcoded to "True" and I did not find anyway to replace it to False without manually changing extension binary.

Is it possible to add a setting in the waagent or LinuxPatchExtension config file to change this raise_if_not_sudo to False? I did not find anyway to do it without manually changing extension binary. The EXT will be executed as root, so why this is set to True? Is there any scenario the EXT does not run as root?

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず EnvHealthManager.check_sudo_status と、raise_if_not_sudo を True にハードコードしているコードパスを読みます。Issue で言及されている LinuxPatchExtension と waagent の構成リファレンスを確認し、サポートされている構成パスを特定します。次に、無効化した場合にインストールで sudoers の検証をスキップでき、デフォルトの動作を損なわないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, python
領域
cloud, devops
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。