Tcp ipWhiteList working example?

I have been unable to get the ipWhiteList middleware to work with a tcp router. Can anyone provide a working example or perhaps point out the error in my configuration?

Right now I am getting this error:

"Cannot start the provider *file.Provider: /config/traefik-tcp.yaml: field not found, node: middlewares"

If I remove the middleware and definition then it loads the file.

tcp:
  routers:
    pfsense:
      service: service-pfsense
      middlewares:
        - "pf-whitelist"
      rule: "HostSNI(`mydomain.com`)"
      tls:
        passthrough: true
  middlewares:
    pf-whitelist:
      ipWhiteList:
        sourceRange:
          - "192.168.1.0/24"
          - "10.0.8.0/24"
  services:
    service-pfsense:
      loadBalancer:
        servers:
          - address: "192.168.1.1:443"

I am also having this issue when attempting to use ipWhiteList for a TCP router:

time="2021-08-16T13:08:09-05:00" level=error msg="Error occurred during watcher callback: /etc/traefik/tcp.toml: error reading configuration file: /etc/traefik/tcp.toml - open /etc/traefik/tcp.toml: no such file or directory" providerName=file
time="2021-08-16T13:08:09-05:00" level=error msg="Error occurred during watcher callback: /etc/traefik/tcp_safe_save_130809.toml: field not found, node: middlewares" providerName=file
time="2021-08-16T13:08:09-05:00" level=error msg="Error occurred during watcher callback: /etc/traefik/tcp_safe_save_130809.toml: error reading configuration file: /etc/traefik/tcp_safe_save_130809.toml - open /etc/traefik/tcp_safe_save_130809.toml: no such file or directory" providerName=file
time="2021-08-16T13:08:09-05:00" level=error msg="Error occurred during watcher callback: /etc/traefik/tcp.toml: field not found, node: middlewares" providerName=file
time="2021-08-16T13:08:09-05:00" level=error msg="Error occurred during watcher callback: /etc/traefik/tcp.toml: field not found, node: middlewares" providerName=file
time="2021-08-16T13:08:09-05:00" level=error msg="Error occurred during watcher callback: /etc/traefik/tcp.toml: field not found, node: middlewares" providerName=file

I did find this documentation which seems to indicate my configuration is correct.

Edit: I've just seen it looks like TCP middleware won't be until 2.5.x (Release v2.5.0-rc2 · traefik/traefik · GitHub)

Edit #2: I can confirm updating my Traefik Docker container to the 2.5 tag does allow the ipWhiteList middleware to work for TCP.

time="2021-08-16T14:44:52-05:00" level=error msg="Connection from 68.235.52.123:12802 rejected: \"68.235.52.123:12802\" matched none of the trusted IPs" middlewareName=ipwhitelist@file middlewareType=IPWhiteListerTCP
time="2021-08-16T14:44:54-05:00" level=error msg="Connection from 3.144.121.130:33444 rejected: \"3.144.121.130:33444\" matched none of the trusted IPs" middlewareName=ipwhitelist@file middlewareType=IPWhiteListerTCP
time="2021-08-16T14:44:54-05:00" level=error msg="Connection from 3.144.121.130:33456 rejected: \"3.144.121.130:33456\" matched none of the trusted IPs" middlewareType=IPWhiteListerTCP middlewareName=ipwhitelist@file
time="2021-08-16T14:44:54-05:00" level=error msg="Connection from 3.144.121.130:33498 rejected: \"3.144.121.130:33498\" matched none of the trusted IPs" middlewareType=IPWhiteListerTCP middlewareName=ipwhitelist@file

Hopefully we see 2.5 in the latest tag soon!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.