-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deployment: update deployment for container measurement
Signed-off-by: Xiaocheng Dong <xiaocheng.dong@intel.com>
Showing
38 changed files
with
227 additions
and
1,475 deletions.
There are no files selected for viewing
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,25 @@ | ||
FROM python:3.12.1-alpine3.19 AS python-builder | ||
|
||
RUN apk update && apk add git | ||
RUN python3 -m pip install --upgrade build | ||
RUN git clone https://github.com/cc-api/cc-trusted-api && \ | ||
cd cc-trusted-api/common/python && \ | ||
python3 -m build | ||
|
||
COPY sdk/python3 ccnp-sdk | ||
RUN cd ccnp-sdk && python3 -m build | ||
|
||
# ====================================================================================================================== | ||
|
||
FROM python:3.12.1-alpine3.19 | ||
|
||
WORKDIR /run/ccnp | ||
|
||
COPY container/ccnp-example/ccnp_example.py ./ | ||
COPY --from=python-builder cc-trusted-api/common/python/dist/cctrusted_base*.whl ./ | ||
COPY --from=python-builder ccnp-sdk/dist/ccnp*.whl ./ | ||
|
||
RUN apk update && apk add bash vim | ||
RUN pip install ./cctrusted_base*.whl ./ccnp*.whl && rm -f *.whl | ||
|
||
ENTRYPOINT ["tail", "-f", "/dev/null"] |
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,50 @@ | ||
""" | ||
CCNP SDK Example | ||
""" | ||
|
||
import logging | ||
import argparse | ||
|
||
from ccnp import CcnpSdk | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
logging.basicConfig( | ||
level=logging.INFO, | ||
format="%(asctime)s [%(levelname)s] %(message)s", | ||
handlers=[ | ||
logging.StreamHandler() | ||
] | ||
) | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="The utility to show how to use CCNP SDK") | ||
parser.add_argument('-r', action='store_true', help='get cc report', dest='report') | ||
parser.add_argument('-e', action='store_true', help='get cc eventlog', dest='eventlog') | ||
parser.add_argument('-m', action='store_true', help='get cc measurement', dest='measurement') | ||
parser.add_argument('-v', action='store_true', help='verify eventlog', dest='verify') | ||
args = parser.parse_args() | ||
|
||
if args.report: | ||
CcnpSdk.inst().get_cc_report().dump() | ||
elif args.eventlog: | ||
evt = CcnpSdk.inst().get_cc_eventlog() | ||
for e in evt: | ||
e.dump() | ||
elif args.measurement: | ||
for i in [0, 1, 3]: | ||
m = CcnpSdk.inst().get_cc_measurement([i, 12]) | ||
LOG.info("IMR index: %d, hash: %s", i, m.hash.hex()) | ||
elif args.verify: | ||
evt = CcnpSdk.inst().get_cc_eventlog() | ||
replay = CcnpSdk.inst().replay_cc_eventlog(evt) | ||
for r in replay: | ||
LOG.info("Replay IMR[%d]: %s", r, replay[r][12].hex()) | ||
m = CcnpSdk.inst().get_cc_measurement([r, 12]) | ||
LOG.info("Read IMR[%d]: %s", r, m.hash.hex()) | ||
if m.hash != replay[r][12]: | ||
LOG.error("Replay IMR value does not match real IMR.") | ||
else: | ||
LOG.info("Verify event log replay value successfully.") | ||
else: | ||
parser.print_help() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.