Skip to content

Fix network configuration permission failures for non-root VC#756

Merged
AlexWFMS merged 5 commits into
mainfrom
users/alexwill/network-config-elevation
Jul 17, 2026
Merged

Fix network configuration permission failures for non-root VC#756
AlexWFMS merged 5 commits into
mainfrom
users/alexwill/network-config-elevation

Conversation

@AlexWFMS

@AlexWFMS AlexWFMS commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

NetworkConfigurationSetup writes directly to root-owned Linux files:

  • /etc/security/limits.conf
  • /etc/systemd/system.conf
  • /etc/systemd/user.conf
  • /etc/rc.local

When Virtual Client runs as a non-root user, setup fails on the first write:

Access to the path '/etc/security/limits.conf' is denied.

Change

  • Write each updated configuration to the VC temp directory.
  • Copy it to the protected destination through CreateElevatedProcess.
  • Check the elevated process result.
  • Remove the temporary file in finally.
  • Update the existing systemd configuration tests for the temp-file write path.
  • Bump VERSION to 3.3.24.

This keeps the VC workload process non-root while explicitly elevating only
the system configuration operations that require it.

Validation

Live Ubuntu 22.04 VM

Tested current-main VC 3.3.22 with the PERF-NETWORK
NetworkConfigurationSetup dependency:

Build/run identity Result
Unmodified VC as a non-root user Reproduced the exact limits.conf access denial; process exited 250.
Unmodified VC launched with sudo Setup completed, requested the expected reboot, and applied all protected settings.
Patched VC as a non-root user Setup completed with VC exit code 0, requested the expected reboot, applied all protected settings, and left zero temporary files.

The VM, NIC, disk, and transfer artifacts were deleted after validation.

Unit tests

NetworkConfigurationSetupTests: 11 passed, 0 failed

Build

dotnet publish VirtualClient.Main.csproj -c Release -r linux-x64 --self-contained true

Write protected Linux network configuration files through an explicitly elevated copy operation so Virtual Client can run as a non-root user. Add coverage for each protected destination and preserve process diagnostics and temporary-file cleanup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e9198c10-5ac9-4f4f-bc79-06721f6194b0
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Alex Williams-Ferreira and others added 4 commits July 17, 2026 14:37
Keep the permission fix focused on explicitly elevated file copies without threading EventContext through the existing setup methods.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e9198c10-5ac9-4f4f-bc79-06721f6194b0
Keep only the existing test mock updates required for writes through a temporary path; live VM validation covers the elevation behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e9198c10-5ac9-4f4f-bc79-06721f6194b0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e9198c10-5ac9-4f4f-bc79-06721f6194b0
@AlexWFMS
AlexWFMS enabled auto-merge (squash) July 17, 2026 22:05
@AlexWFMS
AlexWFMS merged commit 8625e63 into main Jul 17, 2026
5 checks passed
@AlexWFMS
AlexWFMS deleted the users/alexwill/network-config-elevation branch July 17, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants