From 34eb5e0672d7d7b211044c6219c47f7dceb577ff Mon Sep 17 00:00:00 2001 From: Wojtek Porczyk Date: Wed, 11 Jan 2023 12:23:44 +0100 Subject: [PATCH] [python] Add sgx-sign plugins Signed-off-by: Wojtek Porczyk --- .ci/ubuntu20.04.dockerfile | 1 + .ci/ubuntu22.04.dockerfile | 1 + Documentation/conf.py | 5 +- Documentation/index.rst | 3 + Documentation/manpages/gramine-sgx-sign.rst | 17 ++- .../python/writing-sgx-sign-plugins.rst | 90 +++++++++++++++ debian/control | 1 + debian/gramine.install | 3 +- gramine.spec | 3 + python/gramine-sgx-sign | 107 ++++++++++++++---- python/graminelibos.dist-info/METADATA.in | 5 + .../graminelibos.dist-info/entry_points.txt | 2 + python/graminelibos.dist-info/meson.build | 15 +++ python/graminelibos/sgx_sign.py | 12 ++ python/meson.build | 1 + 15 files changed, 242 insertions(+), 24 deletions(-) create mode 100644 Documentation/python/writing-sgx-sign-plugins.rst create mode 100644 python/graminelibos.dist-info/METADATA.in create mode 100644 python/graminelibos.dist-info/entry_points.txt create mode 100644 python/graminelibos.dist-info/meson.build diff --git a/.ci/ubuntu20.04.dockerfile b/.ci/ubuntu20.04.dockerfile index 92dfb70a6d..32e2444257 100644 --- a/.ci/ubuntu20.04.dockerfile +++ b/.ci/ubuntu20.04.dockerfile @@ -56,6 +56,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \ python3-lxml \ python3-numpy \ python3-pip \ + python3-pkg-resources \ python3-protobuf \ python3-pyelftools \ python3-pytest \ diff --git a/.ci/ubuntu22.04.dockerfile b/.ci/ubuntu22.04.dockerfile index b89ae35610..7979c8500f 100644 --- a/.ci/ubuntu22.04.dockerfile +++ b/.ci/ubuntu22.04.dockerfile @@ -57,6 +57,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \ python3-lxml \ python3-numpy \ python3-pip \ + python3-pkg-resources \ python3-protobuf \ python3-pyelftools \ python3-pytest \ diff --git a/Documentation/conf.py b/Documentation/conf.py index a103723554..aa954b34ad 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -156,7 +156,10 @@ def setup(app): manpages_url = 'https://manpages.debian.org/{path}' -intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} +intersphinx_mapping = { + 'python': ('https://docs.python.org/3', None), + 'click': ('https://click.palletsprojects.com/en/latest', None), +} # -- Options for HTML output ------------------------------------------------- diff --git a/Documentation/index.rst b/Documentation/index.rst index 1490701c19..6e2e189786 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -94,6 +94,8 @@ debugging and other processes necessary for Gramine development. - :doc:`Learn about packaging` - Package and distribute Gramine on different Linux distributions. - :doc:`Use Python API` - Use Python API provided by Gramine. +- :doc:`python/writing-sgx-sign-plugins` - Write plugins for SGX signing tool + (:ref:`gramine-sgx-sign `). We also provide :doc:`manual pages for Gramine tools`. @@ -191,6 +193,7 @@ Indices and tables devel/debugging devel/packaging python/api + python/writing-sgx-sign-plugins devel/new-syscall libos/libos-init pal/host-abi diff --git a/Documentation/manpages/gramine-sgx-sign.rst b/Documentation/manpages/gramine-sgx-sign.rst index aa0c166f58..31288abe54 100644 --- a/Documentation/manpages/gramine-sgx-sign.rst +++ b/Documentation/manpages/gramine-sgx-sign.rst @@ -20,9 +20,13 @@ signature file for given input manifest and libpal file (main Gramine binary). Command line arguments ====================== +.. option:: --help, -h + + Show help and exit. + .. option:: --output output_manifest, -o output_manifest - Path to the output manifest file (with Trusted Files expanded). + Path to the output manifest file (with Trusted Files expanded). .. option:: --key key_file, -k key_file @@ -56,3 +60,14 @@ Command line arguments .. option:: --quiet, -q Don't print details to standard output. + +.. option:: --with + + Use plugin to perform actual signing. The default plugin is ``file``, which + signs the SIGSTRUCT using PEM-encoded local file. The list of available + plugins is at the end of :option:`--help` output. + + Each plugin may add its own set of options (usually in the form of + ``---