How to set security header

Discussion in 'General' started by holzfelix, Jul 9, 2019.

  1. holzfelix

    holzfelix New Member

    Hi I want to set the security headers for a website.
    I added this to the Apache Directives:

    Header set X-XSS-Protection "1; mode=block"
    Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    Header always append X-Frame-Options DENY
    Header set X-Content-Type-Options nosniff
    Header set Content-Security-Policy "default-src 'self';"
    Header set X-Permitted-Cross-Domain-Policies "none"
    Header set Referrer-Policy "no-referrer"


    Unfortunately, this has no effects.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you have the header module in apache activated?
     
  3. holzfelix

    holzfelix New Member

    Yes I double checked it:

    a2enmod headers
    Module headers already enabled
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Check the config directory which contains the vhost files, this is normally /etc/apache2/sites-available/
    is there a copy of the vhost file of this site with a .err ending? If yes, then apache rejected the config e.g. due to syntax errors.
     
  5. holzfelix

    holzfelix New Member

    No there are no error files.

    only gateway.domain.de.vhost and gateway.domain.de.vhost-le-ssl.conf
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

  7. holzfelix

    holzfelix New Member

    I used it with certbot
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    And that's the problem, certbot may not be used to modify apache config files outside of ISPConfig as certbot is not able to edit the apache config file correctly which then locks up the site. Read the thread that I linked to above, I explained the procedure to fix your issue there.
     
  9. holzfelix

    holzfelix New Member

    I updated to git stable. And removed the vhost. I deleted the webpage and set up a new one

    I checked the Lets Encrypt SSL ... but domain is not secured
     
  10. holzfelix

    holzfelix New Member

    ah it needs some time to set up the ssl
     
  11. holzfelix

    holzfelix New Member

    I did this successfully for one domain but on other it dosn't work. what could be the issue?
    When I leave save Let's Encrypt ssl and reload the page the checkboxes are unchecked.
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

Share This Page