HTTP 严格传输安全性

HTTP 严格传输安全性 (HSTS) 是帮助防范网站遭受中间人攻击(例如协议降级攻击和 Cookie 劫持)的策略机制。

在 SUSE Multi-Linux Manager 中,HSTS 功能默认处于启用状态。如果您需要在服务器上禁用该功能,请按照以下过程操作:

过程:在服务器上禁用 HSTS
  1. On the server container host, as root, execute the following command to create a new configuration file with setting max-age=0:

    mgrctl exec -- \
      echo 'Header always set Strict-Transport-Security "max-age=0; includeSubDomains"' \
      > /etc/apache2/conf.d/zz-spacewalk-www-hsts.conf
  2. 使用以下命令重启 Apache:

    mgrctl exec -- systemctl restart apache2

如果您需要在代理上禁用该功能,请按照以下过程操作:

过程:在代理上禁用 HSTS
  1. On the server container host, as root, execute the following command to create a new configuration file with setting max-age=0:

    echo 'Header always set Strict-Transport-Security "max-age=0; includeSubDomains' \
      > /etc/uyuni/custom-httpd.conf
  2. 运行以下命令:

    mgrpxy install podman --tuning-httpd /etc/uyuni/custom-httpd.conf config.tar.gz

When naming the new config file <filename>.conf, make sure it is loaded at the right time. For example, to override something defined in spacewalk-www.conf the new file needs to be alphabetically after this file. For more information about how Apache loads files, see https://httpd.apache.org/docs.

在使用 SUSE Multi-Linux Manager 生成的默认 SSL 证书或自我签名证书的情况下启用 HSTS 后,浏览器将拒绝通过 HTTPS 进行连接,除非用于为此类证书签名的 CA 受浏览器信任。如果您使用的是 SUSE Multi-Linux Manager 生成的 SSL 证书,可以通过将 http://<服务器主机名>/pub/RHN-ORG-TRUSTED-SSL-CERT 中的文件导入到所有用户的浏览器来信任该证书。