Browse Source

Temp setup commit for mitigator server + php extension

Miti Mazmudar 4 years ago
parent
commit
2263b701ba

+ 14 - 8
LibOS/shim/test/apps/apache/Makefile

@@ -1,5 +1,10 @@
-HOST ?= $(firstword $(shell ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' -m 1 | cut -d: -f2))
-PORT ?= 8001
+#HOST ?= $(firstword $(shell ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' -m 1 | cut -d: -f2))
+HOST ?= 127.0.0.1
+
+PORT ?= 8044
+PORT1 ?= 8045
+PORT2 ?= 8046
+
 
 NPROCS := 1
 OS := $(shell uname -s)
@@ -12,7 +17,7 @@ PREFORK_WORKERS := $(shell expr $(NPROCS) + 1)
 HTTPD_DIR = httpd-2.4.3
 APR_DIR = apr-1.4.6
 APRUTIL_DIR = apr-util-1.5.1
-PHP_DIR = php-5.6.6
+PHP_DIR = php-7.0.7
 
 INSTALL_DIR = $(PWD)/obj
 SRC_DIRS = $(HTTPD_DIR) $(APR_DIR) $(APRUTIL_DIR) $(PHP_DIR)
@@ -20,7 +25,7 @@ HTDOC=$(INSTALL_DIR)/htdocs
 
 exec_target = httpd.manifest
 
-target = build-apache build-modules build-conf test-data
+target = build-apache build-modules #build-conf test-data
 
 clean-extra = clean-apache
 
@@ -31,7 +36,7 @@ include ../../Makefile
 
 .PHONY: build-apache build-modules build-conf
 
-build-apache: $(INSTALL_DIR)/bin/httpd $(INSTALL_DIR)/modules/libphp5.so
+build-apache: $(INSTALL_DIR)/bin/httpd $(INSTALL_DIR)/modules/libphp7.so
 
 ifeq ($(DEBUG),1)
 MAKE_FLAGS = CC="gcc -g"
@@ -63,7 +68,7 @@ $(INSTALL_DIR)/bin/httpd $(INSTALL_DIR)/bin/apxs: $(INSTALL_DIR)/lib/libapr-1.so
 	cd $(HTTPD_DIR) && $(MAKE) -j$(NPROCS) $(MAKE_FLAGS)
 	cd $(HTTPD_DIR) && $(MAKE) install
 
-$(INSTALL_DIR)/modules/libphp5.so: $(PHP_DIR) $(INSTALL_DIR)/bin/apxs
+$(INSTALL_DIR)/modules/libphp7.so: $(PHP_DIR) $(INSTALL_DIR)/bin/apxs
 	cd $< && ./configure --prefix=$(INSTALL_DIR) --with-apxs2=$(INSTALL_DIR)/bin/apxs \
 	--disable-cgi --disable-cli --disable-soap
 	cd $< && $(MAKE) -j$(NPROCS) $(MAKE_FLAGS)
@@ -104,8 +109,8 @@ clean-server:
 	rm -f $(INSTALL_DIR)/logs/httpd-$(HOST)-$(PORT).pid
 
 start-native-server: clean-server
-	@echo "Listen on $(HOST):$(PORT)"
-	$(PREFIX) $(INSTALL_DIR)/bin/httpd -D FOREGROUND -C "ServerName $(HOST)" -C "Listen $(HOST):$(PORT)" -C "PidFile logs/httpd-$(HOST)-$(PORT).pid"
+	@echo "Listen on $(HOST):$(PORT1)"
+	$(PREFIX) $(INSTALL_DIR)/bin/httpd -D FOREGROUND -C "ServerName $(HOST)" -C "Listen $(HOST):$(PORT1)" -C "PidFile logs/httpd-$(HOST)-$(PORT1).pid"
 
 start-graphene-server: clean-server
 	@echo "Listen on $(HOST):$(PORT)"
@@ -152,3 +157,4 @@ distclean: clean
 
 clean-apache:
 	rm -rf $(test-data) $(addprefix mod_auth_basic_sandbox,.so .la .lo .o .slo)
+

+ 38 - 1
LibOS/shim/test/apps/apache/httpd.manifest.template

@@ -22,8 +22,12 @@ fs.mount.cwd.type = chroot
 fs.mount.cwd.path = $(PWD)
 fs.mount.cwd.uri = file:
 
+sgx.enclave_size=4G
+sgx.allow_file_creation = 1
+net.allow_peer.1=:
+
 # allow to bind on port for listening
-net.allow_bind.1 = $(HOST):$(PORT)
+net.allow_bind.1 =:
 
 sgx.trusted_files.ld = file:$(LIBCDIR)/ld-linux-x86-64.so.2
 sgx.trusted_files.libc = file:$(LIBCDIR)/libc.so.6
@@ -53,3 +57,36 @@ sgx.allowed_files.modules = file:obj/modules
 sgx.allowed_files.conf = file:obj/conf
 sgx.allowed_files.htdocs = file:obj/htdocs
 sgx.allowed_files.logs = file:obj/logs
+
+sgx.trusted_files.conf = file:obj/conf/httpd.conf
+sgx.trusted_files.confmime = file:obj/conf/mime.types
+
+#Source code files
+sgx.trusted_files.indexphp = file:obj/htdocs/index.php
+sgx.trusted_files.actionphp = file:obj/htdocs/action.php
+
+sgx.allowed_files.timeop=file:target_time.txt
+sgx.allowed_files.phptimeop=file:obj/htdocs/mitigator_phptime.txt
+ 
+#Extension and its dependencies (that are not already included above)
+sgx.trusted_files.phpini=file:obj/lib/php.ini
+sgx.trusted_files.mainextension=file:obj/modules/localattestation_decryption.so
+sgx.trusted_files.libphpcpp=file:/usr/lib/libphpcpp.so.2.0
+sgx.trusted_files.libprotobuf=file:/usr/lib/x86_64-linux-gnu/libprotobuf.so.9
+sgx.trusted_files.libuuid=file:/lib/x86_64-linux-gnu/libuuid.so.1
+sgx.trusted_files.libcrypto = file:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
+ 
+ 
+## Apache PHP modules (LoadModule command in httpd.conf) 
+ 
+sgx.trusted_files.mod_authz_core=file:obj/modules/mod_authz_core.so
+sgx.trusted_files.mod_access_compat=file:obj/modules/mod_access_compat.so
+sgx.trusted_files.mod_filter=file:obj/modules/mod_filter.so
+sgx.trusted_files.mod_mime=file:obj/modules/mod_mime.so
+sgx.trusted_files.mod_log_config=file:obj/modules/mod_log_config.so
+sgx.trusted_files.mod_log_debug=file:obj/modules/mod_log_debug.so
+sgx.trusted_files.mod_unixd=file:obj/modules/mod_unixd.so
+sgx.trusted_files.mod_status=file:obj/modules/mod_status.so
+sgx.trusted_files.mod_dir=file:obj/modules/mod_dir.so
+sgx.trusted_files.libphp7=file:obj/modules/libphp7.so
+

BIN
LibOS/shim/test/apps/apache/php-5.6.6.tar.bz2 → LibOS/shim/test/apps/apache/php-7.0.7.tar.bz2