refactor(all): complete rework of the repo

Moving to a recipeless way of doing things
This commit is contained in:
2023-06-09 12:17:09 +02:00
parent b13a5e892f
commit 351f693775
13 changed files with 109 additions and 123 deletions

View File

@ -0,0 +1,20 @@
FROM reg.cadoles.com/proxy_cache/library/alpine:edge
#FROM reg.cadoles.com/proxy_cache/library/httpd:alpine3.18
# Adding testing repo
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk update && apk add apache-mod-auth-openidc apache2-ssl
RUN mkdir -p /var/www/html
COPY files/alpine/sp-oidc/base/conf.d/mod-auth-openidc.conf /etc/apache2/conf.d/mod-auth-openidc.conf
COPY files/alpine/sp-oidc/base/conf.d/default-vhost.conf /etc/apache2/conf.d/default-vhost.conf
COPY files/alpine/sp-oidc/base/scripts/httpd-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/httpd-foreground
RUN mkdir -p /var/www/html
RUN chown apache:apache /var/www/html
SHELL ["/bin/sh", "-c"]
CMD ["/usr/local/bin/httpd-foreground"]

View File

@ -0,0 +1,29 @@
<VirtualHost _default_:80>
ServerName ${SP_SERVER_NAME}:80
DocumentRoot /var/www/html
CustomLog /proc/self/fd/1 common
ErrorDocument 400 /error/
ErrorDocument 401 /error/
ErrorDocument 403 /error/
ErrorDocument 404 /error/
ErrorDocument 500 /error/
ErrorDocument 502 /error/
ErrorDocument 503 /error/
ErrorDocument 504 /error/
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
<Location /error>
AllowOverride All
Options +Indexes
Require all granted
</Location>
</VirtualHost>

View File

@ -0,0 +1,14 @@
LoadModule auth_openidc_module modules/mod_auth_openidc.so
OIDCProviderMetadataURL ${SP_OIDC_PROVIDER_METADATA_URL}
OIDCClientID ${SP_OIDC_CLIENT_NAME}
OIDCClientSecret ${SP_OIDC_CLIENT_SECRET}
OIDCProviderTokenEndpointAuth client_secret_basic
OIDCCookieSameSite On
OIDCSessionType client-cookie
OIDCXForwardedHeaders X-Forwarded-Host
# OIDCRedirectURI is a vanity URL that must point to a path protected by this module but must NOT point to any content
OIDCRedirectURI ${SP_OIDC_REDIRECT_URI}
OIDCCryptoPassphrase ${SP_OIDC_CRYPTO_PASSPHRASE}
OIDCOAuthAcceptTokenAs header
OIDCUnAutzAction 302 ${SP_OIDC_ERROR_URI}

View File

@ -0,0 +1,7 @@
#!/bin/sh
set -e
# Apache gets grumpy about PID files pre-existing
rm -f /run/apache2/httpd.pid
exec httpd -DFOREGROUND "$@"

View File

@ -0,0 +1,23 @@
#!/bin/bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
source "$SCRIPT_DIR/lib.sh"
# Test reg.cadoles.com/cadoles/symfony:alpine-php-7.4-standalone with Symfony 4.4
test_alpine_sp_oidc() {
# FIXME
local container_name=$(run_symfony_app_container "4.4" "7.4" "alpine-php-7.4-standalone")
local image_name=$(docker inspect -f '{{.Config.Image}}' ${container_name})
trap_add "docker kill ${container_name}" EXIT
trap_add "docker rmi -f ${image_name}" EXIT
local app_url="http://$(docker port ${container_name} 8080/tcp)"
# Check that application is responding as expected
local page_content=$(curl -s "${app_url}" | pandoc -f html -t plain)
assert_matches 'Welcome to Symfony 4\.4\.*' "${page_content}" "Could not find Symfony default welcome message !"
}

View File

@ -0,0 +1,7 @@
#!/bin/sh
set -e
# Apache gets grumpy about PID files pre-existing
rm -f /run/apache2/httpd.pid
exec httpd -DFOREGROUND "$@"