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

bouncer is not detecting real IP address when server is exposed via cloudflare #22

Open
dhruvinsh opened this issue Mar 28, 2022 · 3 comments

Comments

@dhruvinsh
Copy link

Hi,
I have my server pointing to Cloudflare and authelia is implemented for security purpose. Now when client access the locally hosted website they pass the crowdsec and comes to authelia for credential and then have access to the website. It perfect it works as expected.
But looking at the logs, crowdsec bouncer points out that, IP was from cloudflare, where as my authelia instance do detect real ip address of client. It must be my configuration issue, but can you able to point out what I am doing wrong here?

@fbonalair
Copy link
Owner

Which version of the Bouncer are you using? There's a fix at version 0.3.4 that concern usage of Cloudflare. Can you try that version?
Have you configured Traefik to trust CloudFlare IPs?

@dhruvinsh
Copy link
Author

I am running docker latest image, so it should be upto date.

In my traefik setup for http and https entrypoints I have list of trusted IPs in forwarded header.

what I am hopping to see in the bouncer log is, if from remote country if someone makes call to my server via cloudflare proxy I would see their real IP. I have authelia setup as well and it does detect X-Real-IP without any problem.

@marcuswoy
Copy link

@dhruvinsh a little late, but maybe this will help. I use Cloudflare + traefik + traefik crowdsec.
With this extension you will be able to get the "real IP" via Cloudflare https://github.com/Paxxs/traefik-get-real-ip

    traefik-crowdsec-bouncer:
      forwardauth:
        address: http://traefik-crowdsec-bouncer:8080/api/v1/forwardAuth
        trustForwardHeader: true

    real-ip-cf:
      plugin:
        real-ip:
          Proxy:
            - proxyHeadername: "X-From-Cdn"
              realIP: Cf-Connecting-Ip
              OverwriteXFF: true

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

3 participants