Skip to content

Conversation

@candrews
Copy link
Contributor

@nikic
Copy link
Member

nikic commented Jul 5, 2016

@remicollet You recently committed d53fa7f, which looks related. What do you think about this PR?

@SjonHortensius
Copy link
Contributor

FYI: I have been running php-fpm for more than a year with ProtectHome / ProtectSystem / PrivateDevices and never experienced any issues

@remicollet
Copy link
Member

remicollet commented Jul 19, 2016

I'm mostly fine with this change, excepted for ProtectSystem=full which also protect /etc, and can break packaged applications (downstream) which save their configuration there (and so may need write access)

Perhaps a good idea to add comment about each option, see recent addition in https://github.com/memcached/memcached/blob/master/scripts/memcached.service

@candrews please rebase it.

@SjonHortensius
Copy link
Contributor

@remicollet Do you have an example of packages that would need write-access to /etc? I find that highly unlikely. Also; if there would be a distro that needs that, they can always modify / overload the default .service file :)

@candrews
Copy link
Contributor Author

I've rebased and added comments describing the settings. I'm also doubtful that ProtectSystem=full would break anything; it doesn't seem like php should be writing to /etc. I agree with @SjonHortensius that if a distro/user wants to allow writing to /etc (or anything else restricted by these settings) they can override the settings - php should ship secure defaults.

@candrews
Copy link
Contributor Author

candrews commented Aug 8, 2016

Any updates?

@candrews
Copy link
Contributor Author

I've rebased and added additional hardening options added in systemd since I initial created this pull request:
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=true

Since namespaces in particular have been the source of security issues recently, these additions should be good improvements to PHP's security.

@krakjoe
Copy link
Member

krakjoe commented Jan 5, 2017

I want to move on this for you, but @remicollet is our authority on this sort of thing, and is saying he doesn't like some of it ... I hear the arguments against it, but I don't hear his acceptance of them ... so I feel my hands are tied ...

Perhaps @remicollet could come back to us on this ?

Just as a side note ... you're not going to want to hear this ... "secure defaults" is not achievable in most realms of PHP: What we ship is working defaults. It has to be left to package maintainers like Remi, and whoever does windows packages to make sure that they are installed securely (or as securely as possible) ... still, I think in this case we can do something about making it more secure, I'm just offering an explanation as to why your aspiration to ship secure defaults is not met with the kind of applause you were probably hoping for.

@ghost
Copy link

ghost commented Apr 15, 2017

@krakjoe : I definitely understand why changing the defaults is bad due to a lot of existing code, but having a blessed set of recommendations would be nice.

@krakjoe
Copy link
Member

krakjoe commented Apr 17, 2017

Remi is now one of the release managers for 7.2, he is also on holiday this week.

The decision for 7.2 will be left to him and @sgolemon. I'm not happy for it to be merged into 7.1 at this stage in release cycle whatever.

@cmb69
Copy link
Member

cmb69 commented Sep 14, 2018

Can someone review this PR, please? cc @remicollet @bukka

@bukka
Copy link
Member

bukka commented Sep 23, 2018

I agree with @remicollet and would prefer setting ProtectSystem=true instead. If changed, I think it can be merged to master.

@bukka
Copy link
Member

bukka commented Sep 23, 2018

Actually thinking about it, I don't really think that there is any need for a write access to /etc as fpm doesn't change any configuration when running. It just needs a read access unless someone wants to store error log or uds file in it which seems quite strange.

@cmb69
Copy link
Member

cmb69 commented Nov 30, 2018

So is this good to be merged into master, @bukka?

@candrews
Copy link
Contributor Author

candrews commented Dec 5, 2018

Ping?

@bukka
Copy link
Member

bukka commented Dec 6, 2018

I think it should be fine for master.

@cmb69
Copy link
Member

cmb69 commented Dec 12, 2018

Thanks, @candrews! Applied as 40c4d7f.

@cmb69 cmb69 closed this Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants