I'm working on building a web application using the microservice architecture pattern in a set of docker containers and I'm wondering about the importance of securing the communication between the application and the microservices.
The application and microservices will be linked together in a cluster using the --link
option and the microservices will not expose any ports. Communication between the application and microservices will be via HTTP. The application will expose port 80 only.
I've thought about what might happen if the application is compromised - it seems to me that if that happens, the details of any calls made to the microservice APIs will be in the hands of the attacker (including any secret keys, if implemented - see the scheme discussed below), so they'll have access to any data that can be obtained through those API calls, but they won't have access to the database or any other resources that are used exclusively by the microservices. But this is true regardless of whether the API calls are authenticated by the method given above or not.
How secure is this? Do I need to add an additional layer of authentication to the API calls?
I'm considering this scheme for authentication: Designing a Secure REST (Web) API without OAuth
Basically, the idea is that the application and the service have a shared secret which is used to encrypt the message contents in order to determine if the message comes from an authorized source and if it has been tampered with. At present, the APIs will be available only to the application, although at some point in the future it might be helpful to make some microservice APIs available to other applications, potentially not running in docker containers, and I know that a robust authentication scheme will be required at that point - is the scheme discussed above adequate?