Browse Source

PHP extension works

Miti Mazmudar 4 years ago
parent
commit
45eee42733
2 changed files with 21 additions and 13 deletions
  1. 16 12
      docker/Dockerfile
  2. 5 1
      docker/deploy_enclaves.sh

+ 16 - 12
docker/Dockerfile

@@ -52,27 +52,31 @@ RUN git clone --recursive https://github.com/CopernicaMarketingSoftware/PHP-CPP.
 	cp libphpcpp.so.* /usr/lib/ && make install
 
 RUN git clone https://git-crysp.uwaterloo.ca/miti/Apache_PHP_extension.git && \
-	cd Apache_PHP_extension && git checkout recreating_state_for_teeter && \
+	cd Apache_PHP_extension && git checkout recreating_state_for_teeter  && \
 	make
 
-#WORKDIR /root/graphene/LibOS/shim/test/apps/apache
-#RUN cp /root/source/Apache_PHP_extension/apacheMakefile ./Makefile 
-#RUN cp /root/source/Apache_PHP_extension/*.tar.gz ./
+WORKDIR /root/graphene/LibOS/shim/test/apps/apache
+RUN cp /root/source/Apache_PHP_extension/apacheMakefile ./Makefile 
+RUN cp /root/source/Apache_PHP_extension/*.tar.gz ./
 #Don't make the manifest yet - make the apache/php build first and then the manifest.
-#RUN make SGX=1 build-apache 
+RUN make SGX=1 build-apache 
 
 #Add the updated httpd.manifest.template
-#RUN cp /root/source/Apache_PHP_extension/httpd.manifest.template ./
+RUN cp /root/source/Apache_PHP_extension/httpd.manifest.template ./
 #Add the PHP .ini file from the PHP folder to /obj/lib 
-#RUN cp ./php-7.0.7/php.ini-development ./obj/lib/php.ini 
+RUN cp ./php-7.0.7/php.ini-development ./obj/lib/php.ini 
 #Add the extension to the obj/modules folder. 
-#RUN cp /root/source/Apache_PHP_extension/localattestation_decryption.so ./obj/modules/
+RUN cp /root/source/Apache_PHP_extension/localattestation_decryption.so ./obj/modules/
 #Add the extension directory and the extension name to the php.ini 
-#RUN echo "extension_dir=/root/graphene/LibOS/shim/test/apps/apache/LibOS/shim/test/apps/apache/obj/modules" >> obj/lib/php.ini && \ 
-#	echo "extension=localattestation_decryption.so" >> obj/lib/php.ini
+RUN echo "extension_dir=/root/graphene/LibOS/shim/test/apps/apache/obj/modules" >> obj/lib/php.ini && \ 
+	echo "extension=localattestation_decryption.so" >> obj/lib/php.ini
 #Add all php source code files to the right place. 
-#RUN cp /root/source/Apache_PHP_extension/*.php ./obj/htdocs
-#RUN make SGX=1 
+RUN cp /root/source/Apache_PHP_extension/*.php ./obj/htdocs
+#Fix the configuration file for Apache
+RUN sed -i s/User/#User/g obj/conf/httpd.conf
+RUN sed -i s/Group/#Group/g obj/conf/httpd.conf
+RUN cat /root/source/Apache_PHP_extension/httpd.conf >> obj/conf/httpd.conf
+RUN make SGX=1 
 
 WORKDIR /root 
 COPY deploy_enclaves.sh ./

+ 5 - 1
docker/deploy_enclaves.sh

@@ -1,4 +1,8 @@
 #!/bin/bash
-
+#To exit a tmux session, use Ctrl+B and then press D. 
+#To enter a tmux session, use tmux at -t <session_name> where session_name is decryptor, verifier or phpext.
+#List existing sessions by pressing tmux ls.
 cd ~/source/Decryptor && tmux new-session -d -s decryptor './app'
+cd ~/graphene && make SGX_RUN=1 || exit 1
 cd ~/graphene/LibOS/shim/test/native && make SGX_RUN=1 && tmux new-session -d -s verifier './pal_loader SGX verifier' 
+cd ~/graphene/LibOS/shim/test/apps/apache && make SGX_RUN=1 && tmux new-session -d -s phpext 'sudo make start-graphene-server'