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

IP whitelisting is not possible from host server #16

Open
ghost opened this issue Mar 15, 2018 · 6 comments
Open

IP whitelisting is not possible from host server #16

ghost opened this issue Mar 15, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Mar 15, 2018

I'm trying to whitelist an IP address from the host web server, however I am unable to do so, due to some novel IP address configuration on the server itself. It logs that the traffic is coming from the IP address of the server rather than the loopback address 127.0.0.1.

Is it possible for the IP whitelisting to include the IP address of the server itself? It doesn't look like this is stored in DNN, but it looks like you are able to get it from ASP.NET.

We will need to be certain that the source of IP address cannot be compromised as this would be exploitable.

@bdukes
Copy link
Contributor

bdukes commented Mar 15, 2018

In https://github.com/cantarus/PolyDeploy/blob/78b6127ae1ea8200c8ef1ea233ac6b0d84461535/PolyDeploy/Components/WebAPI/ActionFilters/InWhitelist.cs#L46, consider using HttpRequestBase.IsLocal instead of checking 127.0.0.1

@tomwalters
Copy link

@can-martin-kennish This is likely caused because the server is behind a reverse proxy, thus obscuring the real IP. Is there a way we could inspect the headers to extract an X-Forwarded-For?

There might be some security considerations to make around IP spoofing when doing a direct comparison to 127... so the solution from @bdukes is probably the best bet (although I wouldn't be surprised if the actual implementation is exactly the same.)

@ghost
Copy link
Author

ghost commented Mar 15, 2018

@tomwalters It's not a reverse proxy issue, PolyDeploy has handling for this already built in.

The scenario this occurred in was where the web server had multiple IP addresses bound to it. So it appeared the traffic was coming from one of those rather than the localhost loopback address.

@bdukes
Copy link
Contributor

bdukes commented Mar 15, 2018

The basic logic for IsLocal is in HttpWorkerRequest

@ghost
Copy link

ghost commented Mar 15, 2018

Thanks @bdukes, I'll make the change and see if it resolves the issue we're having in the environment @can-martin-kennish described above.

@ghost ghost added the enhancement New feature or request label Mar 16, 2018
@ghost ghost added bug Something isn't working and removed enhancement New feature or request labels May 31, 2018
@RichardHowells
Copy link

RichardHowells commented May 6, 2021

The scenario this occurred in was where the web server had multiple IP addresses bound to it. So it appeared the traffic was coming from one of those rather than the localhost loopback address.

I just installed v0.9.3

I found the same problem as mentioned above on a machine with multiple IP addresses. It is no longer easy to hack IP addresses into the database as they are no longer stored in human readable form.

I used the following workaround, which is somewhat complex and a PITA...

Then I was able to get to the site using 127.0.0.1 and access the UI for setting up WhiteLists and API Keys.

The machine I am using has multiple installs of DNN and most of the installs have multiple portals. In this situation my workaround is fairly painful.

@can-anierzad - did the change you refer to actually get made? If so it does not seem to help in my situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants