File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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"
Load diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments