bluecmd / fortigate_exporter

Prometheus exporter for Fortigate firewalls
GNU General Public License v3.0
232 stars 72 forks source link

Attempting to use -insecure to prevent using x509: cannot validate certificate #246

Closed Randommmm closed 1 year ago

Randommmm commented 1 year ago

Hi,

I've been trying to setup FortiGate Exporter with Grafana + Prometheus. Thus far, I've created my fortigate-key.yaml and placed it in the location /home/monitor/FortiGate/config/fortigate-key.yaml with the correct API key.

When attempting to run without the -insecure flag, I get:

2023/09/11 05:53:52 FortigateExporter 1.21.0-2-g9da7dd6 ( 9da7dd6 ) 2023/09/11 05:53:52 Loaded 1 API keys 2023/09/11 05:53:52 Fortigate exporter running, listening on ":9710" 2023/09/11 05:53:55 Error: API connectivity test failed, Get "https://172.20.200.1:1443/api/v2/monitor/system/status": x509: cannot validate certificate for 172.20.200.1 because it doesn't contain any IP SANs

Which is to be expected, as I didn't provide a valid cert. I'm not sure how to make one (maybe this might be the better path). But I decided to check the "Issues" page and noticed a few other issues mentioning certs and the common suggestion was to use -insecure, although when adjusting my docker run command to include this argument, I get the following error.

2023/09/12 00:54:34 FortigateExporter 1.21.0-2-g9da7dd6 ( 9da7dd6 ) 2023/09/12 00:54:34 Failed to read API authentication map file: open fortigate-key.yaml: no such file or directory

Both of my commands are the EXACT same, but just with the amended -insecure option:

sudo docker run -d -p 9710:9710 -v /home/monitor/FortiGate/config/fortigate-key.yaml:/config/fortigate-key.yaml quay.io/bluecmd/fortigate_exporter:master

AND

sudo docker run -d -p 9710:9710 -v /home/monitor/FortiGate/config/fortigate-key.yaml:/config/fortigate-key.yaml quay.io/bluecmd/fortigate_exporter:master -insecure

What am I doing wrong? It sems to be correctly loading the key, there should be no syntax issues. Any assistance?

Randommmm commented 1 year ago

duplicate