Skip to content

Commit

Permalink
running pwsh lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberbuff committed Apr 14, 2024
1 parent 0230f47 commit 762b07c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Private/Invoke-ExecuteCommand.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Invoke-ExecuteCommand ($finalCommand, $executor, $elevationreq, $can_su
$execExe = $executor
$execPrefix = "-c"
}

if ($executor -eq "command_prompt") {
$execPrefix = "/c";
$execExe = "cmd.exe";
Expand Down
2 changes: 1 addition & 1 deletion Public/Invoke-AtomicTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ function Invoke-AtomicTest {

# Check if linux Host can use sudo without a password.
$can_sudo = Set-Sudo($false)

if ($CheckPrereqs) {
Write-KeyValue "CheckPrereq's for: " $testId
$failureReasons = Invoke-CheckPrereqs $test $isElevated $executionPlatform $InputArgs $PathToPayloads $TimeoutSeconds $session
Expand Down
2 changes: 1 addition & 1 deletion Public/Invoke-SetupAtomicRunner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function Invoke-SetupAtomicRunner {
$exists = cat /etc/crontab | Select-String -Quiet "KickoffAtomicRunner"
#checks if the Kickoff-AtomicRunner job exists. If not appends it to the system crontab.
if ($null -eq $exists -and $can_sudo -eq $true) {
$(echo "$job" | sudo tee -a /etc/crontab)
$(Write-Output "$job" | sudo tee -a /etc/crontab)
write-host "setting cronjob"
}
elseif ($null -eq $exists -and $can_sudo -eq $false) {
Expand Down
8 changes: 4 additions & 4 deletions Public/Set-Sudo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ function Set-Sudo ($set_sudo) {

try {
if ((sudo -A whoami) -and ((sudo grep -r $env:USER /etc/sudoers | grep NOPASSWD:ALL) -or (sudo grep -r $env:USER /etc/sudoers.d | grep NOPASSWD:ALL))){

if($set_sudo){
Write-Host "Passwordless logon already configured.`n"
}
$nopassword_enabled = $true

}
elseif ($set_sudo -eq $true){

Write-Host "Configuring Passwordless logon...`n"
echo "$env:USER ALL=(ALL) NOPASSWD:ALL" > /tmp/90-$env:USER-sudo-access
Write-Output "$env:USER ALL=(ALL) NOPASSWD:ALL" > /tmp/90-$env:USER-sudo-access
sudo install -m 440 /tmp/90-$env:USER-sudo-access /etc/sudoers.d/90-$env:USER-sudo-access
rm -f /tmp/90-$env:USER-sudo-access
$nopassword_enabled = $true
Expand All @@ -30,4 +30,4 @@ function Set-Sudo ($set_sudo) {
$nopassword_enabled = $false
}
return $nopassword_enabled
}
}

0 comments on commit 762b07c

Please sign in to comment.