# This file is rendered by CFEngine # manual edits will be reverted. ServerSignature Off ServerTokens ProductOnly ServerName {{{vars.sys.fqhost}}} ServerRoot "{{{vars.sys.workdir}}}/httpd" Listen 80 PidFile "{{{vars.mission_portal_apache_from_stage.httpd_pid_file}}}" # Modules # Note: Not all modules that are built are loaded. # Find built modules in {{{vars.sys.workdir}}}/httpd/modules # Our default log format uses features provided by these modules LoadModule log_config_module modules/mod_log_config.so LoadModule logio_module modules/mod_logio.so # We use the Header directive which is provided by this module LoadModule headers_module modules/mod_headers.so # We use the BrowserMatch directive which is provided by this module LoadModule setenvif_module modules/mod_setenvif.so # Associates the requested filename's extensions with the file's behavior # (handlers and filters) and content (mime-type, language, character set and # encoding) LoadModule mime_module modules/mod_mime.so # Provides for "trailing slash" redirects and serving directory index files LoadModule dir_module modules/mod_dir.so # Used for mapping in some nicer URL names # TODO Consider removal after 3.20 is EOL (used by transition in 3.16) LoadModule alias_module modules/mod_alias.so # Required for http->https redirection and handling indexes LoadModule rewrite_module modules/mod_rewrite.so # Required for secure access LoadModule ssl_module modules/mod_ssl.so # Required to drop privledges LoadModule unixd_module modules/mod_unixd.so # Required for use of Order and Require commands LoadModule access_compat_module modules/mod_access_compat.so # Required for SSL Session Caching LoadModule socache_shmcb_module modules/mod_socache_shmcb.so # Required to log into mission portal LoadModule authz_core_module modules/mod_authz_core.so # TRACE can be useful for debugging, but can be abused to perform Cross-Site # Tracing (XST) attacheks in order to obtain access to user cooking via # malicious scripting on the client side. TraceEnable off # The 'HttpOnly' flag makes the cookie inaccessible to client-side scripts, # preventing it from being stolen using malicious client side scripts. The # absence of this flag increases the likelihood of an attacker being able to # compromise the user's cookie via a malicious script. When the 'secure' flag is # used, the cookie is only sent over an encrypted HTTPS channel, and not over # unencrypted HTTP. Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure # This module should not be loaded, this is just an extra measure. UserDir disabled User cfapache Group cfapache # Server configuration # ServerAdmin root@localhost DocumentRoot "{{{vars.cfe_internal_hub_vars.public_docroot}}}" Order deny,allow Deny from all Options FollowSymLinks AllowOverride None DirectoryIndex index.html index.php Order allow,deny Deny from all Satisfy All ErrorLog "logs/error_log" LogLevel warn LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%h %l %{username}n %t \"%r\" %>s %b" common_with_apache_notes_username LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio CustomLog "logs/access_log" common_with_apache_notes_username TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz # Include conf/extra/httpd-ssl.conf # This content used to be included from an external file # /var/cfengine/httpd/conf/extra/httpd-ssl.conf Listen 443 AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl SSLPassPhraseDialog builtin SSLSessionCache "shmcb:{{{vars.sys.workdir}}}/httpd/logs/ssl_scache(512000)" SSLSessionCacheTimeout 300 SSLSessionTickets Off # OCSP stapling is an extension that aims to improve SSL negotiation # performance while mainting visitor privacy. Disabled because of # issues with self signed certs. SSLUseStapling off # SSLStaplingCache "shmcb:logs/stabling-cache(150000)" # TLS Compression should be disabled to avoid CRIME # https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-4929 # SSLCompression off # As part of security hardening we minimize the features provided by OpenSSL. # Case in point, we build openssl 3 without support for compression. As such, # we do not explicitly disable SSL Compression beginning with CFEngine # Enteprprise 3.21.0 as apache is unable to then validate the configuration. # This is not explicitly enabled to allow the requesting client the first # choice of support ciphers # SSLHonorCipherOrder On # We expect that openssl is upgraded with each release and that the most # recent openssl version possible will be used and that it defines ciphers # considered HIGH appropriately. We use HIGH to get a good balance between # browser compatibility and security. Use ~{{vars.sys.workdir}}/openssl ciphers # -v HIGH~ to see what ciphers are considered HIGH security. SSLCipherSuite HIGH # A more secure setting might be: # SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH # Some versions of SSL and TLS are known to be insecure, so we disable them by default SSLProtocol all -SSLv2 -SSLv3 -TLSv1 SSLRandomSeed startup builtin SSLRandomSeed connect builtin DocumentRoot "{{{vars.cfe_internal_hub_vars.public_docroot}}}" Alias "/api" "{{{vars.cfe_internal_hub_vars.docroot}}}/api" Alias "/api/static" "{{{vars.cfe_internal_hub_vars.docroot}}}/api/static" Alias "/ldap" "{{{vars.cfe_internal_hub_vars.docroot}}}/ldap" ServerName {{{vars.sys.fqhost}}}:443 # ServerAdmin root@localhost ErrorLog "{{{vars.cfe_internal_hub_vars.error_log}}}" LogFormat "%h %l %{username}n %t \"%r\" %>s %b" TransferLog "{{{vars.cfe_internal_hub_vars.access_log}}}" SSLEngine on SSLCertificateFile "{{{vars.cfe_internal_hub_vars.SSLCertificateFile}}}" SSLCertificateKeyFile "{{{vars.cfe_internal_hub_vars.SSLCertificateKeyFile}}}" # Enable Strict Transport Security to prevent HTTPS users from # accessing http content. Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" Header always set X-Frame-Options DENY Header always set X-Content-Type-Options nosniff SSLOptions +StdEnvVars SSLOptions +StdEnvVars AllowOverride None BrowserMatch "MSIE [2-5]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog "{{{vars.cfe_internal_hub_vars.ssl_request_log}}}" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" LoadModule php{{{vars.cfe_internal_hub_vars.php_version}}}_module modules/libphp{{{vars.cfe_internal_hub_vars.php_version}}}.so AddHandler php{{{vars.cfe_internal_hub_vars.php_version}}}-script .php AddType application/x-httpd-php-source php{{{vars.cfe_internal_hub_vars.php_version}}} Options -Indexes +FollowSymLinks +MultiViews Order deny,allow AllowOverride None RewriteEngine On {{^classes.cfe_enterprise_enable_plain_http}} # Force https with redirection RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] {{/classes.cfe_enterprise_enable_plain_http}} {{#classes.mission_portal_index_php_redirect_enabled}} # redirect from `index.php/path` to `/path` RewriteCond %{REQUEST_URI} !(.*)/api/(.*) [NC] #do not apply redirect to internal APIs for backward compatibility RewriteCond %{THE_REQUEST} /index\.php/(.+)\sHTTP [NC] RewriteRule ^ /%1 [NE,L,R] {{/classes.mission_portal_index_php_redirect_enabled}} RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^(.*)$ /index.php/$1 [NC,L] Order deny,allow AllowOverride None RewriteEngine On RewriteRule ^static/(.+)$ static/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.php [QSA,L] Order deny,allow AllowOverride None # What do we use mod_mime for? AddType text/csv .csv AddType application/pdf .pdf AddType application/json .json Order deny,allow AllowOverride None RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] # Whats in here that got a specific deny? Deny from all AllowOverride None