Giter Club home page Giter Club logo

envoy-kerberos-ntlm-demo's Introduction

Summary

Using Envoy as Reverse Proxy to an upstream WebApplication which uses NTLM or Kerberos as HTTP Authentication Method (aka. IWA - Integrated Windows Authentication)

HTTP NTLM/Kerberos authentication method authenticates connections, not requests. Therefore all client requests must be proxied through the same upstream connection, keeping the authentication context.

The issue which should add this as feature to envoy is not fully solved yet (envoyproxy/envoy#12370).

But there is already a config flag which ensures that upstream connections are not reused by multiple downstream connections.

If connection_pool_per_downstream_connection is true, the cluster will use a separate connection pool for every downstream connection

(https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto)

Testing

Testing that authenticated upstream connections are not used by different clients (downstream connections).

Add UpstreamConnectionID to AccessLogs (available with Envoy 1.30):

UpstreamConnectionID: "%UPSTREAM_CONNECTION_ID%"

Start envoy (Before, you have to adjust the domainnames and the ip to the webapplication of your choice in envoy/envoy.yaml)

sudo docker-compose up

Open incognito window and authenticate with Kerberos/NTLM (generates an authenticated connection)

Then run the following bash script. Expectation is that there is no successful (authenticated) response returned.

while true; do sleep 1; echo "exec"; curl --insecure -v 'https://iwa.example.com' 2>&1 | grep "200"; done;

Negative test: If you set connection_pool_per_downstream_connection to false, than the bash script will return randomly some successful (authenticated) responses. Because the request will hit occasionally an already authenticated connection, which was created by the incognito window.

Channel Binding Token

When a webapplication is endlessly prompting for credentials while proxied through envoy and even typing the correct credentials does not help, than its very likely that it uses Channel Binding Tokens (CBT). This is also known as "Extended Protection for Authentication".

A client executes the Kerberos/NTLM authentication through an TLS-channel with the server. The Channel Binding Token is a property of the TLS-channel, and is used to bind the TLS-channel to the Kerberos/NTLM authentication conversation payload.

In the event of a "man-in-the-middle" attack where the TLS-channel is intercepted and modified, the encryption key will not match anymore to the Kerberos/NTLM authentication conversation payload. The server detects this mismatch, indicating something between the web browser and itself. Consequently, Kerberos authentication fails, and users encounter a 401 error response even if the correct credentials were provided.

Useful Kerberos Commands

  • C:\Windows\System32\klist.exe tickets
  • C:\Windows\System32\klist.exe purge
  • C:\Windows\System32\setspn.exe -F -Q HTTP/iwa.example.com

References

NTLM:

Kerberos:

Channel Binding:

Other:

envoy-kerberos-ntlm-demo's People

Contributors

denniskniep avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.