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

Tweak CHAOS TXT local.api.ftl #2254

Merged
merged 4 commits into from
Feb 22, 2025
Merged

Tweak CHAOS TXT local.api.ftl #2254

merged 4 commits into from
Feb 22, 2025

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Feb 22, 2025

What does this implement/fix?

Rather recently, #2233 changed the response to dig +short CHAOS TXT local.api.ftl from localhost as hard-coded host name to pi.hole. However, on systems which do not use FTL as their DNS resolver, the later does actually not resolve. The initial trigger for said change was #2192 where a user described that they cannot use the API because they configured their web server to NOT listen on 127.0.0.1 at all.

The PR revisits the initial issue altogether and, instead of using any fixed host name, gets the actual IPs the webserver was bound to and reports this, e.g.

$ sudo pihole-FTL --config webserver.port
80,[::]:80,443s,[::]:443s,127.0.0.67:445s

$ dig CHAOS TXT local.api.ftl +short
"http://127.0.0.1:80/api/" "http://[::1]:80/api/" "https://127.0.0.1:443/api/" "https://[::1]:443/api/" "https://127.0.0.67:445/api/"

For ports not specified with specific IP, CivetWeb binds to the wildcard address (0.0.0.0). We substitute this with 127.0.0.1 as not all clients behave well when 0.0.0.0 is passed to them.


Related issue or feature (if applicable): Fixes #2192. Fixes #2252

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories developmental branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

Signed-off-by: DL6ER <[email protected]>
@DL6ER
Copy link
Member Author

DL6ER commented Feb 22, 2025

Also confirmed working by OP in #2192

@DL6ER DL6ER merged commit e2297ea into development Feb 22, 2025
19 checks passed
@DL6ER DL6ER deleted the tweak/local_api_ftl branch February 22, 2025 18:43
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.

2 participants