-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Public copy <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8095c9d
commit fdf9442
Showing
5 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
data "imagetest_inventory" "this" {} | ||
|
||
resource "imagetest_harness_docker" "this" { | ||
name = "cli" | ||
inventory = data.imagetest_inventory.this | ||
|
||
privileged = false | ||
} | ||
|
||
resource "imagetest_feature" "openssl_fips" { | ||
count = var.check_openssl_fips ? 1 : 0 | ||
|
||
name = "openssl-fips" | ||
description = "Test OpenSSL FIPS" | ||
harness = imagetest_harness_docker.this | ||
|
||
steps = [ | ||
{ | ||
name = "Testing if FIPS module is available" | ||
cmd = <<EOT | ||
set -euxo pipefail | ||
docker run --rm --entrypoint openssl ${var.image_ref} list -providers | grep -q 'fips' | ||
EOT | ||
}, | ||
{ | ||
name = "Testing if legacy module is unavailable" | ||
cmd = <<EOT | ||
set -euxo pipefail | ||
! docker run --rm --entrypoint openssl ${var.image_ref} list -providers | grep -q 'legacy' | ||
EOT | ||
}, | ||
{ | ||
name = "Testing if MD5 hashing fails" | ||
cmd = <<EOT | ||
set -euxo pipefail | ||
! docker run --rm --entrypoint openssl ${var.image_ref} dgst -md5 /dev/null | ||
EOT | ||
}, | ||
{ | ||
name = "Testing if SHA2-512 hashing succeeds" | ||
cmd = <<EOT | ||
set -euxo pipefail | ||
docker run --rm --entrypoint openssl ${var.image_ref} dgst -sha512 /dev/null | ||
EOT | ||
}, | ||
] | ||
|
||
labels = { type = "container" } | ||
} | ||
|
||
resource "imagetest_feature" "md5" { | ||
count = var.check_openssl_md5 ? 1 : 0 | ||
|
||
name = "md5" | ||
description = "Test md5" | ||
harness = imagetest_harness_docker.this | ||
|
||
steps = [ | ||
{ | ||
name = "Testing if md5 as hash function is available" | ||
cmd = <<EOT | ||
set -euxo pipefail | ||
docker run --rm --entrypoint openssl ${var.image_ref} dgst -list | grep -q md5 | ||
EOT | ||
}, | ||
{ | ||
name = "Testing md5 by computing digest" | ||
cmd = <<EOT | ||
set -euxo pipefail | ||
docker run --rm --entrypoint openssl ${var.image_ref} dgst -md5 /dev/null | ||
EOT | ||
}, | ||
] | ||
|
||
labels = { type = "container" } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
terraform { | ||
required_providers { | ||
imagetest = { source = "chainguard-dev/imagetest" } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
variable "check_openssl_fips" { | ||
type = bool | ||
description = "Whether to test openssl to be FIPS hardenened" | ||
default = false | ||
} | ||
|
||
variable "check_openssl_md5" { | ||
type = bool | ||
description = "Whether to test if md5 is supported with openssl CLI" | ||
default = false | ||
} | ||
|
||
variable "image_ref" { | ||
type = string | ||
description = "The image reference to run checks over" | ||
} | ||
|