apiVersion: v1
kind: ConfigMap
metadata:
  name: apache-config
data:
  httpd.conf: |+
    ServerRoot "/usr/local/apache2"
    Listen 80

    LoadModule authn_file_module modules/mod_authn_file.so
    LoadModule authn_core_module modules/mod_authn_core.so
    LoadModule authz_host_module modules/mod_authz_host.so
    LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
    LoadModule authz_user_module modules/mod_authz_user.so
    LoadModule authz_core_module modules/mod_authz_core.so
    LoadModule access_compat_module modules/mod_access_compat.so
    LoadModule auth_basic_module modules/mod_auth_basic.so
    LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
    LoadModule reqtimeout_module modules/mod_reqtimeout.so
    LoadModule filter_module modules/mod_filter.so
    LoadModule mime_module modules/mod_mime.so
    LoadModule log_config_module modules/mod_log_config.so
    LoadModule env_module modules/mod_env.so
    LoadModule setenvif_module modules/mod_setenvif.so
    LoadModule version_module modules/mod_version.so
    LoadModule ssl_module modules/mod_ssl.so
    LoadModule unixd_module modules/mod_unixd.so
    LoadModule status_module modules/mod_status.so
    LoadModule autoindex_module modules/mod_autoindex.so
    LoadModule dir_module modules/mod_dir.so

    <IfModule unixd_module>
    User daemon
    Group daemon
    </IfModule>

    ServerAdmin you@example.com

    <Directory />
        AllowOverride none
        Require all denied
    </Directory>

    DocumentRoot "/usr/local/apache2/htdocs"
    <Directory "/usr/local/apache2/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>

    <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>

    <Files ".ht*">
        Require all denied
    </Files>

    ErrorLog /dev/stderr
    LogLevel warn

    <IfModule log_config_module>
        LogFormat "%h %l %u %t \"%r\" %>s %b" common
        CustomLog /dev/stdout common
    </IfModule>


    <IfModule mime_module>
        TypesConfig conf/mime.types
        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz
    </IfModule>

    # Configure mod_proxy_html to understand HTML4/XHTML1
    <IfModule proxy_html_module>
        Include conf/extra/proxy-html.conf
    </IfModule>

    # Secure (SSL/TLS) connections
    Include conf/extra/httpd-ssl.conf
    <IfModule ssl_module>
        SSLRandomSeed startup builtin
        SSLRandomSeed connect builtin
    </IfModule>
  httpd-ssl.conf: |+
    Listen 443
    SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4
    SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4
    SSLHonorCipherOrder on
    SSLProtocol all -SSLv3
    SSLProxyProtocol all -SSLv3
    SSLPassPhraseDialog  builtin
    SSLSessionCache        "shmcb:/usr/local/apache2/logs/ssl_scache(512000)"
    SSLSessionCacheTimeout  300


    <VirtualHost _default_:443>

        DocumentRoot "/usr/local/apache2/htdocs"
        ServerName www.example.com:443
        ServerAdmin you@example.com
        ErrorLog "/dev/stderr"
        TransferLog "/dev/stdout"

        SSLEngine on

        SSLCertificateFile "/run/secrets/keyparty/tls.crt"
        SSLCertificateKeyFile "/run/secrets/keyparty/tls.key"
        #SSLCertificateChainFile "/usr/local/apache2/conf/server-ca.crt"
        SSLCACertificateFile "/run/secrets/keyparty/tls.ca"

        #SSLCARevocationFile "/usr/local/apache2/conf/ssl.crl/ca-bundle.crl"
        #SSLCARevocationCheck chain

        SSLVerifyClient require
        #SSLVerifyDepth  10

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory "/usr/local/apache2/cgi-bin">
            SSLOptions +StdEnvVars
        </Directory>


        CustomLog "/dev/stdout" \
                  "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

    </VirtualHost>
