Securing the Perimeter around Your Microservices Wojciech Lesniak - - PowerPoint PPT Presentation

securing the perimeter around your microservices
SMART_READER_LITE
LIVE PREVIEW

Securing the Perimeter around Your Microservices Wojciech Lesniak - - PowerPoint PPT Presentation

Securing the Perimeter around Your Microservices Wojciech Lesniak AUTHOR @voit3k Module Overview Basic Certificates Tokens, JWT Oauth2, OpenID authentication Connect Identity provider Microservices API Gateway Challenges with Edge


slide-1
SLIDE 1

@voit3k

AUTHOR

Wojciech Lesniak

Securing the Perimeter around Your Microservices

slide-2
SLIDE 2

Basic authentication

Module Overview

Certificates Tokens, JWT Oauth2, OpenID Connect

slide-3
SLIDE 3

Microservices Identity provider API Gateway

slide-4
SLIDE 4

Challenges with Edge Security

slide-5
SLIDE 5

External API consumers

slide-6
SLIDE 6

Human (User) Non-human (Service or system)

Type of API Consumer

slide-7
SLIDE 7

Authe uthenti nticati tion The process of identifying who the consumer is. Autho uthoriza zati tion The process of identifying what the consumer can do.

Authentication / Authorization

slide-8
SLIDE 8

Every user or service consumer has the bare minimum privileges which are essential to perform their tasks.

Principal of Least Privilege

slide-9
SLIDE 9

Principal of Least Privilege

Limits the blast radius of any compromise to your system.

slide-10
SLIDE 10

Human (User) Non-human (Service or system)

Type of API Consumer

slide-11
SLIDE 11

Human Users

Client Victoria /victoria Microservice

slide-12
SLIDE 12

Can you trust that the client is in-fact acting

  • n behalf of the user and has their consent

to do so?

Delegation Problem

slide-13
SLIDE 13

Proprietary data User data User Clients

slide-14
SLIDE 14

Authenticate user (resource owner) Get their consent to authorize client access to their resources

Delegated Access

slide-15
SLIDE 15

Delegated Authorization

Victoria Joe Withdraw Delegate

slide-16
SLIDE 16

API Gateway: Exposing Your API Securely

slide-17
SLIDE 17

Data Access Support REST Data Access Portfolio REST

Transition to Microservices

Data Access Pricing REST Data Access Pricing Support HTML Portfolio REST

PORT: 80

Account

in-process

Session

PORT: 8080 PORT: 8081 PORT: 8082

slide-18
SLIDE 18

Data Access Support REST Data Access Portfolio REST Data Access Pricing REST

PORT: 8080 PORT: 8081 PORT: 8082

Clients Microservices

slide-19
SLIDE 19

Data Access Support REST Data Access Portfolio REST Data Access Pricing REST

PORT: 8080 PORT: 8081 PORT: 8082

Clients Microservices API Gateway

Audit logs QOS checks Throttling DOS prevention

slide-20
SLIDE 20

Development team can focus more on business requirements rather then non- functional security requirements.

slide-21
SLIDE 21

Each microservice should perform one function and do it well.

Single Responsibility Principal

slide-22
SLIDE 22

Benefits of an API Gateway

Avoids the need for shared libraries making

  • ur architecture polyglot.
slide-23
SLIDE 23

Defensive Structures

slide-24
SLIDE 24

Basic- username / password Static API key Client id and client secret OpenID connect SAML Fingerprinting Certificates

slide-25
SLIDE 25

Clients

API Gateway Firewall MITM API Gateway API Gateway API Gateway

slide-26
SLIDE 26

Considering Basic Authentication

slide-27
SLIDE 27

Basic Authentication

username:password

dXNlcm5hbWU6cGFzc3dvcmQK

Base64 encoded

He Heade der na name me Va Value Authorization Basic dXNlcm5hbWU6cGFzc3dvcmQK

slide-28
SLIDE 28

Authentication is more complex then just a username and password, requiring 2 Factor or Multifactor.

Why Basic Is Not Suitable for Microservices

For persistent login the credentials would have to be stored on the client. In a distributed system, credentials are exposed to multiple services. Delegation can only be done by requesting the users credentials.

