Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Apr 23, 2024
1 parent 3909f79 commit 3b60ba1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion web/app/Models/HostingSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private function _createLinuxWebUser($model): array
$createLinuxWebUser = new CreateLinuxWebUser();
$createLinuxWebUser->setUsername($systemUsername);
$createLinuxWebUser->setPassword($systemPassword);
$createLinuxWebUserOutput = $createLinuxWebUser->handle();
$createLinuxWebUserOutput = $createLinuxWebUser->handle();

if (strpos($createLinuxWebUserOutput, 'Creating home directory') !== false) {

Expand Down
24 changes: 12 additions & 12 deletions web/tests/Unit/SecurityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ public function testSecurity()
$this->assertTrue($callHostingSubscriptionStoreResponse['status'] == 'ok');
$secondHostingSubscription = $callHostingSubscriptionStoreResponse['data']['hostingSubscription'];

// // Try to open /home directory with linux user
// $output = shell_exec("sudo -H -u ".$hostingSubscription['system_username']." bash -c 'ls -la /home'");
// $this->assertSame($output, null);
//
// // Try to open /home/$user with linux user
// $output = shell_exec("sudo -H -u ".$hostingSubscription['system_username']." bash -c 'ls -la /home/".$hostingSubscription['system_username']."'");
// $this->assertTrue(str_contains($output, 'public_html'));
// $this->assertTrue(str_contains($output, $hostingSubscription['system_username']));
//
// // Try to open /home/$user directory with another linux user
// $output = shell_exec("sudo -H -u ".$secondHostingSubscription['system_username']." bash -c 'ls -la /home/".$hostingSubscription['system_username']."'");
// $this->assertSame($output, null);
// Try to open /home directory with linux user
$output = shell_exec("sudo -H -u ".$hostingSubscription['system_username']." bash -c 'ls -la /home'");
$this->assertSame($output, null);

// Try to open /home/$user with linux user
$output = shell_exec("sudo -H -u ".$hostingSubscription['system_username']." bash -c 'ls -la /home/".$hostingSubscription['system_username']."'");
$this->assertTrue(str_contains($output, 'public_html'));
$this->assertTrue(str_contains($output, $hostingSubscription['system_username']));

// Try to open /home/$user directory with another linux user
$output = shell_exec("sudo -H -u ".$secondHostingSubscription['system_username']." bash -c 'ls -la /home/".$hostingSubscription['system_username']."'");
$this->assertSame($output, null);


}
Expand Down

0 comments on commit 3b60ba1

Please sign in to comment.