Immutable infrastructure can be dramatically more secure
Tags: docker, aws, devops, security
Published: 2018-04-24 04:23:40

---
title: Immutable infrastructure can be dramatically more secure
published: true
description: Using immutable infrastructure to secure cloud-based services.
tags: docker, aws, devops, security
canonical_url: https://www.sensedeep.com/blog/posts/stories/immutable-infrastructure-can-be-dramatically-more-secure.html
cover_image: https://thepracticaldev.s3.amazonaws.com/i/779suj97bx7vjv90ub7v.png
---

*Originally posted at: https://www.sensedeep.com/blog/posts/stories/immutable-infrastructure-can-be-dramatically-more-secure.html*

An immutable server is a server that, once deployed, is never modified, patched or upgraded. It is merely replaced with a new updated instance if required. Immutable infrastructure extends this approach to the entire cloud.

Immutable infrastructure can be inherently more secure by making it much easier to detect when a resource has been maliciously modified.

Chad Fowler [introduced Immutable Servers](http://chadfowler.com/2013/06/23/immutable-deployments.html) in 2013 when he described normal mutable infrastructure as:

> [it] becomes finicky. It only accepts deploys in a certain manual way. The init scripts no longer work unless you do something special and unexpected … the system becomes a house of cards. You fear any change and you fear replacing it since you don’t know everything about how it works.

The beauty of immutable infrastructure is that it not only solves many of these reliability issues, but also transforms security.

## Mutability, the Vector for Compromise

Mutability is oxygen for hackers. Nearly all persistent attacks will modify the underlying system in some way. Such changes include replacing binaries or libraries, adding programs or root kits, opening network ports and modifying critical data. Preventing these changes is key to preventing attacks. Detecting such changes is paramount for an effective defense.

> Although, preventing modifications on a mutable system is hard. Detecting changes on an immutable system is easy.

In a mutable system, that is patched and updated, it is extremely difficult to conclusively know if the changes to the system are authorized or not. Linux makes this especially difficult.

With Linux, binaries and libraries are scattered over many directories: /boot, /bin, /usr/bin, /lib, /usr/lib, /opt/bin, /usr/local/bin and many more. Configuration files are similarly scattered over /etc, /opt/etc, /usr/local/etc, /usr/lib etc. These directories have files that should never be modified and others that are regularly updated. When the system update services run, they often create temporary files in these directories as well. Consequently, it is very difficult to lock down these all these directories and perform authorized system and software updates at the same time.

Through various heroics, you can try to detect which modifications are authorized and only permit system updates during specific time windows. But this also opens windows of opportunity for hackers. Clever attackers can piggyback their hacks to coincide with authorized system updates and thus “sneak through the gate” undetected.

> Immutable servers solve this entire mess. With an immutable server, any change is an indication of compromise — as no modifications are authorized, ever!

When Intrusion Detection Systems are coupled with immutable servers, they can detect changes to the system in real-time and either quarantine, stop or terminate the server immediately.

Extended to the entire cloud, the immutable paradigm enables an entire cloud service to be exactly configured and monitored for any unauthorized changes. It is thus much harder for an attacker to modify or corrupt the service without immediate detection.

On the cloud-side, Terraform can audit the configuration for deviations and can re-apply the desired configuration. On AWS, this means detecting changes to VPCs, service groups, accounts, IAM roles etc.

<img src="https://thepracticaldev.s3.amazonaws.com/i/wjcib4e51ezffbxcpblk.png">

This is the future for secure operation in the cloud. Immutable infrastructure is here to stay and will become the norm. With tools like [Terraform](https://www.terraform.io/), building immutable servers and configurations is easier than ever.


## About SenseDeep

SenseDeep is an observability platform for AWS developers to accelerate the delivery and maintenance of serverless applications.
SenseDeep helps developers through the entire lifecycle to create observable, reliable and maintainable apps via an integrated serverless developer studio that includes design and debugging tools and deep insights into your serverless apps.

To try SenseDeep, navigate your browser to: 

https://app.sensedeep.com.

To learn more about SenseDeep please see: 

https://www.sensedeep.com/product.