Skip to content

Commit 174ed0e

Browse files
committed
Merge remote-tracking branch 'origin/master' into edge
2 parents 16f58f9 + 5e37278 commit 174ed0e

File tree

8 files changed

+100
-11
lines changed

8 files changed

+100
-11
lines changed

mig/install/apache-MiG-template.conf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ Alias /assets/ "__MIG_CODE__/assets/"
114114
Alias /public/ "__MIG_STATE__/wwwpublic/"
115115
# Bind security.txt (https://securitytxt.org/) once and for all
116116
Alias /.well-known/security.txt "__MIG_STATE__/wwwpublic/.well-known/security.txt"
117+
<IfDefine STATUS_ALIAS_FQDN>
118+
# Status page helpers
119+
Alias /status.html "__MIG_STATE__/wwwpublic/status.html"
120+
Alias /status-events.json "__MIG_STATE__/wwwpublic/status-events.json"
121+
</IfDefine>
117122
<Directory "__MIG_STATE__/wwwpublic">
118123
AuthType none
119124
<IfVersion > 2.2>
@@ -432,6 +437,9 @@ __IS_VERIFYCERTS_COMMENTED__ <VirtualHost *:${PUBLIC_HTTP_PORT}>
432437
<IfDefine PUBLIC_ALIAS_FQDN>
433438
ServerAlias ${PUBLIC_ALIAS_FQDN}
434439
</IfDefine>
440+
<IfDefine STATUS_ALIAS_FQDN>
441+
ServerAlias ${STATUS_ALIAS_FQDN}
442+
</IfDefine>
435443
# Optionally add extra server aliases for current and future use here
436444
#ServerAlias something.__BASE_FQDN__ somethingelse.__BASE_FQDN__
437445

@@ -475,6 +483,11 @@ __IS_VERIFYCERTS_COMMENTED__ <VirtualHost *:${PUBLIC_HTTP_PORT}>
475483
__PREFER_HTTPS_COMMENTED__ RewriteCond %{HTTP_HOST} ^${PUBLIC_ALIAS_FQDN}$
476484
__PREFER_HTTPS_COMMENTED__ RewriteRule ^/?(.*) https://${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}/$1 [R,L]
477485
__PREFER_HTTPS_COMMENTED__ </IfDefine>
486+
__PREFER_HTTPS_COMMENTED__ <IfDefine STATUS_ALIAS_FQDN>
487+
__PREFER_HTTPS_COMMENTED__ RewriteCond %{HTTPS} off
488+
__PREFER_HTTPS_COMMENTED__ RewriteCond %{HTTP_HOST} ^${STATUS_ALIAS_FQDN}$
489+
__PREFER_HTTPS_COMMENTED__ RewriteRule ^/?(.*) https://${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}/$1 [R,L]
490+
__PREFER_HTTPS_COMMENTED__ </IfDefine>
478491
__PREFER_HTTPS_COMMENTED__</IfDefine>
479492

480493
# NOTE: redirect all remaining enabled protected address requests to https
@@ -609,6 +622,9 @@ __IS_VERIFYCERTS_COMMENTED__ <VirtualHost *:${PUBLIC_HTTP_PORT}>
609622
<VirtualHost ${PUBLIC_FQDN}:${PUBLIC_HTTPS_PORT}>
610623
ServerName ${PUBLIC_FQDN}
611624
ServerAlias __BASE_FQDN__
625+
<IfDefine STATUS_ALIAS_FQDN>
626+
ServerAlias ${STATUS_ALIAS_FQDN}
627+
</IfDefine>
612628
# Optionally add extra server aliases for current and future use here
613629
#ServerAlias something.__BASE_FQDN__ somethingelse.__BASE_FQDN__
614630

@@ -660,6 +676,12 @@ __IS_VERIFYCERTS_COMMENTED__ <VirtualHost *:${PUBLIC_HTTP_PORT}>
660676
RewriteLogLevel 0
661677
</IfVersion>
662678

