Skip to content

Commit 065da7a

Browse files
authored
Merge pull request #38 from shingo78/feature/simplesamlphp-2.1
Upgrade SimpleSAMLphp to 2.1 and PHP to 8.2
2 parents 5c15b70 + 501ceec commit 065da7a

20 files changed

Lines changed: 684 additions & 426 deletions

auth-proxy/Dockerfile

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:22.04
22

3-
ARG SIMPLESAMLPHP_VERSION="1.19.7"
3+
ARG SIMPLESAMLPHP_VERSION="2.1.4"
44
ARG ATTRIBUTE_AGGREGATOR_URL="https://github.com/NII-cloud-operation/simplesamlphp-module-attributeaggregator"
55
ARG ATTRIBUTE_AGGREGATOR_BRANCH="dev-2.x-gakunin-cloud-gateway"
66

@@ -23,31 +23,45 @@ RUN set -x \
2323
unzip \
2424
supervisor \
2525
cron \
26+
gnupg2 \
27+
ca-certificates \
28+
lsb-release \
29+
ubuntu-keyring \
30+
patch \
2631
&& apt-get clean \
2732
&& rm -rf /var/lib/apt/lists/*
2833
RUN set -x \
29-
&& add-apt-repository ppa:nginx/stable \
34+
&& curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
35+
| tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null \
36+
&& gpg --dry-run --quiet --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg | grep 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
37+
&& echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
38+
http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
39+
| tee /etc/apt/sources.list.d/nginx.list \
40+
&& echo "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
41+
| tee /etc/apt/preferences.d/99nginx \
3042
&& add-apt-repository ppa:ondrej/php \
3143
&& apt-get update \
3244
&& apt-get -y --no-install-recommends --no-install-suggests install \
3345
nginx \
34-
php8.1-cli \
35-
php8.1-fpm \
36-
php8.1-common \
37-
php8.1-xml \
38-
php8.1-pgsql \
39-
&& php8.1 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
40-
&& php8.1 -r "if (hash_file('sha384', 'composer-setup.php') === '$(curl -q https://composer.github.io/installer.sig)') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
41-
&& php8.1 composer-setup.php \
42-
&& php8.1 -r "unlink('composer-setup.php');" \
46+
php8.2-cli \
47+
php8.2-fpm \
48+
php8.2-common \
49+
php8.2-xml \
50+
php8.2-pgsql \
51+
php8.2-sqlite3 \
52+
&& php8.2 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
53+
&& php8.2 -r "if (hash_file('sha384', 'composer-setup.php') === '$(curl -q https://composer.github.io/installer.sig)') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
54+
&& php8.2 composer-setup.php \
55+
&& php8.2 -r "unlink('composer-setup.php');" \
4356
&& mv composer.phar /usr/local/bin/composer \
4457
&& chmod +x /usr/local/bin/composer \
4558
&& ln -sf /dev/stdout /var/log/nginx/access.log \
4659
&& ln -sf /dev/stderr /var/log/nginx/error.log \
4760
&& mkdir -p /run/php \
4861
# Install simplesamlphp
62+
&& mkdir -p /var/www \
4963
&& cd /var/www \
50-
&& curl -Lo /var/www/downloaded-simplesamlphp.tar.gz https://github.com/simplesamlphp/simplesamlphp/releases/download/v${SIMPLESAMLPHP_VERSION}/simplesamlphp-${SIMPLESAMLPHP_VERSION}.tar.gz \
64+
&& curl -Lo /var/www/downloaded-simplesamlphp.tar.gz https://github.com/simplesamlphp/simplesamlphp/releases/download/v${SIMPLESAMLPHP_VERSION}/simplesamlphp-${SIMPLESAMLPHP_VERSION}-full.tar.gz \
5165
&& tar xvfz downloaded-simplesamlphp.tar.gz \
5266
&& mv $( ls | grep simplesaml | grep -v *tar.gz ) simplesamlphp \
5367
&& rm /var/www/downloaded-simplesamlphp.tar.gz \
@@ -59,17 +73,21 @@ COPY resources/composer.json /var/www/composer.json
5973
RUN cd /var/www && composer install --no-dev
6074

6175
# Configure PHP settings
62-
RUN perl -pi -e 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/8.1/fpm/php.ini && \
63-
perl -pi -e 's/allow_url_fopen = Off/allow_url_fopen = On/g' /etc/php/8.1/fpm/php.ini && \
64-
perl -pi -e 's/expose_php = On/expose_php = Off/g' /etc/php/8.1/fpm/php.ini && \
65-
perl -pi -e 's/;?\s*session\.gc_maxlifetime\s*=\s*.+/session.gc_maxlifetime = 10800/g' /etc/php/8.1/fpm/php.ini
76+
RUN perl -pi -e 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/8.2/fpm/php.ini && \
77+
perl -pi -e 's/allow_url_fopen = Off/allow_url_fopen = On/g' /etc/php/8.2/fpm/php.ini && \
78+
perl -pi -e 's/expose_php = On/expose_php = Off/g' /etc/php/8.2/fpm/php.ini && \
79+
perl -pi -e 's/;?\s*session\.gc_maxlifetime\s*=\s*.+/session.gc_maxlifetime = 10800/g' /etc/php/8.2/fpm/php.ini
6680

6781
# Prepare nginx configuration
6882
RUN mkdir /etc/nginx/certs
6983

7084
# Setup simplesamlphp
7185
COPY resources/simplesamlphp/bin/get_idp_proxy_metadata.sh /var/www/simplesamlphp/bin
7286
COPY resources/simplesamlphp/bin/remove_idp_proxy_metadata.sh /var/www/simplesamlphp/bin
87+
COPY resources/simplesamlphp/templates/selectidp-dropdown.twig /var/www/simplesamlphp/templates
88+
COPY resources/simplesamlphp/templates/selectidp-embedded-wayf-start.twig /var/www/simplesamlphp/templates/includes
89+
COPY resources/simplesamlphp/templates/selectidp-embedded-wayf-end.twig /var/www/simplesamlphp/templates/includes
90+
7391
# simplesamlphp keys
7492
RUN set -x \
7593
&& cd /var/www/simplesamlphp/cert \
@@ -80,23 +98,26 @@ RUN set -x \
8098

8199
# simplesamlphp metarefresh module
82100
RUN set -x \
83-
&& touch /var/www/simplesamlphp/modules/cron/enable \
84101
&& mkdir -p /var/www/simplesamlphp/metadata/idp-proxy
85102

103+
# Patch simplesamlphp
104+
COPY resources/simplesamlphp/simplesamlphp.patch /tmp/
105+
RUN set -x \
106+
&& cd /var/www/simplesamlphp \
107+
&& patch -p1 < /tmp/simplesamlphp.patch \
108+
&& rm -f /tmp/simplesamlphp.patch
109+
86110
# Install simplesamlphp-module-attributeaggregator
87111
RUN set -x \
88112
&& apt-get update \
89113
&& apt-get -y --force-yes --no-install-recommends --no-install-suggests install \
90-
php8.1-curl \
91-
php8.1-mbstring \
92-
php8.1-gmp \
93-
php8.1-soap \
94-
php8.1-ldap \
114+
php8.2-curl \
115+
php8.2-mbstring \
116+
php8.2-gmp \
117+
php8.2-soap \
118+
php8.2-ldap \
95119
composer \
96120
&& cd /var/www/simplesamlphp \
97-
&& composer require --dev -W \
98-
"simplesamlphp/simplesamlphp-test-framework:^1.1.5" \
99-
"phpunit/phpunit:^7.5|^8.5|^9.5" "vimeo/psalm:^4.17" \
100121
&& composer config repositories.attributeaggregator "{\"type\": \"vcs\", \"url\": \"${ATTRIBUTE_AGGREGATOR_URL}\", \"no-api\": true}" \
101122
&& composer require --update-no-dev niif/simplesamlphp-module-attributeaggregator:${ATTRIBUTE_AGGREGATOR_BRANCH} \
102123
&& apt-get clean \
@@ -107,9 +128,6 @@ RUN set -x \
107128
&& chown -R www-data:www-data /var/www/simplesamlphp /var/www/vendor \
108129
&& chmod a+x /var/www/simplesamlphp/bin/get_idp_proxy_metadata.sh
109130

110-
# Install custom discoresp.php
111-
COPY resources/saml/www/sp/discoresp.php /var/www/simplesamlphp/modules/saml/www/sp/discoresp.php
112-
113131
# supervisord
114132
COPY resources/supervisord.conf /etc/
115133

0 commit comments

Comments
 (0)