Skip to content

Commit

Permalink
tests: generalize update_valid_1_cert.bash
Browse files Browse the repository at this point in the history
1. Rename to `update_valid_ee_certs.bash`
2. Don't hardcode location of `bash` for shebang.
3. Remove echo's about potential future extensions.
4. Add a helper function for fetching EE certs.
5. Use helper to update all three valid realworld testcase EE certs
   instead of just `1password_com_valid_1.crt`
  • Loading branch information
cpu committed Nov 17, 2023
1 parent 57a2d16 commit e419417
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/tests/verification_real_world/update_valid_1_cert.bash

This file was deleted.

21 changes: 21 additions & 0 deletions src/tests/verification_real_world/update_valid_ee_certs.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -euo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

fetch_ee_cert() {
local domain="$1"
local out_file="$2"

echo -n |
openssl s_client \
-connect "$domain:443" \
-servername "$domain" |
openssl x509 \
-outform DER > "$DIR/$out_file"
}

fetch_ee_cert "my.1password.com" "1password_com_valid_1.crt"
fetch_ee_cert "agilebits.com" "agilebits_com_valid_1.crt"
fetch_ee_cert "lencr.org" "letsencrypt_org_valid_1.crt"

0 comments on commit e419417

Please sign in to comment.