679+
<IfDefine STATUS_ALIAS_FQDN>
680+
# Redirect implict target to status page
681+
RewriteCond %{SERVER_NAME} ^${STATUS_ALIAS_FQDN}$
682+
RewriteRule ^(/*)$ /status.html [L,R]
683+
</IfDefine>
684+
663685
# Break rewriting chain for commonly-requested final destinations
664686
# * Direct files (including subrequest for /X.py from /wsgi-bin/X.py)
665687
# * Xgi scripts
@@ -734,6 +756,9 @@ __IS_VERIFYCERTS_COMMENTED__ <VirtualHost *:${PUBLIC_HTTP_PORT}>
734756
<IfDefine PUBLIC_ALIAS_FQDN>
735757
<VirtualHost ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}>
736758
ServerName ${PUBLIC_ALIAS_FQDN}
759+
<IfDefine STATUS_ALIAS_FQDN>
760+
ServerAlias ${STATUS_ALIAS_FQDN}
761+
</IfDefine>
737762
# General setup for the virtual host
738763
DocumentRoot "__MIG_STATE__/wwwpublic"
739764
ErrorLog __APACHE_LOG__/ssl-error.log
@@ -774,6 +799,12 @@ __IS_VERIFYCERTS_COMMENTED__ <VirtualHost *:${PUBLIC_HTTP_PORT}>
774799
RewriteLogLevel 0
775800
</IfVersion>
776801

802+
<IfDefine STATUS_ALIAS_FQDN>
803+
# Redirect implict target to status page
804+
RewriteCond %{SERVER_NAME} ^${STATUS_ALIAS_FQDN}$
805+
RewriteRule ^(/*)$ /status.html [L,R]
806+
</IfDefine>
807+
777808
# Break rewriting chain for commonly-requested final destinations
778809
# * Internal Aliased helper locations
779810
RewriteCond %{QUERY_STRING} ^$

mig/install/apache-apache2-template.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ IncludeOptional __APACHE_ETC__/production-mode*.conf
4848
# Always-on vhosts both for emergency and production mode
4949
__IFDEF_PUBLIC_FQDN__ PUBLIC_FQDN __PUBLIC_FQDN__
5050
__IFDEF_PUBLIC_ALIAS_FQDN__ PUBLIC_ALIAS_FQDN __PUBLIC_ALIAS_FQDN__
51+
__IFDEF_STATUS_ALIAS_FQDN__ STATUS_ALIAS_FQDN __STATUS_ALIAS_FQDN__
5152
# User vhosts are ONLY enabled in actual production mode
5253
<IfDefine PRODUCTION_MODE>
5354
__IFDEF_BASE_FQDN__ BASE_FQDN __BASE_FQDN__

mig/install/apache-ports-template.conf

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ Listen ${PUBLIC_HTTP_PORT}
3333
</IfDefine>
3434
<IfDefine PUBLIC_ALIAS_FQDN>
3535
<IfDefine PUBLIC_HTTPS_PORT>
36-
<IfDefine PRODUCTION_MODE>
37-
#NameVirtualHost ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
36+
__APACHE_PRE2.4__ NameVirtualHost ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
3837
__PUBLIC_ALIAS_HTTPS_LISTEN__ ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
3938
</IfDefine>
40-
<IfDefine !PRODUCTION_MODE>
41-
# Also force listen on PUBLIC_ALIAS_FQDN here if not in PRODUCTION_MODE
42-
Listen ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
4339
</IfDefine>
40+
<IfDefine STATUS_ALIAS_FQDN>
41+
<IfDefine PUBLIC_HTTPS_PORT>
42+
__APACHE_PRE2.4__ NameVirtualHost ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
43+
__STATUS_ALIAS_HTTPS_LISTEN__ ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
4444
</IfDefine>
4545
</IfDefine>
4646
<IfDefine MIG_CERT_FQDN>
@@ -66,10 +66,16 @@ Listen ${PUBLIC_HTTP_PORT}
6666
<IfModule mod_gnutls.c>
6767
<IfDefine PUBLIC_ALIAS_FQDN>
6868
<IfDefine PUBLIC_HTTPS_PORT>
69-
#NameVirtualHost ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
69+
__APACHE_PRE2.4__ NameVirtualHost ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
7070
__PUBLIC_ALIAS_HTTPS_LISTEN__ ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
7171
</IfDefine>
7272
</IfDefine>
73+
<IfDefine STATUS_ALIAS_FQDN>
74+
<IfDefine PUBLIC_HTTPS_PORT>
75+
__APACHE_PRE2.4__ NameVirtualHost ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
76+
__STATUS_ALIAS_HTTPS_LISTEN__ ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
77+
</IfDefine>
78+
</IfDefine>
7379
<IfDefine MIG_CERT_FQDN>
7480
<IfDefine MIG_CERT_PORT>
7581
__APACHE_PRE2.4__ NameVirtualHost ${MIG_CERT_FQDN}:${MIG_CERT_PORT}

mig/install/generateconfs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --- BEGIN_HEADER ---
55
#
66
# generateconfs - create custom MiG server configuration files
7-
# Copyright (C) 2003-2025 The MiG Project
7+
# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH
88
#
99
# This file is part of MiG.
1010
#
@@ -76,6 +76,7 @@ def main(argv, _generate_confs=generate_confs, _print=print):
7676
'base_fqdn',
7777
'public_fqdn',
7878
'public_alias_fqdn',
79+
'status_alias_fqdn',
7980
'public_sec_fqdn',
8081
'mig_cert_fqdn',
8182
'ext_cert_fqdn',

mig/shared/install.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ def generate_confs(
292292
base_fqdn='',
293293
public_fqdn='',
294294
public_alias_fqdn='',
295+
status_alias_fqdn='',
295296
public_sec_fqdn='',
296297
mig_cert_fqdn='',
297298
ext_cert_fqdn='',
@@ -613,6 +614,7 @@ def _generate_confs_prepare(
613614
base_fqdn,
614615
public_fqdn,
615616
public_alias_fqdn,
617+
status_alias_fqdn,
616618
public_sec_fqdn,
617619
mig_cert_fqdn,
618620
ext_cert_fqdn,
@@ -843,6 +845,7 @@ def _generate_confs_prepare(
843845
user_dict['__BASE_FQDN__'] = base_fqdn
844846
user_dict['__PUBLIC_FQDN__'] = public_fqdn
845847
user_dict['__PUBLIC_ALIAS_FQDN__'] = public_alias_fqdn
848+
user_dict['__STATUS_ALIAS_FQDN__'] = status_alias_fqdn
846849
if public_use_https:
847850
if public_sec_fqdn:
848851
user_dict['__PUBLIC_SEC_FQDN__'] = public_sec_fqdn
@@ -1081,6 +1084,7 @@ def _generate_confs_prepare(
10811084
user_dict['__GDP_PATH_SCRAMBLE__'] = gdp_path_scramble
10821085
user_dict['__PUBLIC_HTTPS_LISTEN__'] = listen_clause
10831086
user_dict['__PUBLIC_ALIAS_HTTPS_LISTEN__'] = listen_clause
1087+
user_dict['__STATUS_ALIAS_HTTPS_LISTEN__'] = listen_clause
10841088
user_dict['__QUOTA_BACKEND__'] = quota_backend
10851089
user_dict['__QUOTA_USER_LIMIT__'] = "%s" % quota_user_limit
10861090
user_dict['__QUOTA_VGRID_LIMIT__'] = "%s" % quota_vgrid_limit
@@ -1220,6 +1224,9 @@ def _generate_confs_prepare(
12201224
user_dict['__IFDEF_PUBLIC_ALIAS_FQDN__'] = 'UnDefine'
12211225
if user_dict['__PUBLIC_ALIAS_FQDN__']:
12221226
user_dict['__IFDEF_PUBLIC_ALIAS_FQDN__'] = 'Define'
1227+
user_dict['__IFDEF_STATUS_ALIAS_FQDN__'] = 'UnDefine'
1228+
if user_dict['__STATUS_ALIAS_FQDN__']:
1229+
user_dict['__IFDEF_STATUS_ALIAS_FQDN__'] = 'Define'
12231230

12241231
user_dict['__IFDEF_MIG_CERT_FQDN__'] = 'UnDefine'
12251232
if user_dict['__MIG_CERT_FQDN__']:
@@ -2092,6 +2099,11 @@ def _generate_confs_prepare(
20922099
# Apache fails on duplicate listen clauses
20932100
if public_use_https and public_alias_fqdn == public_fqdn:
20942101
user_dict['__PUBLIC_ALIAS_HTTPS_LISTEN__'] = "# %s" % listen_clause
2102+
if status_alias_fqdn:
2103+
# Apache fails on duplicate listen clauses
2104+
if public_use_https and status_alias_fqdn in (public_fqdn,
2105+
public_alias_fqdn):
2106+
user_dict['__STATUS_ALIAS_HTTPS_LISTEN__'] = "# %s" % listen_clause
20952107

20962108
if mig_cert_fqdn:
20972109
user_dict['__MIG_CERT_URL__'] = 'https://%(__MIG_CERT_FQDN__)s' % \

tests/fixture/confs-stdlocal/MiG.conf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ Alias /assets/ "/home/mig/mig/assets/"
114114
Alias /public/ "/home/mig/state/wwwpublic/"
115115
# Bind security.txt (https://securitytxt.org/) once and for all
116116
Alias /.well-known/security.txt "/home/mig/state/wwwpublic/.well-known/security.txt"
117+
<IfDefine STATUS_ALIAS_FQDN>
118+
# Status page helpers
119+
Alias /status.html "/home/mig/state/wwwpublic/status.html"
120+
Alias /status-events.json "/home/mig/state/wwwpublic/status-events.json"
121+
</IfDefine>
117122
<Directory "/home/mig/state/wwwpublic">
118123
AuthType none
119124
<IfVersion > 2.2>
@@ -432,6 +437,9 @@ Alias /.well-known/security.txt "/home/mig/state/wwwpublic/.well-known/security.
432437
<IfDefine PUBLIC_ALIAS_FQDN>
433438
ServerAlias ${PUBLIC_ALIAS_FQDN}
434439
</IfDefine>
440+
<IfDefine STATUS_ALIAS_FQDN>
441+
ServerAlias ${STATUS_ALIAS_FQDN}
442+
</IfDefine>
435443
# Optionally add extra server aliases for current and future use here
436444
#ServerAlias something. somethingelse.
437445

@@ -475,6 +483,11 @@ Alias /.well-known/security.txt "/home/mig/state/wwwpublic/.well-known/security.
475483
RewriteCond %{HTTP_HOST} ^${PUBLIC_ALIAS_FQDN}$
476484
RewriteRule ^/?(.*) https://${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}/$1 [R,L]
477485
</IfDefine>
486+
<IfDefine STATUS_ALIAS_FQDN>
487+
RewriteCond %{HTTPS} off
488+
RewriteCond %{HTTP_HOST} ^${STATUS_ALIAS_FQDN}$
489+
RewriteRule ^/?(.*) https://${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}/$1 [R,L]
490+
</IfDefine>
478491
</IfDefine>
479492

480493
# NOTE: redirect all remaining enabled protected address requests to https
@@ -609,6 +622,9 @@ Alias /.well-known/security.txt "/home/mig/state/wwwpublic/.well-known/security.
609622
<VirtualHost ${PUBLIC_FQDN}:${PUBLIC_HTTPS_PORT}>
610623
ServerName ${PUBLIC_FQDN}
611624
ServerAlias
625+
<IfDefine STATUS_ALIAS_FQDN>
626+
ServerAlias ${STATUS_ALIAS_FQDN}
627+
</IfDefine>
612628
# Optionally add extra server aliases for current and future use here
613629
#ServerAlias something. somethingelse.
614630

@@ -660,6 +676,12 @@ Alias /.well-known/security.txt "/home/mig/state/wwwpublic/.well-known/security.
660676
RewriteLogLevel 0
661677
</IfVersion>
662678

679+
<IfDefine STATUS_ALIAS_FQDN>
680+
# Redirect implict target to status page
681+
RewriteCond %{SERVER_NAME} ^${STATUS_ALIAS_FQDN}$
682+
RewriteRule ^(/*)$ /status.html [L,R]
683+
</IfDefine>
684+
663685
# Break rewriting chain for commonly-requested final destinations
664686
# * Direct files (including subrequest for /X.py from /wsgi-bin/X.py)
665687
# * Xgi scripts
@@ -734,6 +756,9 @@ Alias /.well-known/security.txt "/home/mig/state/wwwpublic/.well-known/security.
734756
<IfDefine PUBLIC_ALIAS_FQDN>
735757
<VirtualHost ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}>
736758
ServerName ${PUBLIC_ALIAS_FQDN}
759+
<IfDefine STATUS_ALIAS_FQDN>
760+
ServerAlias ${STATUS_ALIAS_FQDN}
761+
</IfDefine>
737762
# General setup for the virtual host
738763
DocumentRoot "/home/mig/state/wwwpublic"
739764
ErrorLog /var/log/apache2/ssl-error.log
@@ -774,6 +799,12 @@ Alias /.well-known/security.txt "/home/mig/state/wwwpublic/.well-known/security.
774799
RewriteLogLevel 0
775800
</IfVersion>
776801

802+
<IfDefine STATUS_ALIAS_FQDN>
803+
# Redirect implict target to status page
804+
RewriteCond %{SERVER_NAME} ^${STATUS_ALIAS_FQDN}$
805+
RewriteRule ^(/*)$ /status.html [L,R]
806+
</IfDefine>
807+
777808
# Break rewriting chain for commonly-requested final destinations
778809
# * Internal Aliased helper locations
779810
RewriteCond %{QUERY_STRING} ^$

tests/fixture/confs-stdlocal/apache2.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ IncludeOptional /etc/apache2/production-mode*.conf
4848
# Always-on vhosts both for emergency and production mode
4949
UnDefine PUBLIC_FQDN
5050
UnDefine PUBLIC_ALIAS_FQDN
51+
UnDefine STATUS_ALIAS_FQDN
5152
# User vhosts are ONLY enabled in actual production mode
5253
<IfDefine PRODUCTION_MODE>
5354
UnDefine BASE_FQDN

tests/fixture/confs-stdlocal/ports.conf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ Listen ${PUBLIC_HTTP_PORT}
3333
</IfDefine>
3434
<IfDefine PUBLIC_ALIAS_FQDN>
3535
<IfDefine PUBLIC_HTTPS_PORT>
36-
<IfDefine PRODUCTION_MODE>
3736
#NameVirtualHost ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
3837
#Listen ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
3938
</IfDefine>
40-
<IfDefine !PRODUCTION_MODE>
41-
# Also force listen on PUBLIC_ALIAS_FQDN here if not in PRODUCTION_MODE
42-
Listen ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
4339
</IfDefine>
40+
<IfDefine STATUS_ALIAS_FQDN>
41+
<IfDefine PUBLIC_HTTPS_PORT>
42+
#NameVirtualHost ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
43+
#Listen ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
4444
</IfDefine>
4545
</IfDefine>
4646
<IfDefine MIG_CERT_FQDN>
@@ -70,6 +70,12 @@ Listen ${PUBLIC_HTTP_PORT}
7070
#Listen ${PUBLIC_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
7171
</IfDefine>
7272
</IfDefine>
73+
<IfDefine STATUS_ALIAS_FQDN>
74+
<IfDefine PUBLIC_HTTPS_PORT>
75+
#NameVirtualHost ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
76+
#Listen ${STATUS_ALIAS_FQDN}:${PUBLIC_HTTPS_PORT}
77+
</IfDefine>
78+
</IfDefine>
7379
<IfDefine MIG_CERT_FQDN>
7480
<IfDefine MIG_CERT_PORT>
7581
#NameVirtualHost ${MIG_CERT_FQDN}:${MIG_CERT_PORT}

0 commit comments

Comments
 (0)