2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-21 23:28:19 +00:00
Files
xcat-core/xCAT-server/xCAT-wsapi/xcat-ws.conf
T
Daniel Hilst 6bc7800bba fix(xcat-core): deny the REST aliases when mod_rewrite is not loaded
xcat-ws.conf sends /xcatws and /xcatwsv2 to https only when mod_rewrite is
loaded. Without that module the aliases run the REST CGI on any port.

An IfModule !mod_rewrite.c block now answers 403 for both aliases.
RedirectMatch comes from mod_alias, which the ScriptAlias lines of the
same file already require. Other paths, such as /install, are not changed.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-05 14:03:14 -03:00

29 lines
903 B
Plaintext

# The Apache configuration for the xCAT REST API, for every RPM family.
#
# Do not add a LoadModule: it names one distribution's module directory and is
# then absent on the others, which stops Apache from starting.
# Redirect http to https. Guarded because mod_rewrite can be absent.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTPS} !=on
RewriteRule ^/?xcatws/(.*) https://%{SERVER_NAME}/xcatws/$1 [R,L]
RewriteRule ^/?xcatwsv2/(.*) https://%{SERVER_NAME}/xcatwsv2/$1 [R,L]
</IfModule>
# Without the redirect, deny the REST aliases.
<IfModule !mod_rewrite.c>
RedirectMatch 403 ^/xcatws(v2)?(/|$)
</IfModule>
<FilesMatch "^(xcatws.cgi|zvmxcatws.cgi)$">
# Both spellings, so one file serves Apache 2.2 and 2.4.
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</FilesMatch>