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

Do not add pihole user to web server group #3226

Merged
merged 1 commit into from
Apr 28, 2020
Merged

Do not add pihole user to web server group #3226

merged 1 commit into from
Apr 28, 2020

Conversation

MichaIng
Copy link
Contributor

By submitting this pull request, I confirm the following:

  • I have read and understood the contributors guide, as well as this entire template.
  • I have made only one major change in my proposed changes.
  • I have commented my proposed changes within the code.
  • I have tested my proposed changes, and have included unit tests where possible.
  • I am willing to help maintain this change if there are issues with it later.
  • I give this submission freely and claim no ownership.
  • It is compatible with the EUPL 1.2 license
  • I have squashed any insignificant commits. (git rebase)

Signed-off-by: MichaIng micha@dietpi.com


What does this PR aim to accomplish?:

  • Cleanup + security
  • The pihole user is currently added to www-data webserver group.
  • This is and was never required: Full systemd support #2900 (comment)
    • As can be seen, after a fresh Pi-hole install with official v5 installer, the only three items with group = www-data + user != dietpi + higher group mode than "others" mode are /var/cache/lighttpd/compress/, /var/cache/lighttpd/uploads/, both with 750 modes, and /var/www/html with 775 mode. Hence as long as Pi-hole does not directly read one of the first two directories or writes to /var/www/html (excluding subdirs!), in fact the www-data group does not add any other permissions. I could not find any hint for both cases.
  • Furthermore I tracked down the Git blame to when this usermod was actually added, to probably find some explanation: Full systemd support #2900 (comment)
    • It was added with the very first automated installer commit as part of the webserver install. At that time the user pi was added to www-data as a regular step to enable the default RPi login user administrating the webroot. The pihole user did not exist at that time and no service/process ran as pi user. The pihole was first introduced as fallback if the user pi does not exist, to have a similar pseudo-admin user on non-RPi devices. Full transition to pihole user was done later, using it as actual run user for services/processes again later. Adding it to www-data group was migrated over the years while the initial reason, to give the default login user some website admin capabilities, is not valid anymore.

How does this PR accomplish the above?:

  • Remove obsolete usermod -a -G www-data pihole.

@dschaper
Copy link
Member

Sounds good, we'll never know why it was added so we'll just have to go on trying to fix what we can.

StackNeverFlow
StackNeverFlow previously approved these changes Mar 25, 2020
@MichaIng MichaIng changed the title Dot not add pihole user to web server group Do not add pihole user to web server group Apr 3, 2020
@MichaIng
Copy link
Contributor Author

MichaIng commented Apr 3, 2020

Btw not a prove but an evidence that pihole user doesn't need to be in webserver group is that we never added it on DietPi and never faced related issues. With Pi-hole v5 it is required the other way round, which causes issues on DietPi v6.28 and is well documented in the code, but skipping usermod -aG www-data pihole still does not cause any issues.

This is and was never required and the pihole user does in fact not get any additional permissions through that group.

Signed-off-by: MichaIng <micha@dietpi.com>
@DL6ER DL6ER merged commit c0cf8db into pi-hole:development Apr 28, 2020
@MichaIng MichaIng deleted the patch-6 branch April 28, 2020 19:32
@PromoFaux PromoFaux mentioned this pull request Jul 5, 2020
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-5-1-released/35577/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants