FROM ubuntu:20.04 MAINTAINER ich@boxi.ch LABEL name="Apache HTTPD Reverse-Proxy with OpenID Connect Authentication support based on Ubuntu 20.04" ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y --no-install-recommends \ apache2 curl wget \ ca-certificates \ libjansson4 \ libapache2-mod-auth-openidc \ vim apt-utils && \ rm -rf /var/lib/apt/lists/* && \ a2enmod auth_openidc && \ a2enmod headers && \ a2enmod proxy && \ a2enmod proxy_http && \ a2enmod rewrite && \ a2enmod ssl && \ a2enmod env && \ a2enmod mime && \ a2enmod proxy_wstunnel && \ a2enmod negotiation ADD apache2.conf /etc/apache2/apache2.conf ENV APACHE_RUN_GROUP www-data ENV APACHE_RUN_USER www-data ENV APACHE_RUN_DIR /var/run/apache2 ENV APACHE_PID_FILE /var/run/apache2/pid ENV APACHE_LOG_DIR /var/log/apache2 # set to debug to debug apache oid problems # BE AWARE: loglevel debug will log all tokens and MUST NEVER be used in production ENV APACHE_DEBUG_LEVEL warn # add and configure default ssl certs #ADD apache.crt /etc/ssl/certs/ssl.crt #ADD apache.key /etc/ssl/private/ssl.key #ENV SSL_CERTIFICATE_FILE "/etc/ssl/certs/ssl.crt" #ENV SSL_CERTIFICATE_KEY_FILE "/etc/ssl/private/ssl.key" ENV SERVER_NAME "localhost" ENV KC_ADDR "http://kubernetes.docker.internal:8081" ENV KC_REALM "boxit" ENV OIDC_CLIENT_ID "c7300da4-df95-412d-8fc7-0759ac4e781c" ENV OIDC_CLIENT_SECRET 'e08f6a4d-e2f0-4929-a85f-29c817a17168' ENV OIDC_AUDIENCE "audience=https%3A%2F%2Fdev.7mal8.ch%2F" ENV OIDC_SCOPE "openid name email" ENV OIDC_REDIRECT_URI "http://localhost/openidc" ENV OIDC_CRYPTO_PASSPHRASE 'some_random_secret_4321' ENV OIDC_INFO_HOOK "iat access_token access_token_expires id_token userinfo" ENV OIDC_PROVIDER_URL "http://id.boxi.ch" ENV OIDC_PROVIDER_ENDSESSION_ENDPOINT "/v2/logout" ENV OIDC_RETURN_TO "http://localhost/openidc?logout=get" RUN mkdir -p /var/run/apache2 /var/www/html/app && \ mkdir -p /config/global.d && \ mkdir -p /config/vhost-80.d && \ mkdir -p /config/vhost-443.d && \ chmod -R 755 /var/www/html/app && \ chown -R www-data /var/run/apache2 /var/log/apache2 /var/www/html/app && \ rm /etc/apache2/sites-enabled/000-default.conf ADD index.html /var/www/html/app # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop STOPSIGNAL WINCH COPY httpd-foreground /usr/local/bin/ EXPOSE 80 CMD ["httpd-foreground"]