Closed CodeFinder2 closed 4 years ago
:wave: Thanks for opening your first issue here! If you're reporting a :bug: bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be usefull.
You shouldn't need the token anymore try using localhost:4865 as the server/port. If it fails still it may need a new release.
Edit - curl -X GET 'http://localhost:4865/admin/api.php?enable
Thanks for your quick reply! Unfortunately, this still doesn't work. I simply removed the "&auth=MY_OLD_TOKEN" part in my curl commands but they do not have any effect.
More ideas? What do you mean with 'it may need a new release', what precisely needs a new release? This addon? 🙈
Thanks again! :-)
Edit: regarding your edit, yes this is exactly the command I have used. :(
From when I tested I believe curl -X GET 'http://localhost:4865/admin/api.php'
would work and get the status, but the enable/disable would fail.
Exactly, status works but enable/disable does not. 🙈
I'm also trying to get this to work. FYI here's the use-case: https://www.reddit.com/r/pihole/comments/bvq5aq/pihole_quick_enabledisable_toggle_for_apples_ios/
I wanted a quick and easy way to toggle my Pi-hole on/off from my phone when needed, so I made a simple iOS Shortcut to take advantage of the API....
Please wait for the next release in which the issue should be resolved.
For my use that works for status but not turning on and off, to turn off I use curl -X GET 'http://localhost:4865/admin/api.php?disable=3600&auth='
I just removed the API token and it worked for me.
Please wait for the next release in which the issue should be resolved.
Any plans for a new release yet?
Inspired by the curl URL, I've found you can use the following configuration for HA:
pi_hole:
host: localhost:4865
api_key: ""
I've successfully ran pi_hole.disable and .enable from HA to control the pi-hole HassIO addon.
So perhaps a minor documentation change is all that's needed. Add the api_key: "" line in this section.
Thanks @wyx087, that's working for me as well (see also here)!
Nonetheless and IMHO, this is considered a bug so it should be fixed as stated by sinclairpaul.
While I am also able to disable the Pi-Hole addon by using the auth='' (empty token) trick, I can do that from any machine on my network. That seems like a security issue.
Any movement on making it possible to set a password for the Pi-Hole addon, so that there's a real API token?
The challenge is around allowing ingress access, and meeting the app security.
https://github.com/hassio-addons/addon-pi-hole/pull/114
This PR would enforce API access from HA/localhost only.
I get that it's a tricky technical challenge. :-)
But, I don't think the right solution is to restrict API access to Home Assistant-only. That would mean that I can only use Home Assistant to enable/disable, which is quite limiting.
For example, I have an iOS app called PHRemote that gives a nice, simple interface for disabling for various lengths of time. And there's a project on GitHub for a similar app, that I've thought about hacking on for my own enjoyment, to have absolute control over the UX.
I get that I can customize my Home Assistant user interface to give me a similarly simple UX. But I'm not the only user on my network, and getting the other residents of the house to use the Home Assistant app, or connect to the web interface, is not a simple undertaking. And blocking them from their Internet memes and other stuff is not going to go over well. I gotta have something simple to offer them.
From the PR May be worth considering making this configurable in the use case of controlling Pi-Hole external to HA?
Please consider that we get numerous requests from different users, in this case, we could enable API token usage again, but you will then also be prompted to login to the application, which then means moving the authentication to ingress becomes invalid.
Unfortunately it really isn't possible to please 100% of the people 100% of the time 😉
PS - I don't believe that Ad guard home has these issues.....
New release is out, please respond if the issue still exists.
Thanks! As already stated above, it was and is still working fine.
However, IMHO the api_key
option is obsolete now and should be removed, don't you think (from the docs as well as from the component config entry in confirmation.yaml)? 🙈
@CodeFinder2 The configuration option still applies to standalone installations of Pi-hole, so that is not correct.
Ahh, thanks! Sorry, that makes sense! 🙏
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.
Problem/Motivation
I am using this switch to temporarily disable pihole blocking which uses curl and the authentication token: https://community.home-assistant.io/t/pi-hole-switch/22004/26
After upgrading pihole to v4.0.0, this doesn't work anymore. The sensor still works fine but this does not use (?) the same interface (I assume).
Expected behavior
Any way to get the API token or to gain access to PiHole's status and enabling/disabling it via curl or the like would do.
Actual behavior
When trying to get the token underMenu, Settings > API / Web interface > Show API token > Yes, show API token just displays "No password set". But no token.
Steps to reproduce
Install pihole and try to get the token, see above.