pool-apparmor-basic.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --TEST--
  2. FPM: AppArmor basic test
  3. --SKIPIF--
  4. <?php
  5. include "skipif.inc";
  6. $config = <<<EOT
  7. [global]
  8. error_log = /dev/null
  9. [unconfined]
  10. listen = {{ADDR}}
  11. pm = dynamic
  12. pm.max_children = 5
  13. pm.start_servers = 2
  14. pm.min_spare_servers = 1
  15. pm.max_spare_servers = 3
  16. apparmor_hat = a
  17. EOT;
  18. FPM\Tester::skipIfConfigFails($config);
  19. ?>
  20. --FILE--
  21. <?php
  22. require_once "tester.inc";
  23. $cfg = <<<EOT
  24. [global]
  25. error_log = {{FILE:LOG}}
  26. [unconfined]
  27. listen = {{ADDR:UDS}}
  28. pm = dynamic
  29. pm.max_children = 5
  30. pm.start_servers = 2
  31. pm.min_spare_servers = 1
  32. pm.max_spare_servers = 3
  33. apparmor_hat = a
  34. EOT;
  35. $tester = new FPM\Tester($cfg);
  36. /* libapparmor has a bug which can cause SIGSEGV till Version 2.8.0-0ubuntu28
  37. See https://bugs.launchpad.net/apparmor/+bug/1196880
  38. Possible outcomes:
  39. - SIGSEGV|failed to query apparmor confinement
  40. apparmor not running
  41. - failed to change to new confinement
  42. something in apparmor went wrong
  43. - exited with code 70
  44. Change to successful; Hat not existent (Process gets killed by apparmor)
  45. */
  46. $tester->runTill(
  47. '/(SIGSEGV|failed to query apparmor confinement|' .
  48. 'failed to change to new confinement|exited with code 70)/'
  49. );
  50. ?>
  51. Done
  52. --EXPECT--
  53. Done
  54. --CLEAN--
  55. <?php
  56. require_once "tester.inc";
  57. FPM\Tester::clean();
  58. ?>