slide-29
SLIDE 29

Authenticating Clients with Certificates

slide-30
SLIDE 30

Data Access Support REST Data Access Portfolio REST Data Access Pricing REST

PORT: 8080 PORT: 8081 PORT: 8082

Clients Microservices

API Gateway Firewall MITM

slide-31
SLIDE 31
slide-32
SLIDE 32

At minimum TLS 1.2 or higher

slide-33
SLIDE 33

Public / private key, signed by CA

Certificate Authority Client

Public / private key, signed by CA

API Gateway mTLS

slide-34
SLIDE 34

Transport Layer Security (TLS)

Certificate issuers by CA CA public key, verify server

slide-35
SLIDE 35

Challenges with mTLS

Does not solve the delegated access or the confused deputy problem. You have to maintain a Public Key Infrastructure and your Certificate Authority. Key provisioning, bootstrapping, and rotation, and invalidating keys can be challenging as the number of clients and services increases.

slide-36
SLIDE 36

Introducing Tokens

slide-37
SLIDE 37

Clients Microservices

API Gateway Firewall Authenticate Portfolio Support Pricing STS Introspection Get resource

slide-38
SLIDE 38

Name: Victoria Email: vic@email.com

Opaque Tokens – by Reference

1234567 Id:1234567 Identity Provider

slide-39
SLIDE 39

A security token with the property that any party in possession of the token (a "bearer") can use the token in the same way that any other party with possession can.

Bearer T

  • ken
slide-40
SLIDE 40

Benefits of Tokens

Microservices are never exposed to the users or clients password. “Single responsibility Principal” your microservices development teams don’t need to focus on non-functional security requirements. Tokens can be used to provide delegated authorization.

slide-41
SLIDE 41

Identity Provider

slide-42
SLIDE 42

Human user like Victoria

Subject – Entity Requesting Access

Machine Software

slide-43
SLIDE 43

Username: victoriaN name: Victoria Smith dob: 15/05/1988 Email: vic@send.com Address: 1 Bond st London gender: Female Username: victoriaN Email: vic@send.com Address: 1 Bond st London gender: Female dob: 15/05/1988 name: Victoria Smith name: Victoria Smith Address: 1 Bond st London gender: Female dob: 15/05/1988

Subject Principals

slide-44
SLIDE 44

Coupling Application and Identity data

Data Access Support REST Data Access Portfolio REST principal principal principal Get principal Get principal Get principal

sync sync

API Gateway application application

slide-45
SLIDE 45

Micros

  • serv

