{"id":128,"date":"2013-11-24T21:00:32","date_gmt":"2013-11-24T20:00:32","guid":{"rendered":"http:\/\/www.anginf.de\/?p=128"},"modified":"2014-07-10T17:14:17","modified_gmt":"2014-07-10T15:14:17","slug":"apache-2-4-6-kompilieren-und-lokal-installieren","status":"publish","type":"post","link":"https:\/\/www.anginf.de\/?p=128","title":{"rendered":"Apache 2.4.7 kompilieren und lokal installieren"},"content":{"rendered":"<p>Der bei Ubuntu 12.04.3 LTS eingesetzte Apache ist derzeit noch die Version 2.2.22, und dieser unterst\u00fctzt leider keine &#8222;<a href=\"https:\/\/community.qualys.com\/blogs\/securitylabs\/2013\/06\/25\/ssl-labs-deploying-forward-secrecy\" title=\"Forward Secrecy\" target=\"_blank\">Forward Secrecy<\/a>&#8222;. Um zumindest testweise zu ermitteln, wie gut oder wie schlecht sich eine kompatible Version (z.B. 2.4.7) kompilieren und nutzen l\u00e4sst, habe ich mich durch die Konfiguration auf einem Ubuntu 12.04.3 LTS Server gearbeitet und heraus kam dieses Skript &#8222;compile_apache.sh&#8220;.<\/p>\n<p>Damit der Test-Apache keine Konflikte mit meiner regul\u00e4ren Installation bekommt, \u00e4ndert dieses Skript auch direkt die Ports (80 -> 65080 und 443 -> 65443) und aktiviert die von <a href=\"https:\/\/community.qualys.com\/blogs\/securitylabs\/2013\/08\/05\/configuring-apache-nginx-and-openssl-for-forward-secrecy\" title=\"SSL Labs: Ciphers\">SSL Labs empfohlenen<\/a> SSL-Einstellungen. Damit der Apache mit SSL funktioniert, m\u00fcssen noch die SSL-Keys hinterlegt werden:<\/p>\n<pre lang=\"bash\">\r\n${TARGETINSTALLDIR}\/conf\/server.crt\r\n${TARGETINSTALLDIR}\/conf\/server.key\r\n<\/pre>\n<p>Am Ende des Skripts werden noch zwei Shell-Skripte im Zielverzeichnis erstellt, und die SSL-Keys vom regul\u00e4ren Server kopiert. M\u00f6chte man diesen Apache in einer produktiven Umgebung nutzen, m\u00fcssen nat\u00fcrlich das TARGETINSTALLDIR und die Start\/Stop-Skripte angepasst werden.<\/p>\n<p>Das Skript hat den Stand 24. November 2013, die Versionen von Apache, APR, APRUtil, PCRE und OpenSSL sind miteinander kompatibel und k\u00f6nnen mit den gegebenen Konfigurationseinstellungen erfolgreich kompiliert werden. Eine Aktualisierung auf neuere Versionen ist m\u00f6glich, aber muss manuell im Skript angepasst werden.<\/p>\n<p>Wenn alles funktioniert hat, ist unter dem aktuellen Hostnamen der Apache auf dem Port 65443 via HTTPS erreichbar. Ein <a href=\"http:\/\/sourceforge.net\/projects\/sslscan\/\" title=\"SSLScan Homepage\" target=\"_blank\">sslscan<\/a> liefert dann folgendes Ergebnis:<\/p>\n<pre lang=\"bash\">\r\nuser@host: sslscan hostname | grep Accepted\r\n    Accepted  TLSv1  256 bits  ECDHE-RSA-AES256-SHA\r\n    Accepted  TLSv1  256 bits  DHE-RSA-AES256-SHA\r\n    Accepted  TLSv1  256 bits  DHE-RSA-CAMELLIA256-SHA\r\n    Accepted  TLSv1  128 bits  ECDHE-RSA-AES128-SHA\r\n    Accepted  TLSv1  128 bits  DHE-RSA-AES128-SHA\r\n    Accepted  TLSv1  128 bits  DHE-RSA-SEED-SHA\r\n    Accepted  TLSv1  128 bits  DHE-RSA-CAMELLIA128-SHA\r\n<\/pre>\n<p>Und hier das eigentliche Skript &#8222;compile_apache.sh&#8220;:<\/p>\n<pre lang=\"bash\">\r\n#!\/bin\/bash\r\n\r\n# Einfaches Skript, welches die Sourcen besorgt, korrekt auspackt, configure korrekt startet\r\n# und damit den Apache 2.4 kompiliert. Das Zielverzeichnis ist:\r\nTARGETINSTALLDIR=~\/localapache\/\r\nAPACHEVERSION=\"2.4.7\"\r\nAPRVERSION=\"1.5.0\"\r\nAPRUTILVERSION=\"1.5.3\"\r\nPCREVERSION=\"8.33\"\r\nOPENSSLVERSION=\"1.0.1e\"\r\nUSEMIRROR=\"http:\/\/ftp-stud.hs-esslingen.de\/pub\/Mirrors\/ftp.apache.org\/dist\/\"\r\nHTTPAPACHE=\"\/httpd\/httpd-${APACHEVERSION}.tar.bz2\"\r\nHTTPAPR=\"\/apr\/apr-${APRVERSION}.tar.bz2\"\r\nHTTPAPRUTIL=\"\/apr\/apr-util-${APRUTILVERSION}.tar.bz2\"\r\nFTPPCRE=\"ftp:\/\/ftp.csx.cam.ac.uk\/pub\/software\/programming\/pcre\/pcre-${PCREVERSION}.tar.gz\"\r\nHTTPOPENSSL=\"http:\/\/www.openssl.org\/source\/openssl-${OPENSSLVERSION}.tar.gz\"\r\nTHISDIR=\"${PWD}\"\r\nTHISHOST=`hostname`\r\n\r\n# Clean up\r\n# rm -Rf httpd-${APACHEVERSION}\r\n# rm -Rf pcre-${PCREVERSION}\r\nrm -Rf ${TARGETINSTALLDIR}\r\n\r\n# Download\r\nwget -nc ${USEMIRROR}${HTTPAPACHE}\r\nwget -nc ${USEMIRROR}${HTTPAPR}\r\nwget -nc ${USEMIRROR}${HTTPAPRUTIL}\r\nwget -nc ${FTPPCRE}\r\nwget -nc ${HTTPOPENSSL}\r\n\r\n# Compile PCRE\r\ncd ${THISDIR}\r\nif [ ! -d pcre-${PCREVERSION} ]; then\r\n  tar xfz pcre-${PCREVERSION}.tar.gz\r\nfi\r\nif [ ! -f ${TARGETINSTALLDIR}\/lib\/libpcre.so ]; then\r\n  cd pcre-${PCREVERSION}\r\n  .\/configure --prefix=${TARGETINSTALLDIR}\r\n        if [[ $? -ne 0 ]] ; then exit 1; fi\r\n  make\r\n        if [[ $? -ne 0 ]] ; then exit 1; fi\r\n  make install\r\n        if [[ $? -ne 0 ]] ; then exit 1; fi\r\nfi\r\n\r\n# Compile OpenSSL\r\ncd ${THISDIR}\r\nif [ ! -d openssl-${OPENSSLVERSION} ]; then\r\n        tar xfz openssl-${OPENSSLVERSION}.tar.gz\r\nfi\r\nif [ ! -f ${TARGETINSTALLDIR}\/lib\/libssl.so ]; then\r\n        cd openssl-${OPENSSLVERSION}\r\n        if [ ! -e config.status ]; then\r\n                .\/config shared --prefix=${TARGETINSTALLDIR}\r\n                if [[ $? -ne 0 ]] ; then exit 1; fi\r\n        fi\r\n        make\r\n        if [[ $? -ne 0 ]] ; then exit 1; fi\r\n        make install\r\n        if [[ $? -ne 0 ]] ; then exit 1; fi\r\nfi\r\n\r\n# Prepare APR for APACHE\r\ncd ${THISDIR}\r\nif [ ! -d httpd-${APACHEVERSION} ]; then\r\n  tar xfj httpd-${APACHEVERSION}.tar.bz2\r\nfi\r\ncd httpd-${APACHEVERSION}\/srclib\r\n\r\nif [ ! -d apr ]; then\r\n  tar xfj ..\/..\/apr-${APRVERSION}.tar.bz2\r\n  mv apr-${APRVERSION} apr\r\nfi\r\n\r\nif [ ! -d apr-util ]; then\r\n  tar xfj ..\/..\/apr-util-${APRUTILVERSION}.tar.bz2\r\n  mv apr-util-${APRUTILVERSION} apr-util\r\nfi\r\n\r\n# Compile APACHE\r\ncd ${THISDIR}\/httpd-${APACHEVERSION}\r\nif [ ! -e config.status ]; then\r\n  .\/configure --with-included-apr --prefix=${TARGETINSTALLDIR} --with-pcre=${TARGETINSTALLDIR} --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-deflate --enable-expires --enable-headers --enable-usertrack --enable-ssl --enable-cgi --enable-vhost-alias --enable-rewrite --enable-so --with-ssl=${TARGETINSTALLDIR}\r\n  if [[ $? -ne 0 ]] ; then exit 1; fi\r\nfi\r\necho \"apache: make...\"\r\nmake >log_apache_make\r\nif [[ $? -ne 0 ]] ; then exit 1; fi\r\necho \"apache: make install...\"\r\nmake install >log_apache_make_install\r\nif [[ $? -ne 0 ]] ; then exit 1; fi\r\n\r\n# Change port and add ssl in config\r\nmv ${TARGETINSTALLDIR}\/conf\/httpd.conf ${TARGETINSTALLDIR}\/conf\/httpd.conf-old\r\nif [[ $? -ne 0 ]] ; then exit 1; fi\r\nsed \"\r\ns\/Listen 80\/Listen 65080\/\r\ns\/#LoadModule ssl_module modules\\\/mod_ssl.so\/LoadModule ssl_module modules\\\/mod_ssl.so\/\r\ns\/#Include conf\\\/extra\\\/httpd-ssl\\.conf\/Include conf\\\/extra\\\/httpd-ssl\\.conf\/\r\ns\/#LoadModule socache_shmcb_module modules\\\/mod_socache_shmcb.so\/LoadModule socache_shmcb_module modules\\\/mod_socache_shmcb.so\/\r\n\" ${TARGETINSTALLDIR}\/conf\/httpd.conf-old >${TARGETINSTALLDIR}\/conf\/httpd.conf\r\nif [[ $? -ne 0 ]] ; then exit 1; fi\r\n\r\nmv ${TARGETINSTALLDIR}\/conf\/extra\/httpd-ssl.conf ${TARGETINSTALLDIR}\/conf\/extra\/httpd-ssl.conf-old\r\nif [[ $? -ne 0 ]] ; then exit 1; fi\r\nsed \"\r\ns\/Listen 443\/Listen 65443\/\r\ns\/<VirtualHost _default_:443>\/<VirtualHost _default_:65443>\/\r\ns\/ServerName www.example.com:443\/ServerName ${THISHOST}:65443\/\r\ns\/SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5\/SSLProtocol all -SSLv2 -SSLv3\\nSSLHonorCipherOrder on\\nSSLCipherSuite \\\"EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4\\\"\/\r\n\" ${TARGETINSTALLDIR}\/conf\/extra\/httpd-ssl.conf-old >${TARGETINSTALLDIR}\/conf\/extra\/httpd-ssl.conf\r\nif [[ $? -ne 0 ]] ; then exit 1; fi\r\n\r\n# Create start script\r\necho \"#!\/bin\/bash\r\n${TARGETINSTALLDIR}\/bin\/apachectl -f ${TARGETINSTALLDIR}\/conf\/httpd.conf -k start\" >${TARGETINSTALLDIR}\/run.sh\r\necho \"#!\/bin\/bash\r\n${TARGETINSTALLDIR}\/bin\/apachectl -f ${TARGETINSTALLDIR}\/conf\/httpd.conf -k stop\" >${TARGETINSTALLDIR}\/stop.sh\r\nchmod u+x ${TARGETINSTALLDIR}\/run.sh ${TARGETINSTALLDIR}\/stop.sh\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Der bei Ubuntu 12.04.3 LTS eingesetzte Apache ist derzeit noch die Version 2.2.22, und dieser unterst\u00fctzt leider keine &#8222;Forward Secrecy&#8222;. Um zumindest testweise zu ermitteln, wie gut oder wie schlecht sich eine kompatible Version (z.B. 2.4.7) kompilieren und nutzen l\u00e4sst, habe ich mich durch die Konfiguration auf einem Ubuntu 12.04.3 LTS Server gearbeitet und heraus &hellip; <a href=\"https:\/\/www.anginf.de\/?p=128\" class=\"more-link\"><span class=\"screen-reader-text\">Apache 2.4.7 kompilieren und lokal installieren<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=128"}],"version-history":[{"count":11,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/128\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}