Browse Source

Forbid non-CLI access to command-line scripts

tags/2020.09
Hypolite Petovan 1 month ago
parent
commit
06632536f3
6 changed files with 29 additions and 0 deletions
  1. +5
    -0
      bin/auth_ejabberd.php
  2. +5
    -0
      bin/console.php
  3. +5
    -0
      bin/daemon.php
  4. +4
    -0
      bin/testargs.php
  5. +5
    -0
      bin/wait-for-connection
  6. +5
    -0
      bin/worker.php

+ 5
- 0
bin/auth_ejabberd.php View File

@@ -51,6 +51,11 @@
*
*/

if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}

use Dice\Dice;
use Friendica\App\Mode;
use Friendica\Util\ExAuth;


+ 5
- 0
bin/console.php View File

@@ -20,6 +20,11 @@
*
*/

if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}

use Dice\Dice;
use Psr\Log\LoggerInterface;



+ 5
- 0
bin/daemon.php View File

@@ -23,6 +23,11 @@
* This script was taken from http://php.net/manual/en/function.pcntl-fork.php
*/

if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}

use Dice\Dice;
use Friendica\Core\Logger;
use Friendica\Core\Worker;


+ 4
- 0
bin/testargs.php View File

@@ -26,6 +26,10 @@
*
*/

if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}

if (($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) {
echo $_SERVER["argv"][1];


+ 5
- 0
bin/wait-for-connection View File

@@ -24,6 +24,11 @@
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
*/

if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}

$timeout = 60;
switch ($argc) {
case 4:


+ 5
- 0
bin/worker.php View File

@@ -21,6 +21,11 @@
* Starts the background processing
*/

if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}

use Dice\Dice;
use Friendica\App;
use Friendica\Core\Update;


Loading…
Cancel
Save