Reputation: 1437
Afternoon y'all,
Just looking for someone to double check my work. Is the below an effective way to secure microservices?
Breaking up our monolithic application and monolithic Partner API into microservices oriented around specific business functions. They'll most likely be small expressjs applications running in a docker container, on elastic beanstalk, who knows. They'll live somewhere :)
I'm looking into either standing up Kong as my API Gateway or using AWS API Gateway to encapsulate the details of my microservices. Also, it just feels good.
The JWT plugin for Kong will verify the signature of the JWT and then pass the customer_id
along in the header to the microservice. I should also mention that we have 3rd party developers that will be partaking in the integration fun as well. Here's a basic sketch of what I see happening:
There's a nice access control plugin for Kong. Our application and mobile app would run with "God" privileges, but I could definitely lock down the developers to specific routes and methods.
Revoking 3rd party access will be easy, revoking end users access won't be so simple unless I'm willing to invalidate all JWTs at once by generating a new secret. Perhaps I can limit token time to 10 minutes or so and make our applications check if they're expired, get a new token, and then get on with the original request. This way I can "flag" them in the database or something and not let the JWT be generated.
SSL used everywhere, JWT is stored in an SSL only cookie in the web browser and there's no sensitive information stored in any of the claims.
Thanks guys.
Upvotes: 23
Views: 5181
Reputation: 3282
I recently worked on a solution to this very question and premise, refactoring a large monolith into multiple services in an AWS architecture.
There is no right, wrong or definitive how to this question.
However, we did implement a solution very similar to the one described in the question above.
I hope this answer can deliver a good sense of direction for someone who's looking at this for the first time.
This is how we went about it...
pros
cons
pros
cons
We decided to go with Kong.
The major issue with the hosted solution was the inability to route traffic to our private network, where we also host a private DNS zone.
Additionally, the extensible nature of Kong allowed us to create custom plugins with logic that is relevant to our solutions.
We work with an ALB to round robin between multiple instances of Kong in different AZs in order to achieve redundancy and high availability.
The API configuration is saved on a Postgres RDS which is also internal and multi AZ.
Flow
Other
Schema:
Upvotes: 21