Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom PHP pool and user/group per site #41

Closed
andremacola opened this issue Mar 25, 2019 · 16 comments
Closed

Custom PHP pool and user/group per site #41

andremacola opened this issue Mar 25, 2019 · 16 comments
Labels
enhancement New feature or request planned This request will be implemented Stale

Comments

@andremacola
Copy link

Like: wo site create mysite.com --wp --umyuserr:gmygroup

The script create and assign the user and group for the folder, fix the permissions and create the php pool.
RunCloud does exactly like that.

I'm doing this manually everytime

Ex PHP POOL:

[mysite]
listen = 127.0.0.1:9087
listen.owner = www-data
listen.group = www-data
listen.backlog = 65536
pm.status_path = /status
ping.path = /ping
ping.response = pong
user = mysite
group = mysite
pm = ondemand
php_admin_value[open_basedir] = /var/www/mysite:/var/lib/php/session:/tmp

@VirtuBox VirtuBox added the enhancement New feature or request label Mar 25, 2019
@ankitsnlq
Copy link

Hi VirtuBox,

I have noticed that if you have custom php pool configured manually during wordops update Pools get deleted. So please can make wordops update to not remove custom pools configured manually?

@VirtuBox
Copy link
Member

Hello @ankitsnlq,
yes, I will only force www.conf & www-two.conf file deletion instead of removing everything in the pool.d directory

@VirtuBox
Copy link
Member

Issue has been fixed with PR #43

@ankitsnlq
Copy link

Thanks you @VirtuBox Tested it and it is good now. Are you planning per-site PHP pool module in wordops v4.0?

@VirtuBox
Copy link
Member

Hello @ankitsnlq,

this is not planned yet, because there are several other features already planned (wildcard SSL certs, monitoring, backup) but also because it will probably be the biggest change on WO structure and configuration. It will require to run a lot of tests, to see if there is an impact on performances, especially with open_basedir and opcache.

@andremacola
Copy link
Author

What I do is something like this on the nginx

    set $phpfpm_port 9099;
    set $index_https "-https";
# wpsc-php7 replace
location ~ \.php$ {
	try_files $uri =404;
	include fastcgi_params;
	fastcgi_pass 127.0.0.1:$phpfpm_port;
	# Following line is needed by WP Super Cache plugin
	fastcgi_param SERVER_NAME $http_host;
}
# FOR WP-SUPERCACHE
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index$index_https.html $uri $uri/ /index.php?$args;

Fix the permissions on /var/www/domain.ltd folder
chown -R user:group /var/www/domain.ltd
chmod a-w /var/www/domain.ltd

@VirtuBox VirtuBox added this to Backlog in WordOps v4.0 Mar 31, 2019
@michacassola
Copy link

michacassola commented Jul 24, 2019

@andremacola
What are the main benefits? More security?

Will applying cgroups to those users or groups limit the whole site: PHP, NGINX and the Database?

Also found an interesting article: https://ma.ttias.be/a-better-way-to-run-php-fpm/

@andremacola
Copy link
Author

@michacassola with the correct approach yes. The Database itself is already running with a separate user.

Running each website with own user prevents a bunch of security problems.

@VirtuBox VirtuBox moved this from Backlog to In progress in WordOps v4.0 Aug 19, 2019
@VirtuBox VirtuBox added the planned This request will be implemented label Sep 1, 2019
@VirtuBox VirtuBox removed this from In progress in WordOps v4.0 Sep 16, 2019
@kassemz
Copy link

kassemz commented Oct 22, 2019

Yes this would be good to implement and should be the default imo. Each site PHP running under its own user.

@andremacola
Copy link
Author

I had to remove open_basedir from default pool because of performance on a bunch of heavy sites traffic.

@dingman
Copy link

dingman commented Feb 24, 2020

Any updates on this?

Or does anyone have a config implementation of this?

Would really like to see this for increased system security

@dingman
Copy link

dingman commented May 11, 2020

@VirtuBox any updates here? This seems like it would help a lot for security.

@dingman
Copy link

dingman commented Oct 14, 2020

@VirtuBox this seems like the highest security risk right now to this setup. Any updates to when we can expect to have this feature?

@michacassola
Copy link

Additional to separation due to security I also need to distribute/limit resources (that's what I am selling after all together with managing services), that is why I have started using LXD (Linux Containers) on top of my servers for near complete separation. It also gives me the ability to quickly move a complete container to another host server and also do backups in that way through LXD itself.

Copy link

github-actions bot commented Jan 2, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jan 2, 2024
Copy link

github-actions bot commented Jan 7, 2024

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned This request will be implemented Stale
Projects
None yet
Development

No branches or pull requests

6 participants