Closed TechnoSwiss closed 1 year ago
Hmm, that's odd. Your configuration looks good, but the stacktrace is complaining about a cert name mismatch. I didn't spot any glaring issues when I took a quick glance at the code, so I'll try and reproduce this.
I have the source code up on another machines, same error not unexpected since I'm still trying to communicate with the same influx server. I was able to follow along and very that ServicePointManager.ServerCertificateValidationCallback
is getting set correctly based on either of the certificate_verification options I've tried, but from the stacktrace it feels like it's ignoring that. I do mostly embedded C++, but am familiar with C# however trying to track down how to look at the cert. that's coming back in the debugger I'm feeling a little out of my depth.
I have good news and bad news. The bad news is that the reason the verification is failing is that the global cert check does not work with the .net version OhmGraphite uses: https://github.com/dotnet/runtime/issues/26048#issuecomment-386030456
And unfortunately, due to the abandonment of the C# influxdb v1 client, there is no hope in getting this officially supported.
The good news is that there is a workaround if the cert is installed machine-wide. Here is how I reproduced:
On influxdb machine (referenced via, vm-ubuntu), generate the cert:
mkdir ssl
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
-keyout ssl/ohm.key -out ssl/ohm.crt -subj "/CN=vm-ubuntu" \
-addext "subjectAltName=DNS:vm-ubuntu,IP:172.22.24.52"
Start influxdb v1 with:
version: "3"
services:
influxdb:
image: influxdb:1.8
ports:
- "8086:8086"
volumes:
- influxdb:/var/lib/influxdb
- ./ssl:/etc/ssl/
environment:
- INFLUXDB_DB=db0
- INFLUXDB_ADMIN_USER=admin
- INFLUXDB_ADMIN_PASSWORD=supersecretpassword
- INFLUXDB_HTTP_HTTPS_ENABLED=true
- INFLUXDB_HTTP_HTTPS_CERTIFICATE=/etc/ssl/ohm.crt
- INFLUXDB_HTTP_HTTPS_PRIVATE_KEY=/etc/ssl/ohm.key
- INFLUXDB_HTTP_AUTH_ENABLED=true
volumes:
influxdb:
Copy ohm.crt
onto OhmGraphite machines, then import the cert with powershell
Import-Certificate -FilePath .\ohm.crt -CertStoreLocation 'Cert:\LocalMachine\Root'
Now the cert will be trusted without needing to specify certificate_verification
Can you try this out for me @TechnoSwiss . If it works, I'll deprecate certificate_verification
and replace it with these instructions.
That does the trick, I'd tried pointing OhmGraphite at the cert, but I hadn't tried importing it into the system. Thank you.
Sounds good, thanks for testing. I've added these to the docs.
Connecting to my influx DB server with the following config
I've been running OhmGraphite stand alone, and keep getting an SSL error message (with either the systems cert, or setting the value to false).