Skip to content

Commit 8f79c48

Browse files
committed
Add mds metadata blob and a script to update it
1 parent ff1f712 commit 8f79c48

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

‎stepup/update-webauthn-mds.sh‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
# Download the current mds metadata from the fido mds site and put it in the webauthn container
4+
5+
# Get the directory of this script
6+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
8+
# Create tmp filename for the downloaded mds
9+
tmp_file=$(mktemp /tmp/fido-mds.XXXXXX)
10+
11+
# Use curl to download the MDS file
12+
MDS_URL="https://mds.fidoalliance.org/"
13+
MDS_TARGET="${DIR}/webauthn/blob.jwt"
14+
echo "Downloading ${MDS_URL}"
15+
if ! curl -fsSL \
16+
--retry 2 \
17+
--retry-delay 10 \
18+
--retry-max-time 30 \
19+
--retry-all-errors \
20+
-o "$tmp_file" \
21+
"$MDS_URL"; then
22+
echo "Error downloading FIDO MDS metadata file"
23+
rm -f "$tmp_file"
24+
exit 1
25+
fi
26+
27+
if ! grep -Eq '^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$' "$tmp_file"; then
28+
echo "Error the FIDO MDS payload does not look like a JWT blob."
29+
rm -f "$tmp_file"
30+
exit 1
31+
fi
32+
33+
if ! cp "$tmp_file" "$MDS_TARGET"; then
34+
echo "Error copying FIDO MDS metadata file mounted in webauthn container"
35+
rm -f "$tmp_file"
36+
exit 1
37+
fi
38+
39+
echo "Wrote mds file to ${MDS_TARGET}"
40+
41+
echo "Restarting container"
42+
if ! docker compose -f "${DIR}/docker-compose.yml" restart webauthn; then
43+
echo "The container could not be restarted"
44+
fi
45+
46+
# Clean up
47+
rm -f "$tmp_file"
48+
49+
echo "Successfully updated FIDO MDS"

‎stepup/webauthn/blob.jwt‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)