IIS Reverse Proxy to rewrite to internal Authentication Module (Keycloak) - iis

maybe someone can help me out.
I have a publicly accessible IIS Web Server (DMZ) with ARR enabled and use that IIS as a reverse proxy to rewrite all requests to an internal Website (QlikSense). So far so good. I sucessfully implemented keycloak as my Authentication module which is currently also installed on that external accessible DMZ server. Here comes my issue. Whenever I request the external URL, it sucessfully redirects me to my internal application (url rewrite) , and from there (over a redirect Uri) back to the keaycloak instance (which sits on the DMZ server) for authentication. Everything works fine but from an architectual point that setup is questoinable in my eyes. I would like the authentication to be happening internally and not on my DMZ server (behind the Reverse Proxy). But all my attempts to make keycloak authenticate on an internal installation failed so far (page cannot be opend because server not found). What do I miss to make external requests being rewritten to the internal keycloak server without getting the error that SAFARI CANNOT OPEN THE PAGE BECAUSE THE SERVER CANNOT BE FOUND ?
I would like to have the authentication part being handeld internally (behind reverse Proxy) and not externally, since port 8080 needs to be open on the DMZ which is a security issue...
thanks

Related

I want some users to continue using HTTP while others should use HTTPS

I have recently switched my website from HTTP to HTTPS. For some external users, they do not have enough permissions to access via HTTPS and they still need to access via HTTP.
I want to keep both HTTP and HTTPS, but HTTP only for a specific group of users.
How to make this change in IIS 8?
Any ideas, please suggest.
You can try the following steps:
Step1: configure https.
Set IIS to work with HTTPS (http://learn.iis.net/page.aspx/144/how-to-set-up-ssl-on-iis-7/ )
Test HTTPS locally to make sure that it works.
In your firewall (to Internet), configure it so that it allows port 443 (https) to your IIS server.
This will allow ALL people to access your website using https, since we have not configured any restrictions.
Steps2: configure http.
Install WindowsAuthenticationModule if it is not already installed
In IIS Manager, click the website.
Double click Authentication in the middle pane
Select Windows Authentication and enable it
Select Anonymous Authentication and disable it.
Since the users on your local network is authenticated to AD, and the website is in their local zone, they should automatically authenticate and should not see the login box. People outside your network are not authenticated, hence should need to logon to access the website.

Windows Authentication on IIS and Proxy to Node with User/Roles in Header?

I am running IIS and Node in parallel on a Windows Server. Is it possible to allow IIS intercept HTTPS requests, authentic them using Windows Authentication (Negotiate/NTLM), then proxy the requirements onto Node as HTTP requests with username and security groups in the header for Node to process?
As far as I know, it is possible to use windows authentication before proxy request. Windows authentication is to authenticate people through the local Windows network. There is no proxy server or even a proxy server. Protocol does not authenticate HTTP sessions, but authenticates the underlying TCP connection.
IIS can also proxy the request to Node, as long as the request is rewritten using ARR and URL rewrite.
However, IIS itself cannot obtain the user name and security group information, and requires the help of ASP.NET applications.

How to completely force https only for website including for requests outside a browser?

We have an azure website, where we have the https only setting turned on, and we also have url rewrite rules set up as well so that when you go to our site at http://example.com (we have a custom domain that is secured with a cert using IP SSL - both example.com and www.example.com), you get redirected to https://example.com. When using a web browser, this clearly works. However, when using a tool such as Postman or vulnerability scanning, such as ZAP, the server is clearly responding to http and not redirecting the request to https. We are currently failing a vulnerability scan due to this, and we cannot figure out what else to do to get the site to force https. As I said, it works when using a web browser, but not with direct web requests from non-browser tools. Thanks!

URL Rewrite, ARR and SSO AzureAD with OWIN OpenIdConnect using wrong URL

I am currently using the IIS URL Rewrite Module and Application Request Routing on a server in the DMZ to forward requests to a web application running on an internal server.
The application which is deployed on the internal server has SSO which includes Azure AD using OWIN pipeline and openIdConnect.
When a user selects the authenticate using AzureAD option instead of being redirected to the https://login.microsoftonline.com/<tenantname>/...
they are redirect to http://my.company.com/<tenantname>/... where http://my.company.com is the URL used to access the application from the DMZ.
The SSO works for all internal instances i.e. where request are not being forwarded in a reverse proxy scenario.
Why is this happening when using URL Rewrite and ARR?
Unchecking the Reverse rewrite host in response headers checkbox under Application Request Routing Cache > Server Proxy Settings solved this issue.
Reverse rewrite host in response headers (checked)
ARR will rewrite the host name in the location header of a 301
response to the original host.
URL Rewrite keeps original host Location
IIS Url Rewrite ARR issue

IIS and Reverse Proxy with Authentification

I'm using IIS7 with URLRewrite and Application Request Routing (ARR) as a reverse proxy. So I can point all requests from http://localhost/external to http://external/external
This is all working fine in my development set up. However on the client site they have a proxy between the web server and the internet (I'll refer to this as the middle proxy).
I've set up the proxy details for ARR, but the middle proxy requires authentification, so any requests are met with:
'http error', 407, 'Proxy Authentication Required'
I presume I need to grant the Application Pool user (of the site using URLRewrite/ARR) access to the internet on the middle proxy? Is this the best approach to take, and if so which account should be used? There don't seem to be any ARR options to add a username/password.
Note this was posted 2 years ago on ServerFault without response, I have now deleted the original which was at - https://serverfault.com/questions/289083/iis-and-reverse-proxy-with-authentification

Resources