PK `RmHf$$ DockerfileUT 0`6`ux FROM centos:7 # Install Apache RUN yum -y update RUN yum -y install httpd httpd-tools mod_ssl openssl expect # Install EPEL Repo RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm # Install PHP 5.5 RUN yum -y install php55w php55w-bcmath php55w-cli php55w-common php55w-gd php55w-intl php55w-ldap php55w-mbstring \ php55w-mcrypt php55w-mysql php55w-pdo php55w-pear php55w-soap php55w-xml php55w-xmlrpc # Copy script that generates SSL certificate COPY generate_certificate.exp /generate_certificate.exp # Generate SSL certificate RUN chmod +x /generate_certificate.exp \ && ./generate_certificate.exp \ && cp ca.crt /etc/pki/tls/certs \ && cp ca.key /etc/pki/tls/private/ca.key \ && cp ca.csr /etc/pki/tls/private/ca.csr # Update Apache Configuration RUN sed -E -i -e '//,/<\/Directory>/s/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf RUN sed -E -i -e 's/DirectoryIndex (.*)$/DirectoryIndex index.php \1/g' /etc/httpd/conf/httpd.conf # Update Apache SSL Configuration RUN sed -E -i -e 's/\/etc\/pki\/tls\/certs\/localhost\.crt/\/etc\/pki\/tls\/certs\/ca.crt/g' /etc/httpd/conf.d/ssl.conf RUN sed -E -i -e 's/\/etc\/pki\/tls\/private\/localhost\.key/\/etc\/pki\/tls\/private\/ca.key/g' /etc/httpd/conf.d/ssl.conf RUN sed -E -i -e 's/#ServerName www\.example\.com\:443/ServerName www.example.com:443/g' /etc/httpd/conf.d/ssl.conf EXPOSE 80 443 # Start Apache CMD ["/usr/sbin/httpd","-D","FOREGROUND"] PK `Rm2i$generate_certificate.expUT 0`w`ux #!/usr/bin/expect -f # ------------------------- # Generate private key file # ------------------------- spawn openssl genrsa -des3 -out ca.key 2048 expect "Enter pass phrase for ca.key:" send -- "test\r" expect "Verifying - Enter pass phrase for ca.key:" send -- "test\r" # ------------------------------------ # Generate certificate signing request # ------------------------------------ spawn openssl req -new -key ca.key -out ca.csr expect "Enter pass phrase for ca.key:" send -- "test\r" expect "Country Name (2 letter code)" send -- "US\r" expect "State or Province Name (full name)" send -- "State\r" expect "Locality Name (eg, city)" send -- "City\r" expect "Organization Name (eg, company)" send -- "Company\r" expect "Organizational Unit Name (eg, section)" send -- "Section\r" expect "Common Name (eg, your name or your server's hostname)" send -- "localhost\r" expect "Email Address" send -- "email@localhost\r" expect "A challenge password" send -- "\r" expect "An optional company name" send -- "\r" # -------------------- # Generate certificate # -------------------- spawn openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt expect "Enter pass phrase for ca.key:" send -- "test\r" # --------------------------- # Remove certificate password # --------------------------- exec cp ca.key ca.tmp spawn openssl rsa -in ca.tmp -out ca.key expect "Enter pass phrase for ca.tmp:" send -- "test\r" exec rm ca.tmp PK `RmHf$$ DockerfileUT0`ux PK `Rm2i$hgenerate_certificate.expUT0`ux PKf