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

If Apache is already installed on the box, the web settings page system doesn't work #895

Open
3 tasks done
digininja opened this issue Sep 27, 2018 · 9 comments
Open
3 tasks done
Assignees

Comments

@digininja
Copy link

In raising this issue, I confirm the following: {please fill the checkboxes, e.g: [X]}

How familiar are you with the the source code relevant to this issue?:

familiar enough to know what is broken


Expected behaviour:

Changes made on settings.php should stick

Actual behaviour:

The changes don't stick

Steps to reproduce:

The box I installed Pi-hole on already had Apache installed and working so when the web files were installed they dropped into the existing web root and were picked up and served by Apache. The lighttpd server installed never manages to start up.

The scripts/pi-hole/php/savesettings.php page builds up a command which it then runs using exec on line 301.

You've got an entry in a sudoers include file to allow lighttpd to run sudo commands but as I'm apache the sudo command asks for a password which exec can't give it and so fails silently. The $success string that is built up never gets an error, only the second line which says the update worked. I confirmed this by adding the apache user to the sudoers config file you created and re-doing the changes.

I'd suggest a couple of fixes....

  • Have your installer check for existing web servers and handle them gracefully
  • Have the exec calls take the return value as well as just the string that comes back and check that to make sure things work correctly. This will also pick up general bugs or failures rather than just this specific instance.

Troubleshooting undertaken, and/or other relevant information:

@dschaper dschaper self-assigned this Sep 27, 2018
@dschaper
Copy link
Member

I'll add this to the list of things to look and and fix with a rewrite of the installer script.

@digininja
Copy link
Author

ok, sounds good.

@dschaper
Copy link
Member

@Mcat12 Should we track this here in core, or would you like this for the web interface?

@AzureMarker
Copy link
Contributor

This is a core issue, because core should make sure web has the necessary privileges and correct environment to run in. I do see that error handling could be improved for the settings page in this insurance, but it should not have to handle this case.

@dschaper
Copy link
Member

Do we really want core to be enabling sudo nopass for the httpd daemon that we do not install?

@AzureMarker
Copy link
Contributor

The core issue is that the user wants to use a server which we don't support with a config we didn't create. It's not a situation we can easily detect and warn against in the current architecture. The solution is to either use lighttpd, or fix the config manually since it's unsupported. With the upcoming API and web interface, these kinds of issues should not appear.

@dschaper
Copy link
Member

Agreed, the only actions needed are potentially some clarification on the error message or error handling, correct? And that is something to be done on the web side. Is there anything here in core that we can or need to do?

@AzureMarker
Copy link
Contributor

In that case, it can be a web issue that the command status should be checked.

@dschaper dschaper transferred this issue from pi-hole/pi-hole Jan 16, 2019
@UncleSuperman
Copy link

I ran into this as well and the fix was simple. You simply need to update the username in /etc/sudoers.d/pihole from lighttpd to the user your web server is running as (apache, httpd, etc.).

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

No branches or pull requests

5 participants