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

Crash if the TLS certificate is valid for a different domain name #83

Open
kquinsland opened this issue Apr 15, 2021 · 0 comments
Open

Comments

@kquinsland
Copy link

Steps for Reproduction

  1. Set up a reverse proxy that terminates TLS in front of pihole. For example, lets say that the TLS certificate is good for piHole.some-domain.com (that's hole with one e).
  2. Launch binary with the following arguments:
            - name: PIHOLE_HOSTNAME
              value: "piHolee.some-domain.com"

Note: The typo is Holee Should be one e

  1. Run the exporter
  2. Observe in logs:
<...snip...>
 Starting HTTP server
2021/04/15 17:41:33 An error has occured during retrieving PI-Hole statistics Get "https://pihole.some-domain.com:443/admin/api.php?summaryRaw&overTimeData&topItems&recentItems&getQueryTypes&getForwardDestinations&getQuerySources&jsonForceObject&auth=<...>": x509: certificate is valid for pihole.some-domain.com, not piholee.some-domain.com
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x80d88a]
goroutine 54 [running]:
github.com/eko/pihole-exporter/internal/pihole.(*Client).getStatistics(0xc0002803f0, 0xc00003c790)
	/go/src/github.com/eko/pihole-exporter/internal/pihole/client.go:163 +0x2ea
github.com/eko/pihole-exporter/internal/pihole.(*Client).Scrape(0xc0002803f0)
	/go/src/github.com/eko/pihole-exporter/internal/pihole/client.go:61 +0x88
created by main.initPiHoleClient
	/go/src/github.com/eko/pihole-exporter/main.go:37 +0xc5

Expected behavior:

Ideally, no crash :/

Actual behavior:

See stack trace above

Platforms:

Kubernetes on Ubuntu, 64bit intel.

Versions:

Which versions are you running?

image: "ekofr/pihole-exporter:latest" as of 2021-04-14, so the release would be v0.0.11.

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

No branches or pull requests

1 participant