Req #72510 [NEW]: systemd service should be hardened
| From: | candrews at integralblue dot com | Date: | Tue, 28 Jun 2016 20:05:15 +0000 |
| Subject: | Req #72510 [NEW]: systemd service should be hardened | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201894@lists.php.net to get a copy of this message | ||
From: candrews at integralblue dot com
Operating system: Linux
PHP version: Irrelevant
Package: FPM related
Bug Type: Feature/Change Request
Bug description:systemd service should be hardened
Description:
------------
The php-fpm systemd service, php-fpm.service, should use be hardened as
much as possible against potential attacks. Besides reducing the
likelihood of an attack, if php does get compromised, there will be less
damage possible.
I suggest these features be added to the systemd units:
---------------
ProtectHome=true
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
# Required for dropping privileges and running as a different user
CapabilityBoundingSet=CAP_SETGID CAP_SETUID
---------------
I tested these settings and didn't experience any problems in my
(admitted limited) setup. I think they should be fine for anyone except
for exceptional and odd situations (ex, php-fpm is setup to read files
from /tmp that another services writes to /tmp). For the (very rare)
impacted user, they can always override the systemd service - but a
secure configuration should be the default.
Test script:
---------------
n/a
Expected result:
----------------
n/a
Actual result:
--------------
n/a
--
Edit bug report at https://bugs.php.net/bug.php?id=72510&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72510&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72510&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72510&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72510&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72510&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72510&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72510&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72510&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72510&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72510&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72510&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72510&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72510&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72510&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72510&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72510&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72510&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72510&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72510&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72510&r=mysqlcfg