Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grant LOCAL SERVICE permission to read and execute debug DLLs #4095

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions scripts/setup-ebpf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ if ($Uninstall) {
Write-Host("Visual C++ Redistributable installation completed successfully!") -ForegroundColor Green
}

# Move the Visual C++ Redistributable Debug DLLs to the JIT directory, so that ebpfsvc.exe
# does not fail to start with error 1053.
# Copy the Visual C++ Redistributable Debug DLLs to the JIT directory and give
# LOCAL SERVICE read access.
# This is so that ebpfsvc.exe does not fail to start with error 1053.
Write-Host("Copying Visual C++ Redistributable debug runtime DLLs to the $EbpfSvcPath directory...")
# Test if the VC debug runtime DLLs are present in the working directory (indicating a debug build).
$VCDebugRuntime = $VCDebugRuntime | Where-Object { Test-Path (Join-Path $WorkingDirectory $_) }
if (-not $VCDebugRuntime) {
Write-Host("Visual C++ Redistributable debug runtime DLLs not found in the working directory (i.e., release build or already installed). Skipping this step.") -ForegroundColor Yellow
Write-Host("Visual C++ Redistributable debug runtime DLLs not found in the working directory. Skipping this step.") -ForegroundColor Yellow
} else {
if (-not (Test-Path $EbpfSvcPath)) {
New-Item -Path $EbpfSvcPath -ItemType Directory
Expand All @@ -76,7 +77,10 @@ if ($Uninstall) {
$VCDebugRuntime | ForEach-Object {
$sourcePath = Join-Path $WorkingDirectory $_
$destinationPath = Join-Path $EbpfSvcPath $_
Move-Item -Path $sourcePath -Destination $destinationPath -Force
Copy-Item -Path $sourcePath -Destination $destinationPath -Force
$acl = Get-Acl $destinationPath
$acl.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("NT AUTHORITY\LOCAL SERVICE", "ReadAndExecute", "Allow")))
Set-Acl $destinationPath $acl
}
Write-Host("Visual C++ Redistributable debug runtime DLLs copied successfully!") -ForegroundColor Green
}
Expand Down
Loading