Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    Mattermost X-Frame-Options and Content-Security-Policy for apache

    Kopano Mattermost
    3
    9
    1654
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • _r9
      _r9 last edited by _r9

      Because it took me some time. This is my apache2 proxy vhost configuration for the mattermost iframe inside Kopano.
      Relates to this article: https://documentation.kopano.io/kopano_mattermost_manual/first_steps.html#configuration-for-kopano-webapp-deskapp

      # # #
      # Kopano Mattermost
      Header set Content-Security-Policy "frame-ancestors 'self' https://your.kopano.webapp.host.local"
      Header set X-Frame-Options "ALLOW-FROM 'https://your.kopano.webapp.host.local'"
      # # #
      
      fbartels 1 Reply Last reply Reply Quote 0
      • fbartels
        fbartels Kopano @_r9 last edited by

        Hi @_r9,

        Can you explain the function difference to the setting from the linked manual?

        Regards Felix

        Resources:
        https://kopano.com/blog/how-to-get-kopano/
        https://documentation.kopano.io/
        https://kb.kopano.io/

        Support overview:
        https://kopano.com/support/

        _r9 1 Reply Last reply Reply Quote 0
        • _r9
          _r9 @fbartels last edited by _r9

          @fbartels The only difference is that this is for the apache2 server instead of nginx. I changed the hostname inside the configuration from my first post to prevent further misconceptions.

          To explain my configuration. I’m testing the Kopano-Docker installation at the moment. I also use the kweb server which does already operate as a proxy. My problem is, that I use an apache2 proxy in front of this server. Besides the proxy server configuration I had to add following configuration inside my apache2 vhost configuration. But I’m still testing this configuration.

          RewriteEngine On
          RewriteCond %{REQUEST_URI} /api/v[0-9]+/(users/)?websocket [NC,OR]
          RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
          RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
          RewriteRule .* wss://$MATTERMOSTSERVER:$MATTERMOSTPORT%{REQUEST_URI} [P,QSA,L]
          
          # # #
          # Kopano Mattermost
          Header set Content-Security-Policy "frame-ancestors 'self' https://your.kopano.webapp.host.local"
          Header set X-Frame-Options "ALLOW-FROM 'https://your.kopano.webapp.host.local'"
          # # #
          
          
          longsleep 1 Reply Last reply Reply Quote 1
          • longsleep
            longsleep Kopano @_r9 last edited by

            @_r9 said in Mattermost X-Frame-Options and Content-Security-Policy for apache:

            Header append Content-Security-Policy “frame-ancestors ‘self’ https://your.kopano.webapp.host.local”
            Header unset Content-Security-Policy

            Why do you first append something to a header and then remove that header completely in the next line? Makes no sense to me and this setup cannot be recommended since security relevant headers are removed.

            Kweb might eventually get a setting to enhance the default CSP header values.

            _r9 4 Replies Last reply Reply Quote 0
            • _r9
              _r9 @longsleep last edited by _r9

              Hey @longsleep thanks for your response and help.

              1. I added this because without it I’m always getting following error messages inside my browser
              Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
              
              1. I googled about the configuration inside the linked article
              proxy_hide_header X-Frame-Options;
              proxy_hide_header Content-Security-Policy;
              

              There are several articles like this one https://zinoui.com/blog/remove-http-response-headers which explains that proxy_hide_header for nginx is the same as header unset for apache2.

              As explained in my 2nd post this server configuration is for an apache2 proxy that sits in front of the Kweb server. The mattermost server is available through a specific port and host.

              1 Reply Last reply Reply Quote 0
              • _r9
                _r9 @longsleep last edited by

                @longsleep But you were right about this. When I remove the Header append configuration I’m having the same results. I thought about it that this makes no sense. Sorry for the wrong lead.

                1 Reply Last reply Reply Quote 0
                • _r9
                  _r9 @longsleep last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • _r9
                    _r9 @longsleep last edited by _r9

                    @longsleep Okay it looks like that I found the right configuration. I changed my first and second post. Looks like that the browser caches made me crazy about this xD

                    fbartels 1 Reply Last reply Reply Quote 0
                    • fbartels
                      fbartels Kopano @_r9 last edited by

                      @_r9 thanks for sharing. The documentation I was referring to was the included Apache vhost in our Mattermost packages, but since you’re running in Docker you are probably not using these.

                      These had already something quite similar to your code, except it used a header edit. But on the other hand since we both consulted the same apache documentation it also had the same unset.

                      Regards Felix

                      Resources:
                      https://kopano.com/blog/how-to-get-kopano/
                      https://documentation.kopano.io/
                      https://kb.kopano.io/

                      Support overview:
                      https://kopano.com/support/

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post