Skip to content

Commit

Permalink
Compare the certificate's age with the image's age to check when the …
Browse files Browse the repository at this point in the history
…certificate was generated
  • Loading branch information
hhorak committed May 12, 2022
1 parent b1b767e commit e59a529
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions 2.4/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ function run_s2i_test() {

# We also need to make sure the certificate is generated no sooner than in assemble phase,
# because shipping the same certs in the image would make it easy to exploit
# Let's see how old the certificate is (that it was generated within the last minute)
# Let's see how old the certificate is and compare with how old the image is
image_age_s=$(ct_get_image_age_s "${IMAGE_NAME}")
certificate_age_s=$(ct_get_certificate_age_s $(ct_get_cid testing-app-s2i) '$HTTPD_TLS_CERT_PATH/localhost.crt')
run "test '$certificate_age_s' -le 60" 0 "Testing whether the certificate was freshly generated (not older than a minute)"
run "test '$certificate_age_s' -lt '$image_age_s'" 0 "Testing whether the certificate was freshly generated after the image"

# Let's also check whether the certificates are where we expect them and were not
# in the original production image
Expand Down
2 changes: 1 addition & 1 deletion common
Submodule common updated 1 files
+20 −0 test-lib.sh

0 comments on commit e59a529

Please sign in to comment.