Azure / WALinuxAgent

Microsoft Azure Linux Guest Agent
http://azure.microsoft.com/
Apache License 2.0
534 stars 371 forks source link

SUSE: sysconfig values may get clobbered #2607

Open FladoToo opened 2 years ago

FladoToo commented 2 years ago

https://github.com/Azure/WALinuxAgent/blob/76f769cb53eced67609b3c2f9c758afc96be9934/azurelinuxagent/common/osutil/suse.py#L113

Looking at wicked's source, this is buggy. Wicked accepts values with single quotes, double quotes, and no quotes at all, so this code should be prepared to react to all those variants ("AUTO", 'AUTO', and AUTO) and not clobber them if the wrong quotes are used.

https://github.com/openSUSE/wicked/blob/a0ba667fd3101bea28c7b0bb3d8692accf6069ae/src/sysconfig.c#L313-L318

narrieta commented 2 years ago

Thanks, fixed by #1951

FladoToo commented 2 years ago

@narrieta, do you mean #2583? Because #1951 is from January 2021... Anyway, the fix in #2583 is very welcome, but not enough. It only repairs the damage done by the buggy agent and that only while de-provisioning. Meanwhile any hostname change would clobber any value that uses the wrong quotes or no quotes at all. Since AUTO, "AUTO" and 'AUTO' are all valid entries for wicked I don't think any of them should be clobbered by the agent at the first host rename.