Skip to content

Commit

Permalink
master Delete: 403 delete command now requires root privillages
Browse files Browse the repository at this point in the history
  • Loading branch information
daniwe4 committed Nov 10, 2023
1 parent 2898f9f commit 54e5b59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/src/Commands/Instances/DeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DeleteCommand extends Command

protected static $defaultName = "instances:delete";
protected static $defaultDescription =
"This command deletes one or all instances. It will remove everything belonging " .
"<fg=red>!NEEDS SUDO PRIVILEGES!</> This command deletes one or all instances. It will remove everything belonging " .
"to the given instance including all its files, configuration and misc data."
;

Expand Down Expand Up @@ -55,6 +55,14 @@ public function configure() : void

public function execute(InputInterface $input, OutputInterface $output) : int
{
if (! $this->posix->isSudo()) {
$this->writer->error(
$output,
"Please execute this script as sudo user!"
);
return Command::FAILURE;
}

$instance = $input->getArgument("instance");
$all = $input->getOption("all");

Expand Down
8 changes: 8 additions & 0 deletions app/src/Lib/Docker/DockerShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public function startContainerByDockerCompose(string $path) : void
"rm -f /run/apache2/apache2.pid &>/dev/null"
);

$this->executeCommand(
$path,
basename($path),
"/bin/bash",
"-c",
"killall salt-minion &>/dev/null && /etc/init.d/salt-minion start &>/dev/null"
);

$this->cleanupMasterKey($path);
}

Expand Down
1 change: 1 addition & 0 deletions setup/doil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ docker run --rm "${TERMINAL}" \
-v /etc:/etc \
-v /var/log:/var/log \
-e PHP_INI_SCAN_DIR=/srv/php/mods-available \
-e SUDO_UID="$SUDO_UID" \
$GLOBAL_INSTANCES_PATH \
-w $(pwd) \
$MAP_USER \
Expand Down

0 comments on commit 54e5b59

Please sign in to comment.