Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ No modules.
| [aws_security_group_rule.ssh](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [local_sensitive_file.signing-key](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource |
| [null_resource.signing-key-fingerprint](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.update_kernel](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [tls_private_key.rsa-4096](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |
| [http_http.cblogin](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |
| [http_http.my-public-ip](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |
Expand Down
3 changes: 3 additions & 0 deletions modules/aws/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ terraform {
source = "hashicorp/aws"
version = ">= 6.0"
}
null = {
source = "hashicorp/null"
}
}
}
23 changes: 23 additions & 0 deletions modules/aws/update-kernel.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
resource "null_resource" "update_kernel" {
depends_on = [aws_instance.cvm]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes it run after the server has been provisioned? and attested?

With the kernel update I believe the measurement would change and thus the first attestation isn't really valid for this enclave then. An attestation after the kernel update would be more accurate.


triggers = {
instance_id = aws_instance.cvm.id
}

connection {
type = "ssh"
user = var.cvm_username
private_key = file(trimsuffix(var.cvm_ssh_pubkey, ".pub"))
host = aws_instance.cvm.public_ip
}

provisioner "remote-exec" {
inline = [
"cloud-init status --wait",
"sudo env DEBIAN_FRONTEND=noninteractive apt-get update",
"sudo env DEBIAN_FRONTEND=noninteractive apt-get install --yes --install-recommends linux-generic",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work on non-debian/ubuntu cloud images? Such as RHEL?

I am not sure what we usually use on CSPs

"if [ -f /var/run/reboot-required ]; then sudo shutdown -r +1 'Kernel update completed'; fi",
]
}
}
1 change: 1 addition & 0 deletions modules/azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ No modules.
| [azurerm_virtual_network.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network) | resource |
| [local_sensitive_file.signing-key](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource |
| [null_resource.signing-key-fingerprint](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.update_kernel](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [tls_private_key.rsa-4096](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |
| [azurerm_resource_group.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [http_http.cblogin](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |
Expand Down
9 changes: 8 additions & 1 deletion modules/azure/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ terraform {
required_version = ">= 1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
source = "hashicorp/azurerm"
version = ">= 4.50"
}
time = {
source = "hashicorp/time"
}
null = {
source = "hashicorp/null"
}
}
}

provider "azurerm" {
features {}
}
23 changes: 23 additions & 0 deletions modules/azure/update-kernel.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
resource "null_resource" "update_kernel" {
depends_on = [azurerm_linux_virtual_machine.cvm]

triggers = {
instance_id = azurerm_linux_virtual_machine.cvm.id
}

connection {
type = "ssh"
user = var.cvm_username
private_key = file(trimsuffix(var.cvm_ssh_pubkey, ".pub"))
host = azurerm_linux_virtual_machine.cvm.public_ip_address
}

provisioner "remote-exec" {
inline = [
"cloud-init status --wait",
"sudo env DEBIAN_FRONTEND=noninteractive apt-get update",
"sudo env DEBIAN_FRONTEND=noninteractive apt-get install --yes --install-recommends linux-generic",
"if [ -f /var/run/reboot-required ]; then sudo shutdown -r +1 'Kernel update completed'; fi",
]
}
}
1 change: 1 addition & 0 deletions modules/gcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ No modules.
| [google_compute_network.cvm](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_network) | resource |
| [local_sensitive_file.signing-key](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource |
| [null_resource.signing-key-fingerprint](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.update_kernel](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [tls_private_key.rsa-4096](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |
| [http_http.cblogin](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |
| [http_http.my-public-ip](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |
Expand Down
5 changes: 4 additions & 1 deletion modules/gcp/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ terraform {
required_version = ">= 1.0"
required_providers {
google = {
source = "hashicorp/google"
source = "hashicorp/google"
version = ">= 7.0"
}
null = {
source = "hashicorp/null"
}
}
}
23 changes: 23 additions & 0 deletions modules/gcp/update-kernel.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
resource "null_resource" "update_kernel" {
depends_on = [google_compute_instance.cvm]

triggers = {
instance_id = google_compute_instance.cvm.id
}

connection {
type = "ssh"
user = var.cvm_username
private_key = file(trimsuffix(var.cvm_ssh_pubkey, ".pub"))
host = google_compute_instance.cvm.network_interface[0].access_config[0].nat_ip
}

provisioner "remote-exec" {
inline = [
"cloud-init status --wait",
"sudo env DEBIAN_FRONTEND=noninteractive apt-get update",
"sudo env DEBIAN_FRONTEND=noninteractive apt-get install --yes --install-recommends linux-generic",
"if [ -f /var/run/reboot-required ]; then sudo shutdown -r +1 'Kernel update completed'; fi",
]
}
}