rvices (Ex (Except pt for the

  • r the D

Data ta)

Data Access Support REST Data Access Portfolio REST principal API Gateway Monolithic data store App data App data Get principal Get principal Get principal

slide-46
SLIDE 46

A service that manages the creation, maintenance of identity information for principals.

Identity Provider

slide-47
SLIDE 47

Manage and provider single sign in for all users in your applications, systems, and networks centrally.

Authentication as a service (AaaS)

slide-48
SLIDE 48

Clients Microservices

API Gateway Firewall Authenticate Portfolio Support Pricing Identity provider STS Authz Server Verify Get resource

slide-49
SLIDE 49

Identity Provider

Victoria Client API Gateway Microservices Portfolio Support Pricing /portfolio 401 Unauthorized

slide-50
SLIDE 50

Relaying Party

Victoria Client API Gateway Microservices Portfolio Support Pricing Identity provider LDAP principal /portfolio

slide-51
SLIDE 51

Identity Provider Can Become a Bottleneck

Identity provider verify

slide-52
SLIDE 52

By-value Tokens

slide-53
SLIDE 53

By-value Token

username: victoria name: Victoria Lesniak Derpartment: reserch

slide-54
SLIDE 54

Claims define what the subject is and is not.

Claims-based identity

slide-55
SLIDE 55

By-value Token

username: victoria name: Victoria Lesniak derpartment: reserch

Identity provider LDAP principal

Signed with providers private key

slide-56
SLIDE 56

A signed token without the expiration date is worse than a password.

slide-57
SLIDE 57

What format should your by-value token be?

slide-58
SLIDE 58

A standard token format.

Answer

slide-59
SLIDE 59

Different Token Formats Introduce Complexity

slide-60
SLIDE 60

1990s

Kerberos Protocol specific

2002

SAML Protocol specific

2015

JWT Protocol agnostic

Evolution of Security Tokens

slide-61
SLIDE 61

1990s

Kerberos Protocol specific

2002

SAML Protocol specific

2015

JWT Protocol agnostic

Evolution of Security Tokens

slide-62
SLIDE 62

1990s

Kerberos Protocol specific

2002

SAML Protocol specific

2015

JWT Protocol agnostic

Evolution of Security Tokens

slide-63
SLIDE 63

JSON Web Token (JWT)

slide-64
SLIDE 64

JWT Optional Standard Claims

Cla laim im Desc scripti ption jti Unique token identifier iss Issuer – who issued the token sub Subject – Who the claims represent. aud Audience – The recipient the token was meant for. exp Expiration – Until when the token is valid iat Issued at – The time the token was issued.

slide-65
SLIDE 65

JWTs can also be encrypted to prevent the content being read by unwanted parties, using the JSON Web Encryption (JWE) specification.

slide-66
SLIDE 66

Javascript Object Signing and Encryption (JOSE)

JSON Web Token (JWT)

(JWA) JSON Web Algorithm (JWS) JSON Web Signature (JWE) JSON Web Encryption

slide-67
SLIDE 67

Delegated Authorization with OAuth2

slide-68
SLIDE 68

OAuth2 is an open standard used to allow entities to grant limited access to their resources, without sharing their credentials.

Open Authorization (OAuth2)

slide-69
SLIDE 69

Actors in OAuth

Protected resource Resource Owner

  • wns

Resource server protects Client Issues access token to client Authorization server

slide-70
SLIDE 70

OAuth2 Authorization Code Grant

Crypto Portfolio User Browser

client id secret client id secret

  • 1. Sign-in
  • 2. Redirect to auth-server <client id>
  • 7. Forward auth code
  • 11. /portfolio

Victoria Client

Authorization server Resource Server

https/ /auth-server-uri/ ?client_id=crypto-portfolio&scope=profile,portfolio&response_type=code &redirect_uri=crypto-portfolio-uri&state=987654 Crypto Portfolio would like to access your profile and portfolio data. Approve https/ / crypto-portfolio-redirect-uri /?code=123456&state=987654 http POST: code:123456 client_id: crypto-portfolio client_secret: secret

slide-71
SLIDE 71

Other Grant Types

Client credentials

slide-72
SLIDE 72

Sign-in with OAuth2

slide-73
SLIDE 73

The Reasons for OpenID Connect

slide-74
SLIDE 74

OAuth2 is for delegated authorization and not designed for authentication.

slide-75
SLIDE 75

Proprietary data User data User Clients

slide-76
SLIDE 76

Authenticate user (resource owner) Get their consent to authorize client access to their resources

Delegated Access

slide-77
SLIDE 77

User data

Authentication with OAuth2

id: victoria name: Victoria Lesniak email: vic@email.com

Victoria Client Oauth2 Session victoria

slide-78
SLIDE 78

OAuth2 is proof of possession not proof of identity.

slide-79
SLIDE 79

OIDC – Authentication layer OAuth2 – Delegated authorization

slide-80
SLIDE 80

Options for API Gateway and Authorization Server

slide-81
SLIDE 81

API Gateway Options

Spring Cloud Gateway

slide-82
SLIDE 82

Identity Provider / Authorization Server

Cloud Foundry UAA Gluu Keycloak

slide-83
SLIDE 83

Opensource. 3M+ downloads. Built on top of NGINX. Offers 60+ plugins. Sub millisecond latency. Platform agnostic, scalable. Adopted by many global enterprises.

slide-84
SLIDE 84

Recap

slide-85
SLIDE 85

Wrap up

slide-86
SLIDE 86

Data Access Support REST Data Access Portfolio REST Data Access Pricing REST

PORT: 8080 PORT: 8081 PORT: 8082

Clients Microservices

API Gateway Firewall Authz provider authenticate verify

slide-87
SLIDE 87

Defence in depth Zero trust

Service-to-Service Security