Deployer: POSIX disabled on CentOS 7

Created on 10 May 2017  ·  14Comments  ·  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Bug, Question, Feature Request
| Deployer Version | >= 4.3
| Local Machine OS | N/A
| Remote Machine OS | CentOS7

Description

http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7

It looks like posix has been disabled in CentOS 7 due to a security hole. Not sure about the details there... Please consider removing posix commands.

After every single dep command, since 4.3.0, we are getting this error:

 [ERROR] Error: Call to undefined function Deployer\Util\posix_setsid() in
         phar:///usr/local/bin/dep/src/Util/Reporter.php:30
         Stack trace:
         #0 phar:///usr/local/bin/dep/src/Deployer.php(312): Deployer\Util\Reporter::report(Array)
         #1 [internal function]: Deployer\Deployer->collectAnonymousStats(Object(Deployer\Console\CommandEvent))
         #2 phar:///usr/local/bin/dep/src/Console/Application.php(131): call_user_func(Array,
         Object(Deployer\Console\CommandEvent))
         #3 phar:///usr/local/bin/dep/vendor/symfony/console/Application.php(189):
         Deployer\Console\Application->doRunCommand(Object(Symfony\Component\Console\Command\HelpCommand),
         Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
         #4 phar:///usr/local/bin/dep/vendor/symfony/console/Application.php(120):
         Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArrayInput),
         Object(Symfony\Component\Console\Output\ConsoleOutput))
         #5 phar:///usr/local/bin/dep/src/Deployer.php(190):
         Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput),
         Object(Symfony\Component\Console\Output\ConsoleOutput))
         #6 phar:///usr/local/bin/dep/bin/dep(119): Deployer\Deployer->run()
         #7 /usr/local/bin/dep(4): require('phar:///usr/loc...')
         #8 {main}

Steps to reproduce

CentOS 7, deployer 4.3.0, literally any dep command

Content of deploy.php

// N/A

Output log

$ dep list
Deployer 4.3.0

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -f, --file[=FILE]     Specify Deployer file
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help         Displays help for a command
  init         Initialize deployer system in your project
  list         Lists commands
  self-update  Updates deployer.phar to the latest version

 [ERROR] Error: Call to undefined function Deployer\Util\posix_setsid() in
         phar:///usr/local/bin/dep/src/Util/Reporter.php:30
         Stack trace:
         #0 phar:///usr/local/bin/dep/src/Deployer.php(312): Deployer\Util\Reporter::report(Array)
         #1 [internal function]: Deployer\Deployer->collectAnonymousStats(Object(Deployer\Console\CommandEvent))
         #2 phar:///usr/local/bin/dep/src/Console/Application.php(131): call_user_func(Array,
         Object(Deployer\Console\CommandEvent))
         #3 phar:///usr/local/bin/dep/vendor/symfony/console/Application.php(189):
         Deployer\Console\Application->doRunCommand(Object(Symfony\Component\Console\Command\ListCommand),
         Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
         #4 phar:///usr/local/bin/dep/vendor/symfony/console/Application.php(120):
         Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput),
         Object(Symfony\Component\Console\Output\ConsoleOutput))
         #5 phar:///usr/local/bin/dep/src/Deployer.php(190):
         Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput),
         Object(Symfony\Component\Console\Output\ConsoleOutput))
         #6 phar:///usr/local/bin/dep/bin/dep(119): Deployer\Deployer->run()
         #7 /usr/local/bin/dep(4): require('phar:///usr/loc...')
         #8 {main}
bug

Most helpful comment

You can disable it with set('allow_anonymous_stats', false);

All 14 comments

Installing php-process fixed this error, getting our security team to look at it. The information about security vulnerability in that library might be outdated...

Fixed, now there is a check:

if (extension_loaded('pcntl'))

@david-sc Thanks. I have Deployer 5.0.3 and received error Error: Call to undefined function Deployer\Util\posix_setsid() before installing php-process

centos 7.3
received error [Error] Call to undefined function Deployer\Utility\posix_setsid()before installing php-process

$ dep list
Deployer 5.0.3

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -f, --file[=FILE]     Specify Deployer file
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help         Displays help for a command
  init         Initialize deployer system in your project
  list         Lists commands
  self-update  Updates deployer.phar to the latest version
  ssh          Connect to host through ssh

 [Error] Call to undefined function Deployer\Utility\posix_setsid()

 #0 phar:///usr/local/bin/dep/src/Deployer.php(358):
 Deployer\Utility\Reporter::report(Array)
 #1 [internal function]:
 Deployer\Deployer->collectAnonymousStats(Object(Deployer\Console\CommandEvent
 ))
 #2 phar:///usr/local/bin/dep/src/Console/Application.php(140):
 call_user_func(Array, Object(Deployer\Console\CommandEvent))
 #3 phar:///usr/local/bin/dep/vendor/symfony/console/Application.php(189):
 Deployer\Console\Application->doRunCommand(Object(Symfony\Component\Console\C
 ommand\ListCommand), Object(Symfony\Component\Console\Input\ArgvInput),
 Object(Deployer\Console\Output\OutputWatcher))
 #4 phar:///usr/local/bin/dep/vendor/symfony/console/Application.php(120):
 Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console
 \Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
 #5 phar:///usr/local/bin/dep/src/Deployer.php(315):
 Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\I
 nput\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
 #6 phar:///usr/local/bin/dep/bin/dep(119): Deployer\Deployer::run('5.0.3',
 '//deploy.php')
 #7 /usr/local/bin/dep(4): require('phar:///usr/loc...')
 #8 {main}

If php-process is a hard dependency, it might be wise to include this in the composer.json.

Error still exist, Fedora 27, Deployer 6.0.3

[Error] Call to undefined function Deployer\Utility\posix_setsid()

@piotrantosik try to install php-process ext. Also this is really strange as there check. Are you sure in version of dep?

Thanks @antonmedv , after installing php-process works perfectly.

Странная ошибка.
Почему бы не поставить проверку в код, есть ли в системе эта функция. и зачем вообще заставлять устанавливать расширение для php для сбора статистики на сервера Deployer-а, который вроде как отключен?

There is a check for this extension. Maybe this is some old vresions.

Hi,
The posix_setsid function is in the posix extension, not pcntl, so if you have only pcntl and not posix the error is raised.
I think the test should also include extension_loaded('posix')

Can you send pr?

Дело не только в проверке на доступность расширения posix.
Зачем вообще этот код отрабатывает, если я отключил отсылку статистики? Или она не отключается через
set('allow_anonymous_stats', false);

?

You can disable it with set('allow_anonymous_stats', false);

Was this page helpful?
0 / 5 - 0 ratings

Related issues

greatwitenorth picture greatwitenorth  ·  4Comments

dima-stefantsov picture dima-stefantsov  ·  5Comments

osbulbul picture osbulbul  ·  3Comments

brunodevel picture brunodevel  ·  3Comments

khoanguyen96 picture khoanguyen96  ·  5Comments