-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.rocky8
executable file
·1657 lines (1551 loc) · 64.3 KB
/
Dockerfile.rocky8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Default ARG values which may be overriden in build command with
# docker-compose build --build-arg KEY=VAL
# as in
# make init && make build ARGS="--build-arg MIG_SVN_REV=HEAD"
# or using
# docker-compose build
# with .env file in place
#
# IMPORTANT: all ARGS here that should allow being overriden from .env MUST be
# explicitly listed in docker-compose.yml *args* list, too.
# Furthermore they must be declared after FROM in each stage used.
ARG DOCKER_MIGRID_ROOT=.
ARG ARCH=amd64
ARG UID=1000
ARG GID=1000
ARG DOMAIN=migrid.test
ARG WILDCARD_DOMAIN=*.migrid.test
ARG PUBLIC_DOMAIN=www.migrid.test
ARG PUBLIC_ALIAS_DOMAIN=
ARG MIGCERT_DOMAIN=cert.migrid.test
ARG EXTCERT_DOMAIN=
ARG MIGOID_DOMAIN=ext.migrid.test
ARG EXTOID_DOMAIN=
ARG EXTOIDC_DOMAIN=
ARG SID_DOMAIN=sid.migrid.test
ARG IO_DOMAIN=io.migrid.test
ARG OPENID_DOMAIN=openid.migrid.test
ARG FTPS_DOMAIN=ftps.migrid.test
ARG SFTP_DOMAIN=sftp.migrid.test
ARG WEBDAVS_DOMAIN=webdavs.migrid.test
ARG MIG_OID_PROVIDER=https://ext.migrid.test/openid/
ARG EXT_OID_PROVIDER=unset
ARG EXT_OIDC_PROVIDER_META_URL=unset
ARG EXT_OIDC_CLIENT_NAME=unset
ARG EXT_OIDC_CLIENT_ID=unset
ARG EXT_OIDC_SCOPE=unset
ARG EXT_OIDC_REMOTE_USER_CLAIM=unset
ARG EXT_OIDC_PASS_CLAIM_AS=unset
ARG PUBLIC_HTTP_PORT=80
ARG PUBLIC_HTTPS_PORT=444
ARG MIGCERT_HTTPS_PORT=446
ARG EXTCERT_HTTPS_PORT=447
ARG MIGOID_HTTPS_PORT=443
ARG EXTOID_HTTPS_PORT=445
ARG EXTOIDC_HTTPS_PORT=449
ARG SID_HTTPS_PORT=448
ARG SFTP_SUBSYS_PORT=22222
ARG SFTP_PORT=2222
ARG SFTP_SHOW_PORT=22
ARG DAVS_PORT=4443
ARG DAVS_SHOW_PORT=443
ARG FTPS_CTRL_PORT=8021
ARG FTPS_CTRL_SHOW_PORT=21
ARG OPENID_PORT=8443
ARG OPENID_SHOW_PORT=443
ARG MIG_SVN_REPO=https://svn.code.sf.net/p/migrid/code/trunk
ARG MIG_SVN_REV=HEAD
ARG MIG_GIT_REPO=https://github.com/ucphhpc/migrid-sync.git
ARG MIG_GIT_BRANCH=main
ARG MIG_GIT_REV=HEAD
ARG ADMIN_EMAIL=mig
ARG ADMIN_LIST=
ARG SUPPORT_EMAIL=mig
ARG SMTP_SENDER=
ARG SMTP_SERVER=localhost
ARG SMTP_PORT=25
ARG LOG_LEVEL=info
ARG TITLE="Minimum intrusion Grid"
ARG SHORT_TITLE=MiG
ARG MIG_OID_TITLE=MiG
ARG EXT_OID_TITLE=External
ARG PEERS_PERMIT="distinguished_name:.*"
ARG VGRID_CREATORS="distinguished_name:.*"
ARG VGRID_MANAGERS="distinguished_name:.*"
ARG DEFAULT_VGRID_LINKS="files web"
ARG ADVANCED_VGRID_LINKS="files web scm tracker workflows monitor"
ARG HG_PATH=/usr/bin/hg
ARG HGWEB_SCRIPTS=/usr/share/doc/mercurial
ARG TRAC_ADMIN_PATH=""
ARG TRAC_INI_PATH=""
ARG EMULATE_FLAVOR=migrid
ARG EMULATE_FQDN=migrid.org
ARG SKIN_SUFFIX=basic
ARG ENABLE_OPENID=True
ARG ENABLE_SFTP=True
ARG ENABLE_SFTP_SUBSYS=True
ARG ENABLE_DAVS=True
ARG ENABLE_FTPS=True
ARG ENABLE_SHARELINKS=True
ARG ENABLE_TRANSFERS=True
ARG ENABLE_DUPLICATI=True
ARG ENABLE_SEAFILE=False
ARG SEAFILE_FQDN=
ARG SEAFILE_RO_ACCESS=False
ARG ENABLE_SANDBOXES=False
ARG ENABLE_VMACHINES=False
ARG ENABLE_CRONTAB=True
ARG ENABLE_JOBS=True
ARG ENABLE_RESOURCES=True
ARG ENABLE_EVENTS=True
ARG ENABLE_GRAVATARS=True
ARG ENABLE_SITESTATUS=True
ARG STATUS_SYSTEM_MATCH="ANY"
ARG ENABLE_FREEZE=False
ARG PERMANENT_FREEZE=""
ARG ENABLE_CRACKLIB=True
ARG ENABLE_IMNOTIFY=False
ARG ENABLE_NOTIFY=True
ARG ENABLE_PREVIEW=False
ARG ENABLE_WORKFLOWS=False
ARG ENABLE_VERIFY_CERTS=True
ARG ENABLE_JUPYTER=True
ARG ENABLE_CLOUD=False
ARG CLOUD_ACCESS=cloud-access.yaml
ARG CLOUD_JUMPHOST_KEY=cloud-jumphost-key
ARG OPENSTACKSDK_VERSION_OVERRIDE=
ARG ENABLE_MIGADMIN=False
ARG ENABLE_GDP=False
ARG ENABLE_TWOFACTOR=True
ARG ENABLE_TWOFACTOR_STRICT_ADDRESS=False
ARG TWOFACTOR_AUTH_APPS=""
ARG ENABLE_PEERS=True
ARG ENABLE_QUOTA=False
ARG PEERS_MANDATORY=False
ARG PEERS_EXPLICIT_FIELDS=""
ARG PEERS_CONTACT_HINT="authorized to invite you as peer"
ARG ENABLE_SELF_SIGNED_CERTS=False
ARG MIG_PASSWORD_POLICY="MEDIUM"
ARG ENABLE_LOGROTATE="False"
# TODO: logrotate conf needs to be adjusted to the manual docker service launch
#ARG LOGROTATE_MIGRID="True"
ARG LOGROTATE_MIGRID="False"
ARG BUILD_MOD_AUTH_OPENID=False
# NOTE: mod auth openidc is a bit dated in OS repo - allow optional upgrade
ARG UPGRADE_MOD_AUTH_OPENIDC=False
# NOTE: source for optional mod auth openidc upgrade
# Defaults to a relatively recent upstream release if left unset.
# Alternatives are available at
# https://github.com/OpenIDC/cjose/releases
# https://github.com/OpenIDC/mod_auth_openidc/releases
ARG UPGRADE_OIDC_CJOSE_SRC=""
ARG UPGRADE_OIDC_AUTH_MOD_SRC=""
ARG UPGRADE_PARAMIKO=False
ARG PUBKEY_FROM_DNS=False
# NOTE: python2 support is going away in rocky8+
ARG WITH_PY3=True
ARG PREFER_PYTHON3=False
ARG SIGNUP_METHODS=migoid
ARG LOGIN_METHODS=migoid
ARG USER_INTERFACES=V3
# TODO: expose and enable new user default UI
#ARG NEW_USER_DEFAULT_UI=V3
ARG AUTO_ADD_CERT_USER=False
ARG AUTO_ADD_OID_USER=False
ARG AUTO_ADD_OIDC_USER=False
ARG AUTO_ADD_FILTER_FIELDS=
ARG AUTO_ADD_FILTER_METHOD=
ARG AUTO_ADD_USER_PERMIT="distinguished_name:.*"
ARG CERT_VALID_DAYS=365
ARG OID_VALID_DAYS=365
ARG GENERIC_VALID_DAYS=365
ARG EXT_OIDC_PKCE_METHOD=""
ARG EXT_OIDC_PROVIDER_ISSUER=""
ARG EXT_OIDC_PROVIDER_AUTHORIZATION_ENDPOINT=""
ARG EXT_OIDC_PROVIDER_TOKEN_ENDPOINT=""
ARG EXT_OIDC_PROVIDER_USER_INFO_ENDPOINT=""
ARG EXT_OIDC_PROVIDER_TOKEN_ENDPOINT_AUTH=""
ARG EXT_OIDC_USER_INFO_TOKEN_METHOD=""
ARG EXT_OIDC_USER_INFO_SIGNED_RESPONSE_ALG=""
ARG EXT_OIDC_COOKIE_SAME_SITE=""
ARG EXT_OIDC_PASS_COOKIES=""
ARG EXT_OIDC_RESPONSE_MODE=""
ARG EXT_OIDC_PROVIDER_VERIFY_CERT_FILES=""
ARG EXT_OIDC_PRIVATE_KEY_FILES=""
ARG EXT_OIDC_PUBLIC_KEY_FILES=""
ARG EXT_OIDC_ID_TOKEN_ENCRYPTED_RESPONSE_ALG=""
ARG EXT_OIDC_ID_TOKEN_ENCRYPTED_RESPONSE_ENC=""
ARG EXT_OIDC_REWRITE_COOKIE=""
ARG EXT_OIDC_TITLE=""
ARG DEFAULT_MENU=
ARG USER_MENU=jupyter
ARG CA_FQDN=""
ARG CA_SMTP="localhost"
ARG CA_USER="mig-ca"
ARG FTPS_PASV_PORTS="8100:8400"
ARG SECSCAN_ADDR=""
# TODO: expose and enable notify protocols
#ARG NOTIFY_PROTOCOLS="email"
ARG IMNOTIFY_ADDRESS=""
ARG IMNOTIFY_CHANNEL=""
ARG IMNOTIFY_USERNAME=""
ARG IMNOTIFY_PASSWD=""
ARG EXTERNAL_DOC="https://sourceforge.net/p/migrid/wiki"
ARG IO_ACCOUNT_EXPIRE="False"
# TODO: expose and enable these UI vars
#ARG PEERS_NOTICE=""
#ARG LOGO_CENTER=""
#ARG SUPPORT_TEXT=""
#ARG PRIVACY_TEXT=""
ARG DATASAFETY_LINK=""
ARG DATASAFETY_TEXT=""
# NOTE: stay with wsgidav-1.3 for python2 to avoid CVE-2022-41905, we already get 4.3+ for python3
ARG MODERN_WSGIDAV=False
ARG WITH_GIT=False
ARG OPENSSH_VERSION=7.4
ARG VGRID_LABEL=VGrid
ARG DIGEST_SALT="AUTO"
ARG CRYPTO_SALT="AUTO"
ARG EXTRA_USERPAGE_SCRIPTS=""
ARG EXTRA_USERPAGE_STYLES=""
ARG GDP_EMAIL_NOTIFY=True
ARG GDP_ID_SCRAMBLE=safe_hash
ARG GDP_PATH_SCRAMBLE=safe_encrypt
ARG STORAGE_PROTOCOLS=AUTO
ARG WWWSERVE_MAX_BYTES=-1
ARG SFTP_MAX_SESSIONS=32
ARG WSGI_PROCS=25
ARG APACHE_WORKER_PROCS=256
ARG QUOTA_BACKEND=""
ARG QUOTA_USER_LIMIT=1099511627776
ARG QUOTA_VGRID_LIMIT=1099511627776
ARG QUOTA_LUSTRE_VERSION="2.15.4"
ARG QUOTA_LUSTRE_BASE="/dev/null"
ARG QUOTA_GOCRYPTFS_XRAY="/dev/null"
ARG QUOTA_GOCRYPTFS_SOCK="/dev/null"
# Jupyter Arguments
ARG JUPYTER_SERVICES=""
ARG JUPYTER_SERVICES_DESC="{}"
# Cloud Arguments
ARG CLOUD_SERVICES=""
ARG CLOUD_SERVICES_DESC="{}"
#------------------------- first stage -----------------------------#
FROM --platform=linux/$ARCH rockylinux:8 AS init
ARG UID
ARG GID
ARG DOMAIN
ARG WILDCARD_DOMAIN
ARG PUBLIC_DOMAIN
ARG MIGCERT_DOMAIN
ARG EXTCERT_DOMAIN
ARG MIGOID_DOMAIN
ARG EXTOID_DOMAIN
ARG EXTOIDC_DOMAIN
ARG SID_DOMAIN
ARG IO_DOMAIN
ARG OPENID_DOMAIN
ARG FTPS_DOMAIN
ARG SFTP_DOMAIN
ARG WEBDAVS_DOMAIN
ARG PUBLIC_HTTP_PORT
ARG PUBLIC_HTTPS_PORT
ARG MIGCERT_HTTPS_PORT
ARG EXTCERT_HTTPS_PORT
ARG MIGOID_HTTPS_PORT
ARG EXTOID_HTTPS_PORT
ARG EXTOIDC_HTTPS_PORT
ARG SID_HTTPS_PORT
ARG SFTP_PORT
ARG SFTP_SUBSYS_PORT
ARG DAVS_PORT
ARG FTPS_CTRL_PORT
ARG OPENID_PORT
#ARG MIG_SVN_REPO
#ARG MIG_SVN_REV
#ARG MIG_GIT_REPO
#ARG MIG_GIT_BRANCH
#ARG MIG_GIT_REV
#ARG EMULATE_FLAVOR
#ARG EMULATE_FQDN
ARG WITH_PY3
ARG JUPYTER_SERVICES
ARG CLOUD_SERVICES
#ARG WITH_GIT
RUN echo "UID and GID: $UID $GID"
RUN echo "Domains: $DOMAIN" "${PUBLIC_DOMAIN}" "${MIGCERT_DOMAIN}" \
"${EXTCERT_DOMAIN}" "${MIGOID_DOMAIN}" "${EXTOID_DOMAIN}" \
"${EXTOIDC_DOMAIN}" "${SID_DOMAIN}" "${IO_DOMAIN}" \
"${OPENID_DOMAIN}" "${SFTP_DOMAIN}" "${FTPS_DOMAIN}" \
"${WEBDAVS_DOMAIN}"
RUN echo "Ports: " "${PUBLIC_HTTP_PORT} ${PUBLIC_HTTPS_PORT}" \
"${MIGOID_HTTPS_PORT} ${EXTOID_HTTPS_PORT} ${EXTOIDC_HTTPS_PORT}" \
"${MIGCERT_HTTPS_PORT} ${EXTCERT_HTTPS_PORT}" \
"${SID_HTTPS_PORT} ${SFTP_PORT} ${SFTP_SUBSYS_PORT}" \
"${FTPS_CTRL_PORT} ${DAVS_PORT} ${OPENID_PORT}"
#RUN echo "MiG svn repo and revision: $MIG_SVN_REPO $MIG_SVN_REV"
#RUN echo "MiG git repo , branch and revision: $MIG_GIT_REPO $MIG_GIT_BRANCH $MIG_GIT_REV"
#RUN echo "Emulate flavor: $EMULATE_FLAVOR"
#RUN echo "Emulate FQDN: $EMULATE_FQDN"
RUN echo "Enable python3 support: $WITH_PY3"
#RUN echo "Designated jupyter services: $JUPYTER_SERVICES"
#RUN echo "Designated cloud services: $CLOUD_SERVICES"
#RUN echo "Enable git checkout: $WITH_GIT"
#------------------------- next stage -----------------------------#
FROM --platform=linux/$ARCH init AS base
ARG DOMAIN
ARG WILDCARD_DOMAIN
ARG ENABLE_GDP
ARG ENABLE_SELF_SIGNED_CERTS
ARG BUILD_MOD_AUTH_OPENID
ARG UPGRADE_MOD_AUTH_OPENIDC
ARG UPGRADE_OIDC_CJOSE_SRC
ARG UPGRADE_OIDC_AUTH_MOD_SRC
ARG UPGRADE_PARAMIKO
ARG ENABLE_CLOUD
ARG WITH_PY3
ARG PREFER_PYTHON3
ARG UID
ARG GID
ARG SMTP_SERVER
ARG SMTP_PORT
ARG ADMIN_EMAIL
WORKDIR /tmp
# Add common shell aliases
COPY shell-aliases.sh /etc/profile.d/
# TODO: is this also a problem with rocky8+?
# Centos image default yum configs prevent docs installation
# https://superuser.com/questions/784451/centos-on-docker-how-to-install-doc-files
RUN sed -i '/nodocs/d' /etc/yum.conf
# NOTE: Enable powertools repo by default on Rocky for cracklib-devel, sshfs, ...
RUN dnf update -y \
&& dnf install -y epel-release dnf-plugins-core \
&& dnf config-manager --set-enabled powertools \
&& dnf clean all \
&& rm -fr /var/cache/dnf
RUN dnf update -y \
&& dnf module enable -y mod_auth_openidc \
&& dnf install -y \
gcc \
make \
glibc-langpack-en \
pam-devel \
nss-devel \
openssl-devel \
httpd \
htop \
openssh \
cronie \
crontabs \
nano \
mod_ssl \
# NOTE: python2 wsgi is no longer available here - prepare for pip2 build
#mod_wsgi \
httpd-devel \
# NOTE: mod_proxy is included in base httpd now
#mod_proxy \
# NOTE: OpenID 2.0 needs special care here
#mod_auth_openid \
mod_auth_openidc \
tzdata \
initscripts \
svn \
git \
vim \
net-tools \
telnet \
ca-certificates \
mercurial \
openssh-server \
openssh-clients \
rsyslog \
rsyslog-gnutls \
lsof \
python2-pip \
python2-devel \
# NOTE: several packages are only available through pip
#python2-paramiko \
#python2-enchant \
#python2-jsonrpclib \
python2-requests \
python2-psutil \
#python2-email-validator \
#python2-future \
#python2-cffi \
#pysendfile \
#pyOpenSSL \
python2-pyyaml \
# NOTE: generally install cracklib from pip as yum/dnf only has py2 version
#cracklib-python \
cracklib-devel \
# NOTE: extra dependencies required for paramiko pip install
redhat-rpm-config pkg-config rust cargo libffi-devel \
lftp \
rsync \
fail2ban \
ipset \
wget \
patch \
esmtp \
# NOTE: no default paramiko for python2 here
#&& [ "${UPGRADE_PARAMIKO}" = True ] || dnf install -y python-paramiko \
# NOTE: no default openstack client for python2 here
#&& [ "${ENABLE_CLOUD}" != "True" ] || dnf install -y python-openstackclient \
&& dnf clean all \
&& rm -fr /var/cache/dnf
RUN if [ "${WITH_PY3}" = "True" ]; then \
echo "install py3 deps" \
&& dnf update -y \
&& dnf install -y \
python3-pip \
python3-devel \
python3-mod_wsgi \
python3-enchant \
#python3-jsonrpclib \
python3-requests \
python3-psutil \
python3-email-validator \
python3-future \
python3-cffi \
python3-pyOpenSSL \
# NOTE: lxml and libxslt-devel required to build python-openid2
python3-lxml \
python3-pycurl \
python3-PyYAML \
# NOTE: setuptools_rust requires typing-extensions and pip3 pulls in a
# slightly incompatible version 4.1.1 causing random errors like
# https://github.com/python/typing_extensions/issues/10
# We explicitly install the slightly older but stable 3.7.4 version
# here or with pip3 instead.
# Rocky 8 repos include it so just install here.
python3-typing-extensions \
# NOTE: only install default paramiko if upgrade not requested
&& [ "${UPGRADE_PARAMIKO}" = "True" ] || dnf install -y python3-paramiko \
# NOTE: no default openstack client for python3 here
#&& [ "${ENABLE_CLOUD}" != "True" ] || dnf install -y python3-openstackclient \
&& dnf clean all \
&& rm -fr /var/cache/dnf; \
else \
echo "no py3 deps"; \
fi;
# Containers have esmtp installed by default but we explicitly include it above
# and configure it for host SMTP delivery for cronjobs etc to be able to route
# mail outside containers.
RUN if [ -n "${SMTP_SERVER}" ]; then \
[ -z "${SMTP_PORT}" ] && SMTP_PORT=25; \
echo "# Simple SMTP setup to route all local mail to host SMTP" > /etc/esmtprc && \
echo "hostname ${SMTP_SERVER}:${SMTP_PORT}" >> /etc/esmtprc && \
echo "qualifydomain ${DOMAIN}" >> /etc/esmtprc ; \
fi
# NOTE: python extensions libpam and libnss need matching python-config
RUN if [ "${PREFER_PYTHON3}" = "True" ]; then \
echo "set up py3 as default python and python-config" && \
update-alternatives --set python /usr/bin/python3; \
update-alternatives --install /usr/bin/python-config python-config /usr/bin/python3-config 10; \
else \
echo "set up py2 as default python" && \
update-alternatives --set python /usr/bin/python2; \
update-alternatives --install /usr/bin/python-config python-config /usr/bin/python2-config 10; \
fi;
# Install GDP dependencies
RUN if [ "${ENABLE_GDP}" = "True" ]; then \
echo "install GDP deps" \
&& dnf update -y \
&& dnf install -y \
python-xvfbwrapper \
wkhtmltopdf \
xorg-x11-server-Xvfb \
&& dnf clean all \
&& rm -fr /var/cache/dnf \
&& pip2 install pdfkit; \
if [ "${WITH_PY3}" = "True" ]; then \
echo "install py3 deps" && \
dnf update -y && \
dnf install -y python3-xvfbwrapper \
&& dnf clean all \
&& rm -fr /var/cache/dnf \
&& pip3 install pdfkit; \
fi; \
else \
echo "no GDP deps"; \
fi;
# Prepare mod WSGI for py2 (no longer in dnf here)
# See standalone notes on https://pypi.org/project/mod-wsgi/
#RUN dnf install -y apr-devel && dnf clean all && rm -fr /var/cache/dnf
#RUN pip2 install mod_wsgi-standalone
RUN pip2 install mod_wsgi && \
#find /usr/lib64/python2.7/site-packages/mod_wsgi && \
cp /usr/lib64/python2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so \
/etc/httpd/modules/mod_wsgi.so && \
pip2 uninstall -y mod_wsgi
# Apache OpenID (provided by epel for centos7) is unavailable here - build instead.
#RUN dnf update -y && dnf install -y mod_auth_openid \
# && dnf clean all \
# && rm -fr /var/cache/dnf
# Build mod_auth_openid from source if requested - mainly for rocky8+ or self-signed hack
RUN echo "BUILD_MOD_AUTH_OPENID: $BUILD_MOD_AUTH_OPENID"
RUN echo "ENABLE_SELF_SIGNED_CERTS: $ENABLE_SELF_SIGNED_CERTS"
RUN if [ "$BUILD_MOD_AUTH_OPENID" = "True" -o "$ENABLE_SELF_SIGNED_CERTS" = "True" ]; then \
echo "building mod_auth_openid from centos7 source rpm" \
&& dnf update -y \
&& dnf install -y gcc-c++ \
rpm-build \
mock \
make \
autoconf \
automake \
httpd-devel \
libcurl-devel \
libtidy-devel \
pcre-devel \
openssl-devel \
libtool \
sqlite-devel \
boost-devel \
libxslt \
expat-devel \
tidy-devel \
libuuid-devel \
&& dnf clean all \
&& rm -fr /var/cache/dnf \
# NOTE: add EPEL CentOS 7 repos here but completely disabled
&& cat /etc/yum.repos.d/epel.repo | \
sed 's/\[epel/\[epel7/g;s/\(epel[a-z-]*\)-8/\1-7/g;s/8/7/g;s/enabled=1/enabled=0/g' \
> /etc/yum.repos.d/epel7.repo \
&& echo "build libopkele from centos7 source rpm" \
# NOTE: avoid hard-coded version using yumdownloader from yum-utils
&& yumdownloader -y --enablerepo=epel7-source --source --resolve --destdir /root/rpmbuild/SRPMS libopkele \
&& rpm -ivh /root/rpmbuild/SRPMS/libopkele-*.src.rpm \
# Optionally pull more recent gcc4.9 patch from Debian on rocky8+ (local copy in patches)
&& wget -O /root/rpmbuild/SOURCES/fix-ftbfs-gcc4.9.diff https://sources.debian.org/data/main/libo/libopkele/2.0.4%2Bgit20140305.9651b55-4/debian/patches/fix-ftbfs-gcc4.9.diff \
# Pull the more recent required OpenSSL-1.1 patch from Debian on rocky8+ (local copy in patches)
&& wget -O /root/rpmbuild/SOURCES/fix-openssl-1.1.0.diff https://sources.debian.org/data/main/libo/libopkele/2.0.4%2Bgit20140305.9651b55-4/debian/patches/fix-openssl-1.1.0.diff \
# Pull patch from own repo to rpmbuild with Debian patches on rocky8+ (local copy in patches)
&& wget -O /tmp/rpmbuild-opkele-with-gcc4.9-openssl-1.1.0-patches.diff https://github.com/ucphhpc/docker-migrid/raw/master/patches/rpmbuild-opkele-with-gcc4.9-openssl-1.1.0-patches.diff \
&& cd /root && patch -p 0 < /tmp/rpmbuild-opkele-with-gcc4.9-openssl-1.1.0-patches.diff && cd - \
# TODO: is this security crippling needed or a matter of proper apache proxying?
# Disable Apache OpenID ssl-certificate verification if self-signed
# (recompile libopkele with --disable-ssl-verify-host --disable-ssl-verify-peer)
&& if [ "$ENABLE_SELF_SIGNED_CERTS" = "True" ]; then \
echo "Re-building libopkele with ssl verification disabled"; \
sed -i 's/^%configure$/%configure --disable-ssl-verify-host --disable-ssl-verify-peer/g' /root/rpmbuild/SPECS/libopkele.spec; fi \
&& rpmbuild -v -ba /root/rpmbuild/SPECS/libopkele.spec \
&& rm -f /root/rpmbuild/RPMS/*/libopkele-*debug*.rpm \
#&& dnf erase -y 'libopkele-*' \
&& dnf install -y /root/rpmbuild/RPMS/*/libopkele-*.rpm \
&& echo "install mod_auth_openid centos7 source rpm" \
#&& rpm -e --nodeps mod_auth_openid \
# NOTE: avoid hard-coded version using yumdownloader from yum-utils
&& yumdownloader -y --enablerepo=epel7-source --source --resolve --destdir /root/rpmbuild/SRPMS mod_auth_openid \
&& rpm -ivh /root/rpmbuild/SRPMS/mod_auth_openid-*.src.rpm \
&& echo "build mod_auth_openid centos7 source rpm" \
&& rpmbuild -v -ba /root/rpmbuild/SPECS/mod_auth_openid.spec \
&& rm -f /root/rpmbuild/RPMS/*/mod_auth_openid-*debug*.rpm \
&& echo "install the rebuilt mod_auth_openid rpm" \
#&& dnf erase -y 'mod_auth_openid-*' \
&& dnf install -y /root/rpmbuild/RPMS/*/mod_auth_openid-*.rpm \
&& echo "cleaning up after rebuilding and installing mod_auth_openid rpm" \
&& rm -rf /root/rpmbuild \
&& dnf clean all \
&& rm -fr /var/cache/dnf; \
fi;
# Upgrade mod_auth_openidc from upstream github packages if requested - mainly needed for rhel/centos7
# https://stackoverflow.com/questions/68742362/how-to-install-mod-auth-openidc-on-rhel-7
# The module requires a recent cjose library version. Packaged versions are
# also available on the upstream releases page under the 2.4.0 release Assets.
# Version 2.4.12.1+ is needed to support the OIDCPassClaimsAs encoding setting in apache conf
RUN echo "UPGRADE_MOD_AUTH_OPENIDC: $UPGRADE_MOD_AUTH_OPENIDC"
RUN if [ "$UPGRADE_MOD_AUTH_OPENIDC" = "True" ]; then \
if [ -z "${UPGRADE_OIDC_AUTH_MOD_SRC}" ]; then \
echo "upgrading mod_auth_openidc from upstream release package"; \
UPGRADE_OIDC_AUTH_MOD_SRC="https://github.com/OpenIDC/mod_auth_openidc/releases/download/v2.4.16.5/mod_auth_openidc-2.4.16.5-1.el8.x86_64.rpm"; \
else \
echo "upgrading mod_auth_openidc from ${UPGRADE_OIDC_AUTH_MOD_SRC}"; \
fi; \
if [ -z "${UPGRADE_OIDC_CJOSE_SRC}" ]; then \
# NOTE: recent cjose is already included in rocky8+ but lacks security fix
#echo "installing cjose dependency from OS package"; \
#UPGRADE_OIDC_CJOSE_SRC="cjose"; \
echo "upgrading cjose from upstream release package"; \
UPGRADE_OIDC_CJOSE_SRC="https://github.com/OpenIDC/cjose/releases/download/v0.6.2.3/cjose-0.6.2.3-1.el8.x86_64.rpm"; \
else \
echo "upgrading cjose from ${UPGRADE_OIDC_CJOSE_SRC}"; \
fi; \
dnf update -y \
# IMPORTANT: fail hard if any of these installs don't succeed e.g. due
# to missing upstream packages to avoid silent errors later.
&& dnf install -y jansson-devel \
&& dnf install -y \
"${UPGRADE_OIDC_CJOSE_SRC}" \
&& dnf install -y \
"${UPGRADE_OIDC_AUTH_MOD_SRC}" \
&& dnf clean all \
&& rm -fr /var/cache/dnf; \
if [ $? -ne 0 ]; then \
echo "Upgrade Apache OpenID Connect module failed!"; exit 1; \
fi; \
fi;
# Setup container default language to make sure UTF8 is available in wsgi app.
# Otherwise sys.getfilesystemencoding will return ascii despite utf8 FS, and
# thus result e.g. in broken user path and client_id for users with accented
# chars e.g. in their name.
# https://stackoverflow.com/a/28212946
# NOTE: it looks like we don't need to generate this rather common locale here
# but on some platforms it's needed to install an English language pack
# to avoid various LC_X locale warnings and errors.
#RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
# Setup user
ENV USER=mig
ENV GROUP=mig
RUN groupadd -g $GID $USER
RUN useradd -u $UID -g $GID -ms /bin/bash $USER
# MiG environment
ENV MIG_ROOT=/home/$USER
ENV WEB_DIR=/etc/httpd
ENV CERT_DIR=$WEB_DIR/MiG-certificates
USER root
RUN mkdir -p ${CERT_DIR}/MiG/${WILDCARD_DOMAIN} \
&& chown $USER:$GROUP ${CERT_DIR} \
&& chmod 775 ${CERT_DIR}
#------------------------- next stage -----------------------------#
# Certs and keys
FROM --platform=linux/$ARCH base AS setup_security
ARG DOMAIN
ARG WILDCARD_DOMAIN
ARG PUBLIC_DOMAIN
ARG PUBLIC_ALIAS_DOMAIN
ARG MIGCERT_DOMAIN
ARG EXTCERT_DOMAIN
ARG MIGOID_DOMAIN
ARG EXTOID_DOMAIN
ARG EXTOIDC_DOMAIN
ARG SID_DOMAIN
ARG IO_DOMAIN
ARG OPENID_DOMAIN
ARG FTPS_DOMAIN
ARG SFTP_DOMAIN
ARG WEBDAVS_DOMAIN
ARG OS_CA_CERT_SOURCE_PATH=/etc/pki/ca-trust/source/anchors
# Copy in any existing keys+certificates that should be used in containers
COPY certs/ ${CERT_DIR}/
# Dhparam - https://wiki.mozilla.org/Security/Archive/Server_Side_TLS_4.0
RUN if [ ! -e "${CERT_DIR}/.persistent" ]; then \
curl https://ssl-config.mozilla.org/ffdhe4096.txt -o ${CERT_DIR}/dhparams.pem ; fi
# CA
# https://gist.github.com/Soarez/9688998
RUN if [ ! -e "${CERT_DIR}/.persistent" ]; then \
openssl genrsa -des3 -passout pass:qwerty -out ca.key 2048 \
&& openssl rsa -passin pass:qwerty -in ca.key -out ca.key \
&& openssl req -x509 -new -key ca.key \
-subj "/C=DK/ST=NA/L=NA/O=MiGrid-Test/OU=NA/CN=${WILDCARD_DOMAIN}" -out ca.crt \
&& openssl req -x509 -new -nodes -key ca.key -sha256 -days 1024 \
-subj "/C=DK/ST=NA/L=NA/O=MiGrid-Test/OU=NA/CN=${WILDCARD_DOMAIN}" -out ca.pem ; fi
# Server key/ca
# https://gist.github.com/Soarez/9688998
RUN if [ ! -e "${CERT_DIR}/.persistent" ]; then \
openssl genrsa -out server.key 2048 \
&& openssl req -new -key server.key -out server.csr \
-subj "/C=DK/ST=NA/L=NA/O=MiGrid-Test/OU=NA/CN=${WILDCARD_DOMAIN}" \
&& openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt ; fi
# Certificate Revocation List (CRL)
RUN if [ ! -e "${CERT_DIR}/.persistent" ]; then \
mkdir -p /etc/pki/CA \
&& touch /etc/pki/CA/index.txt \
&& echo '00' > /etc/pki/CA/crlnumber \
&& openssl ca -gencrl -keyfile ca.key -cert ca.pem -out crl.pem ; fi
# Daemon keys
RUN if [ ! -e "${CERT_DIR}/.persistent" ]; then \
cat server.{key,crt} > combined.pem \
&& cat server.crt > server.ca.pem \
&& cat ca.pem >> server.ca.pem \
&& chown $USER:$GROUP combined.pem \
&& chown $USER:$GROUP server.ca.pem \
&& ssh-keygen -y -f combined.pem > combined.pub \
&& chown 0:0 *.key server.crt ca.pem \
&& chmod 400 *.key server.crt ca.pem combined.pem server.ca.pem \
&& openssl x509 -noout -fingerprint -sha256 -in combined.pem | \
sed 's/.* Fingerprint=//g' > combined.pem.sha256 \
&& ssh-keygen -l -E md5 -f combined.pub | \
sed 's/.* MD5://g;s/ .*//g' > combined.pub.md5 \
&& ssh-keygen -l -f combined.pub | \
sed 's/.* SHA256://g;s/ .*//g' > combined.pub.sha256; fi
# Prepare keys for mig
RUN if [ ! -e "${CERT_DIR}/.persistent" ]; then \
mv server.crt ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv server.key ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv crl.pem ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv ca.pem ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/cacert.pem \
&& mv combined.pem ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv combined.pem.sha256 ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv combined.pub ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv combined.pub.md5 ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv combined.pub.sha256 ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ \
&& mv server.ca.pem ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/ ; fi
WORKDIR ${CERT_DIR}
RUN if [ ! -e "${CERT_DIR}/.persistent" ]; then \
ln -s MiG/${WILDCARD_DOMAIN}/server.crt server.crt \
&& ln -s MiG/${WILDCARD_DOMAIN}/server.key server.key \
&& ln -s MiG/${WILDCARD_DOMAIN}/crl.pem crl.pem \
&& ln -s MiG/${WILDCARD_DOMAIN}/cacert.pem cacert.pem \
&& ln -s MiG/${WILDCARD_DOMAIN}/combined.pem combined.pem \
&& ln -s MiG/${WILDCARD_DOMAIN}/combined.pem.sha256 combined.pem.sha256 \
&& ln -s MiG/${WILDCARD_DOMAIN}/server.ca.pem server.ca.pem \
&& ln -s MiG/${WILDCARD_DOMAIN}/combined.pub combined.pub \
&& ln -s MiG/${WILDCARD_DOMAIN}/combined.pub.md5 combined.pub.md5 \
&& ln -s MiG/${WILDCARD_DOMAIN}/combined.pub.sha256 combined.pub.sha256 \
&& for domain in "${PUBLIC_DOMAIN}" "${PUBLIC_ALIAS_DOMAIN}" \
"${MIGCERT_DOMAIN}" "${EXTCERT_DOMAIN}" "${MIGOID_DOMAIN}" \
"${EXTOID_DOMAIN}" "${EXTOIDC_DOMAIN}" "${SID_DOMAIN}" \
"${IO_DOMAIN}" "${OPENID_DOMAIN}" "${SFTP_DOMAIN}" \
"${FTPS_DOMAIN}" "${WEBDAVS_DOMAIN}"; do \
[ -L "$domain" ] || ln -s MiG/${WILDCARD_DOMAIN} $domain; \
done ; fi
# Upgrade pip2, required by cryptography - pip-21+ dropped python2 support, however
RUN python2 -m pip install -U 'pip<21'
# Upgrade pip3, required by cryptography - pip-22+ dropped py3.6 support, however
RUN if [ "${WITH_PY3}" = "True" ]; then \
python3 -m pip install -U 'pip<22'; \
fi;
# NOTE: make certs as mig user
WORKDIR $MIG_ROOT
USER $USER
RUN mkdir -p MiG-certificates \
&& cd MiG-certificates \
&& ln -s ${CERT_DIR}/MiG/${WILDCARD_DOMAIN}/cacert.pem cacert.pem \
&& ln -s ${CERT_DIR}/MiG MiG \
&& ln -s ${CERT_DIR}/combined.pem combined.pem \
&& ln -s ${CERT_DIR}/combined.pem.sha256 combined.pem.sha256 \
&& ln -s ${CERT_DIR}/combined.pub combined.pub \
&& ln -s ${CERT_DIR}/combined.pub.md5 combined.pub.md5 \
&& ln -s ${CERT_DIR}/combined.pub.sha256 combined.pub.sha256 \
&& ln -s ${CERT_DIR}/dhparams.pem dhparams.pem
USER root
WORKDIR /tmp
# Copy in any external certificates that should be part of the OS trusted ca bundle
COPY external-certificates/ $OS_CA_CERT_SOURCE_PATH/
RUN update-ca-trust
WORKDIR $MIG_ROOT
USER $USER
#------------------------- next stage -----------------------------#
FROM --platform=linux/$ARCH setup_security AS mig_dependencies
ARG DOMAIN
ARG WITH_PY3
ARG MODERN_WSGIDAV
ARG UPGRADE_PARAMIKO
ARG ENABLE_CLOUD
ARG OPENSTACKSDK_VERSION_OVERRIDE
ARG TRAC_ADMIN_PATH
# NOTE: Switch back to root for system-wide pip install here
USER root
# Prepare py2 dependencies no longer in dnf or just outdated there
# NOTE: use jsonrpclib and pysendfile from pip both for py2 and py3 here
RUN pip2 install 'jsonrpclib<0.2' pysendfile; \
if [ "${WITH_PY3}" = "True" ]; then \
pip3 install 'jsonrpclib<0.2' pysendfile; \
fi;
# NOTE: recent paramiko is required for modern host key algo
# NOTE: paramiko is unavailable for py2 in dnf here so always install it with pip2
RUN if [ "${UPGRADE_PARAMIKO}" = "True" ]; then \
# NOTE: paramiko-3.0.0 & pyOpenSSL-22.0 dropped python2 support
pip2 install 'pyOpenSSL<22' 'paramiko<3'; \
if [ "${WITH_PY3}" = "True" ]; then \
# NOTE: paramiko-3.0.0 & pyOpenSSL-22.0 deps dropped python3.6 support
# NOTE: a newer setuptools MAY be needed and setuptools_rust MUST be
# installed separately here for whatever reason.
# IMPORTANT: sftp_subsys.py is explicitly called with 'python -s' to
# prevent loading arbitrary code libs from user home, but
# with python3 that also excludes packages installed in
# /usr/local, which is now the default install location for
# pip3. Thus, we force pip3 to install the paramiko plus
# dependencies specifically into /usr instead.
#pip3 install -U setuptools; \
# NOTE: explicitly install typing-extensions 3.7 to avoid the
# compatibility issues mentioned in note above.
# Just use distro package on Rocky 8.
#pip3 install 'typing-extensions<3.8'; \
pip3 install setuptools_rust; \
pip3 install --prefix=$(python3-config --prefix) pynacl bcrypt cryptography \
'pyOpenSSL<22' 'paramiko<3'; \
fi; \
else \
# NOTE: mimic python3 dnf versions in this case
pip2 install 'pyOpenSSL<20' 'cryptography<3.3' 'paramiko<2.5'; \
fi;
# NOTE: openstackclient is unavailable in dnf here so always install with pip
# NOTE: openstackclient dropped support for python2.7 in 5.x and python3.6 in 6.x
# NOTE: we need to force preservation of the distro PyYAML package
# NOTE: the rocky8 and centos7 python builds differ for some reason!
# NOTE: openstacksdk-1.5 may have introduced typing conflicts here
# NOTE: cinderclient-6.x introduced python-requests conflict on py2 here
RUN if [ "${ENABLE_CLOUD}" = "True" ]; then \
pip2 install PyYAML==3.12 'openstacksdk<2' 'python-cinderclient<6' \
'python-openstackclient<5'; \
if [ -n "${OPENSTACKSDK_VERSION_OVERRIDE}" ]; then \
pip2 install "openstacksdk==${OPENSTACKSDK_VERSION_OVERRIDE}" ; \
fi; \
if [ "${WITH_PY3}" = "True" ]; then \
pip3 install PyYAML==3.12 'openstacksdk<1.5' 'python-openstackclient<6'; \
if [ -n "${OPENSTACKSDK_VERSION_OVERRIDE}" ]; then \
pip3 install "openstacksdk==${OPENSTACKSDK_VERSION_OVERRIDE}" ; \
fi; \
fi; \
fi;
# Prepare OpenID (python-openid for py2 and python-openid2 for py3)
#RUN pip2 install python-openid
RUN pip2 install https://github.com/openid/python-openid/archive/master.zip
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install python-openid2; \
fi;
# Modules required by grid_events.py
# NOTE: watchdog-1.0 dropped python2 support
RUN pip2 install 'watchdog<1.0' scandir
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install watchdog scandir; \
fi;
# Modules required by grid_webdavs
# NOTE: on python 2 we require either wsgidav 1.3 bundled with cherrypy or
# wsgidav 3.x using standalone cheroot
RUN if [ "${MODERN_WSGIDAV}" = "False" ]; then \
pip2 install 'wsgidav<2'; \
else \
pip2 install 'more-itertools<6' 'jaraco.functools<3' 'jinja2<3' \
'markupsafe<2' 'pyyaml<6' 'cheroot<10.0.1' 'wsgidav<4'; \
fi;
RUN if [ "${WITH_PY3}" = "True" ]; then \
# IMPORTANT: use at least 4.1 here to avoid a potential security issue
# https://github.com/mar10/wsgidav/security/advisories/GHSA-xx6g-jj35-pxjv
# IMPORTANT: use cheroot before 10.0.1 as it currently crashes webdavs
# One can trigger the crash with a simple testssl.sh run
# TODO: investigate if the problem is in cheroot, wsgidav or migrid.
pip3 install 'cheroot<10.0.1' 'wsgidav>=4.1.0'; \
fi;
# Prefer sslkeylog as session tracking helper in webdavs daemon if available.
# Automatic fallback to our _sslsession C-extension when not.
RUN python2 -V 2>&1 | egrep -q 'Python 2\.7\.[0-8]$' || pip2 install sslkeylog
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install sslkeylog ; \
fi;
# Modules required by grid_ftps
# NOTE: relies on pyOpenSSL and Cryptography from yum/dnf for now
# NOTE: python-3.6 fails with unsupported OpenSSL attribute in pyftpdlib-2.x
RUN pip2 install 'pyftpdlib<2.0'
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install 'pyftpdlib<2.0'; \
fi;
# Modules required by grid_X IO daemons (not available in yum/dnf for python3)
# IMPORTANT: install in main python site-packages to work with 'python -s'
# Otherwise sftpsubsys will fail to import it because the /usr/local
# dir used as prefix by default in pip is outside sys.path
RUN pip2 install --prefix=$(python2-config --prefix) cracklib
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install --prefix=$(python3-config --prefix) cracklib; \
fi;
# Module required to run pytests
# NOTE: pytest-5.0 dropped python2 support
RUN pip2 install 'pytest<5.0'
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install pytest; \
fi;
# Modules required by 2FA
# NOTE: pyotp-2.4 dropped python2 support
RUN pip2 install 'pyotp<2.4'
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install pyotp; \
fi;
# Modules required for smart country selection
# NOTE: iso3361-2.0 dropped python2 support
RUN pip2 install 'iso3166<2.0'
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install iso3166; \
fi;
# Modules required for email validation (not available in yum/dnf for python2)
# NOTE: latest version advertizing python-2.7 support is 1.3.0, but it fails
# with SyntaxError on import, so force the previous version on py2.
# https://github.com/JoshData/python-email-validator/issues/91
# NOTE: email-validator relies on dnspython which dropped py2 support in the
# 2.x series, so we force a previous version there.
RUN pip2 install 'dnspython<2.0' 'email-validator<1.3.0'
# IMPORTANT: install in main python site-packages to work with 'python -s'
# Otherwise sftpsubsys will fail to import it because the /usr/local
# dir used as prefix by default in pip is outside sys.path
#RUN if [ "${WITH_PY3}" = "True" ]; then \
# pip3 install --prefix=$(python3-config --prefix) email-validator; \
# fi;
# Modules required for Trac integration
RUN if [ -n "${TRAC_ADMIN_PATH}" ]; then \
echo "install Trac and plugins" \
&& pip2 install Trac TracMercurial TracWikiPrint TracGraphviz TracFullBlog TracWikiCssPlugin; \
if [ "${WITH_PY3}" = "True" ]; then \
pip3 install Trac TracWikiPrint TracGraphviz TracFullBlog TracWikiCssPlugin \
# IMPORTANT: Mercurial plugin is required for our repos and only recent
# stable releases support current python and Trac versions.
# We need 1.0.0.11+ for the default Python 3 and Trac-1.6.
&& pip3 install 'TracMercurial>=1.0.0.11' \
# NOTE: these plugins would be nice but have gone stale and only support
# older Trac versions.
#&& pip3 install TracStats TracMasterTickets TracDiscussion TracDownloads TracWysiwyg \
#&& pip3 install https://trac-hacks.org/svn/tracwysiwygplugin/0.12
# NOTE: install more recent dev versions of those with Trac-1.6+ support
# latest tag https://github.com/trac-hacks/tracstats/releases/tag/v0.6.1 is pre 1.6
&& pip3 install https://github.com/trac-hacks/tracstats/archive/refs/heads/master.zip ; \
fi; \
else \
echo "no Trac deps"; \
fi;
# Modules required for workflows
# NOTE: nbformat-5.0, nbconvert-6.0 and papermill-2.0 dropped python2 support
RUN pip2 install 'nbformat<5.0' 'nbconvert<6.0' 'papermill<2.0'
RUN if [ "${WITH_PY3}" = "True" ]; then \
pip3 install nbformat nbconvert papermill; \
fi;
#------------------------- next stage -----------------------------#
FROM --platform=linux/$ARCH mig_dependencies AS download_mig
LABEL MIGRID=true
ARG DOMAIN
ARG MIG_SVN_REPO
ARG MIG_SVN_REV
ARG WITH_GIT
ARG MIG_GIT_REPO
ARG MIG_GIT_BRANCH
ARG MIG_GIT_REV
ARG PREFER_PYTHON3
ARG MODERN_WSGIDAV
WORKDIR $MIG_ROOT
USER $USER
# Install and configure MiG
# NOTE: git refuses to clone into non-empty dir - use tmp
RUN if [ "$WITH_GIT" = "True" ]; then \
git clone ${MIG_GIT_REPO} migrid.git && \
cd migrid.git && \
git checkout -B ${MIG_GIT_BRANCH} --track origin/${MIG_GIT_BRANCH} && \
git checkout ${MIG_GIT_REV} && cd .. && \
rsync -a migrid.git/ ./ && \
rm -rf migrid.git/ && \
echo "migrid version: ${MIG_GIT_REPO} ${MIG_GIT_BRANCH} ${MIG_GIT_REV}" > ./active-migrid-version.txt; \
else \
svn checkout -r ${MIG_SVN_REV} ${MIG_SVN_REPO} . && \
echo "migrid version: ${MIG_SVN_REPO} trunk ${MIG_SVN_REV}" > ./active-migrid-version.txt; \
fi;
# NOTE: we manually need to toggle grid_webdavs.py link here for now.
# Replace any existing symlink with one to the 1.x or 3.x script.
RUN if [ "${PREFER_PYTHON3}" = "True" -o "${MODERN_WSGIDAV}" = "True" ]; then \
rm -f ${MIG_ROOT}/mig/server/grid_webdavs.py ; \
ln -s grid_webdavs-3.x.py ${MIG_ROOT}/mig/server/grid_webdavs.py; \
else \
rm -f ${MIG_ROOT}/mig/server/grid_webdavs.py ; \
ln -s grid_webdavs-1.x.py ${MIG_ROOT}/mig/server/grid_webdavs.py; \