עזרה בהוספת includeSubDomains לכותרת Strict-Transport-Security

סיכום מבוסס בינה מלאכותית

A user is seeking help to add the includeSubDomains directive to the Strict-Transport-Security (HSTS) header in their Discourse installation. They have tried two methods to modify the app.yml file, but neither has worked. The user has confirmed that running the sed command manually inside the container works, but they are unsure why it doesn’t work through the app.yml configuration. The discussion also touches on whether including includeSubDomains is necessary or just a configuration choice. RGJ explains that it depends on whether the forum is on an apex domain and whether the client can control HSTS headers on other externally hosted subdomains. The user confirms that their forum is not on an apex domain, and RGJ advises that it’s best practice for each host to enforce its own HSTS rules in such cases.

לקוח השתמש בסורק אבטחה מועיל וכעת מאמין שכותרת ה-Strict-Transport-Security צריכה לכלול ‘includeSubdomains’.

הוספתי את שניהם ל-app.yml:


  after_ssl:
    - replace:
        filename: /etc/nginx/conf.d/outlets/server/20-https.conf
        from: "max-age=31536000;"
        to:  "max-age=31536000; includeSubDomains;"
    - replace:
        filename: /etc/nginx/conf.d/outlets/discourse/20-https.conf
        from: "max-age=31536000;"
        to:  "max-age=31536000; includeSubDomains;"
- exec: sed -i "s/add_header Strict-Transport-Security 'max-age=31536000';/add_header Strict-Transport-Security \"max-age=31536000; includeSubDomains\" always;/" /etc/nginx/conf.d/outlets/discourse/20-https.conf /etc/nginx/conf.d/outlets/server/20-https.conf

אף אחד מהם לא עובד. הרצת פקודת ה-sed השנייה בתוך הקונטיינר עובדת ולאחר הפעלה מחדש של nginx, עושה את מה שנדרש.

אני לא מבין למה זה לא עובד.

בנוסף, זה היה בעבר בתבנית, אך נראה שהוא הוסר בשנת 2014, אך כמה פוסטים אחרונים כוללים כותרות שמציגות את includeSubdomains שם.

אני מבולבל.

Hmm.. you don’t seem to be getting an answer here. Does this topic belong in Development or #installation:hosting? :thinking:

Well,l I moved it there, but the initial issue is that someone claimed that not setting includeSubDomains was a security issue.

I’d love it if someone who knew and cared about whether having IncludeSubDomains in the the STS header was important could address the issue so perhaps I could tell this person that hundreds of thousands of other sites disagree and that perhaps the script that someone ran to find these “security flaws” is wrong.

So maybe I should rename this “missing includeSubDomains in STS header considered harmful”

I would call it a configuration choice instead.

Is the forum on an apex domain or not?

I always tell people that we are very cautious of setting headers that affect other hostnames on their domain, and if they want to have HSTS on those, they should set the headers on those respective hosts instead.

The only valid reason I can think of is they cannot do that, e.g. when the forum is on an apex domain and the client is not able to control the HSTS headers on other externally hosted hosts, e.g. they have hostedshopify.example.com as well. Then they basically come to you because you’re the path of least resistance :slight_smile:

It is not.

That’s what I think I thought, though I wasn’t able to articulate it.

Thanks. I’ll tell them that since it’s not the Apex domain it’s Best Practice to have each host enforce its own rules.

Thanks so very much. This is a big help. At least now am pretty sure thatI understand.