d-Rickyy-b / certstream-server-go

This project aims to be a drop-in replacement for the certstream server by Calidog. This tool aggregates, parses, and streams certificate data from multiple certificate transparency logs via websocket connections to the clients.
MIT License
81 stars 9 forks source link

Whitelist in Webserver configuration #33

Closed drego85 closed 5 months ago

drego85 commented 5 months ago

Hi, if I try to add the parameter "whitelist" in the file config.yaml in the Webserver section I can't start the certstream server, it returns this error:

2024/02/16 17:10:38 main.go:26: Starting certstream-server-go v1.5.1
2024/02/16 17:10:38 config.go:45: Reading config file 'config.yml'...
2024/02/16 17:10:38 config.go:75: Config file '/root/config.yml' does not exist
2024/02/16 17:10:38 config.go:94: File '/root/config.yaml' exists
panic: chi: all middlewares must be defined before routes on a mux

goroutine 1 [running]:
github.com/go-chi/chi/v5.(*Mux).Use(...)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.11/mux.go:102
github.com/d-Rickyy-b/certstream-server-go/internal/web.NewWebsocketServer({0x40000aab00, 0xc}, 0x1f90, {0x0, 0x0}, {0x0, 0x0})
    /home/runner/work/certstream-server-go/certstream-server-go/internal/web/server.go:271 +0x348
main.main()
    /home/runner/work/certstream-server-go/certstream-server-go/cmd/certstream-server-go/main.go:33 +0x240

The configuration file is composed as follows:

webserver:
  listen_addr: "192.168.20.20"
  listen_port: 8080
  full_url: "/full-stream"
  lite_url: "/"
  domains_only_url: "/domains-only"
  cert_path: ""
  cert_key_path: ""
  whitelist:
    - "192.168.20.23"

prometheus:
  enabled: false
  listen_addr: "192.168.20.20"
  listen_port: 8090
  metrics_url: "/metrics"
  expose_system_metrics: false
  real_ip: false
  whitelist:
    - "127.0.0.1/8"

Can you help me?

Thanks

d-Rickyy-b commented 5 months ago

Thanks for reporting. I found the issue and fixed it. I'll tag a new version in a couple of minutes.

Updating to v1.5.2 should fix the issue for you.