Skip to content

Commit

Permalink
Add: --client-certificate option to cenclave-run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
grydz committed Dec 19, 2024
1 parent 7e20039 commit 33ad6f6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cenclave-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

usage() {
echo "cenclave-run usage: $0 --application <module:application> --size <size> --san <domain_name> --id <uuid> [--host <host>] [--port <port>] [--subject <subject>] [--expiration <expiration_timestamp>] [--timeout <seconds>] [--dry-run] [--memory] [--force] [--debug]"
echo "cenclave-run usage: $0 --application <module:application> --size <size> --san <domain_name> --id <uuid> [--host <host>] [--port <port>] [--subject <subject>] [--expiration <expiration_timestamp>] [--timeout <seconds>] [--client-certificate <pem_certificate>] [--dry-run] [--memory] [--force] [--debug]"
echo ""
echo "The code tarball [mandatory] (app.tar) and the SSL certificate [optional] (fullchain.pem) should be placed in $PACKAGE_DIR"
echo ""
Expand All @@ -19,6 +19,7 @@ usage() {
echo -e "\t--subject subject of the RA-TLS certificate as an RFC 4514 string (default: $SUBJECT)"
echo -e "\t--expiration expiration date of the RA-TLS certificate (unix timestamp)"
echo -e "\t--timeout time before stopping the configuration server (in seconds)"
echo -e "\t--client-certificate certificate for client certificate authentication (PEM-encoded)"
echo -e "\t--dry-run compute MRENCLAVE hash digest (no SGX processor required)"
echo -e "\t--memory print expected memory usage of the application"
echo -e "\t--force clean before compilation for Gramine"
Expand All @@ -44,6 +45,7 @@ set_default_variables() {
HOST="0.0.0.0"
PORT="443"
SUBJECT="CN=cosmian.io,O=Cosmian Tech,C=FR,L=Paris,ST=Ile-de-France"
CLIENT_CERT=""

# Constant variables
PACKAGE_DIR="/opt/input" # Location of the src package
Expand Down Expand Up @@ -120,6 +122,12 @@ parse_args() {
shift # past value
;;

--client-certificate)
CLIENT_CERT="$2"
shift # past argument
shift # past value
;;

--dry-run)
DRY_RUN=1
shift # past argument
Expand Down Expand Up @@ -225,6 +233,11 @@ if [ ! -f $MANIFEST_SGX ] || [ $FORCE -eq 1 ]; then
TIMEOUT_OPT="--timeout"
fi

CLIENT_CERT_OPT=""
if [ -n "$CLIENT_CERT" ]; then
CLIENT_CERT_OPT="--client-certificate"
fi

# Prepare gramine argv
# /!\ no double quote around $SSL_APP_VALUE which might be empty
# otherwise it will be serialized by gramine
Expand All @@ -237,6 +250,7 @@ if [ ! -f $MANIFEST_SGX ] || [ $FORCE -eq 1 ]; then
"--san" "$SUBJECT_ALTERNATIVE_NAME" \
"--id" "$ID" \
$TIMEOUT_OPT $TIMEOUT \
$CLIENT_CERT_OPT $CLIENT_CERT \
"$APPLICATION" > args

echo "Generating the enclave..."
Expand Down

0 comments on commit 33ad6f6

Please sign in to comment.