Skip to content

Commit

Permalink
[CI-Examples] Add Nginx test data files to the manifest
Browse files Browse the repository at this point in the history
Commit aef087f "[LibOS] Move trusted and allowed files logic to LibOS"
incorrectly modified Makefile of the Nginx example. The test data files
(automatically generated by Makefile and put under Nginx install dir
`install/html/random`) got generated after the Gramine manifest
expansion. This led to those test files not being added as
`sgx.trusted_files` to the manifest, and Nginx server could not retrieve
them and thus returned error code 403 ("Forbidden"). The fix is simple:
move the `$TEST_DATA` variable before the `nginx.manifest` target (which
already has `$TEST_DATA` as its dependency).

This bug was not detected by our CI because the Nginx test uses `wrk`
which ignores error code 403 and happily counts this error response
towards its total stats. This needs to be fixed in a separate commit.

Signed-off-by: Vasanth Nagaraja <vasanth.k.nagaraja@intel.com>
  • Loading branch information
vasanth-intel authored and dimakuv committed Oct 16, 2024
1 parent 6a9de10 commit 42251d8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions CI-Examples/nginx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ LISTEN_HOST ?= 127.0.0.1
LISTEN_PORT ?= 8002
LISTEN_SSL_PORT ?= 8444

# HTTP docs: Generating random HTML files in $(INSTALL_DIR)/html/random
RANDOM_DIR = $(INSTALL_DIR)/html/random
RANDOM_FILES = \
$(foreach n,1 2 3 4 5 6 7 8 9 10,2K.$n.html) \
$(foreach n,1 2 3 4 5,10K.$n.html) \
$(foreach n,1 2 3 4 5,100K.$n.html) \
$(foreach n,1 2 3,1M.$n.html) \
$(foreach n,1 2 3,10M.$n.html) \
$(foreach n,1 2 3,100.$n.html)

TEST_DATA = $(addprefix $(RANDOM_DIR)/,$(RANDOM_FILES))

ifeq ($(DEBUG),1)
GRAMINE_LOG_LEVEL = debug
else
Expand Down Expand Up @@ -82,18 +94,6 @@ $(INSTALL_DIR)/conf/nginx-gramine.conf: nginx-gramine.conf.template $(INSTALL_DI
-e 's|$$(LISTEN_HOST)|'"$(LISTEN_HOST)"'|g' \
$< > $@

# HTTP docs: Generating random HTML files in $(INSTALL_DIR)/html/random
RANDOM_DIR = $(INSTALL_DIR)/html/random
RANDOM_FILES = \
$(foreach n,1 2 3 4 5 6 7 8 9 10,2K.$n.html) \
$(foreach n,1 2 3 4 5,10K.$n.html) \
$(foreach n,1 2 3 4 5,100K.$n.html) \
$(foreach n,1 2 3,1M.$n.html) \
$(foreach n,1 2 3,10M.$n.html) \
$(foreach n,1 2 3,100.$n.html)

TEST_DATA = $(addprefix $(RANDOM_DIR)/,$(RANDOM_FILES))

# We need to first build and install nginx, otherwise nginx' makefiles think that they already
# filled $(INSTALL_DIR)/html and skip copying installation files.
$(RANDOM_DIR)/%.html: $(INSTALL_DIR)/sbin/nginx
Expand Down

0 comments on commit 42251d8

Please sign in to comment.