I have the following docker architecture, orchestrated with a docker compose:
- Service1: Frontend application, react app
- Service2: ExpressJS server
- Service3: Django server
The three applications communicate with each other through HTTP API calls. There is no limit on who can call who. Every application is externally exposed
The user authenticates on the frontend application (Service1) and it resolves a JWT that can be later passed to every other subsequent call, every other service has then an authentication layer to validate the JWT calls.
My question is: How would we validate calls from Service2 to Service3 without any user activity (without JWT)?
This is required for crons or maintenance jobs.
My first solution was to create a docker network with a fixed subnet in our docker-compose, like this:
networks:
our-network:
ipam:
driver: default
config:
- subnet: "172.100.100.0/24"
Then, in Service2 and Service3, I allowed API calls coming from this subnet to be unauthenticated. I worry this could be a security problem and wonder if there are any better solution.