-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up the configuration of the IAS certificates
Replace the template expansion that is causing periodic file corruption errors with a more resilient method for downloading the IAS certificate. This approach removes the template completely and uses a file system move to atomically update the certificate file. Also uses the cmake clean to remove any generated files. We were leaving extra files in the common directory tree. Signed-off-by: Mic Bowman <mic.bowman@intel.com>
- Loading branch information
Showing
14 changed files
with
92 additions
and
124 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
ias-certificates.cpp | ||
ias-certificates.txt |
49 changes: 0 additions & 49 deletions
49
common/crypto/verify_ias_report/build_ias_certificates_cpp.sh
This file was deleted.
Oops, something went wrong.
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,69 @@ | ||
#!/bin/bash | ||
# Copyright 2023 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This script sets up the IAS root certificate for inclusing in the | ||
# verification module. | ||
# | ||
# Two parameters: | ||
# $1 -- the URL where the IAS certificate can be retrieved | ||
# $2 -- the file where the certificate should be written | ||
|
||
# ----------------------------------------------------------------- | ||
# ----------------------------------------------------------------- | ||
source ${PDO_SOURCE_ROOT}/bin/lib/common.sh | ||
|
||
IAS_CERTIFICATE_URL=$1 | ||
|
||
# ----------------------------------------------------------------- | ||
# set up the temporary files | ||
# ----------------------------------------------------------------- | ||
SAVE_FILE=$(mktemp /tmp/pdo-ias-certificate.XXXXXXXXX) | ||
STRING_FILE=$(mktemp /tmp/pdo-ias-certificate-string.XXXXXXXXX) | ||
|
||
function cleanup { | ||
rm -f ${SAVE_FILE} ${STRING_FILE} | ||
} | ||
|
||
trap 'echo "**ERROR - line $LINENO**"; cleanup; exit 1' HUP INT QUIT PIPE TERM ERR | ||
|
||
# If there is no requirement for HW support, then we don't need | ||
# a valid certificate; just generate a dummy string | ||
if [ "${SGX_MODE}" != "HW" ]; then | ||
echo 'R"IASCERT(' > ${STRING_FILE} | ||
echo 'NO CERTIFICATE REQUIRED' >> ${STRING_FILE} | ||
echo ')IASCERT"' >> ${STRING_FILE} | ||
|
||
try mv ${STRING_FILE} $2 | ||
exit | ||
fi | ||
|
||
# ----------------------------------------------------------------- | ||
# get the certificate and format it as needed | ||
# ----------------------------------------------------------------- | ||
|
||
# This is a small hack to make the script work for people | ||
# who would otherwise attempt to retrieve the certficiates | ||
# without a proxy server | ||
if [ "${PDO_FORCE_IAS_PROXY}" == "true" ]; then | ||
try curl --noproxy '' --retry 3 --max-time 10 -sL --output ${SAVE_FILE} ${IAS_CERTIFICATE_URL} | ||
else | ||
try curl --retry 3 --max-time 10 -sL --output ${SAVE_FILE} ${IAS_CERTIFICATE_URL} | ||
fi | ||
|
||
echo 'R"IASCERT(' > ${STRING_FILE} | ||
cat ${SAVE_FILE} >> ${STRING_FILE} | ||
echo ')IASCERT"' >> ${STRING_FILE} | ||
|
||
try mv ${STRING_FILE} $2 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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