<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: another CSRF issue with Alfresco share and docker in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143593#M38149</link>
    <description>&lt;P&gt;Thanks for the response to this.&amp;nbsp; I will look into your suggestions and let you know.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 17:33:11 GMT</pubDate>
    <dc:creator>jjengel11</dc:creator>
    <dc:date>2021-10-05T17:33:11Z</dc:date>
    <item>
      <title>another CSRF issue with Alfresco share and docker</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143591#M38147</link>
      <description>&lt;P&gt;I am having problems getting the alfresco community edition 7.0 using provided docker-compose.yml to work when enabling SSL in the proxy.&lt;/P&gt;&lt;P&gt;I've tried to use this as a reference&lt;/P&gt;&lt;P&gt;&lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-blog/introducing-the-csrfpolicy-in-alfresco-share/bc-p/286918/highlight/true" target="_blank" rel="nofollow noopener noreferrer"&gt;https://hub.alfresco.com/t5/alfresco-content-services-blog/introducing-the-csrfpolicy-in-alfresco-share/bc-p/286918/highlight/true&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;by setting these variables in the share container in docker-compose.yml.&lt;/P&gt;&lt;PRE&gt;CSRF_FILTER_ORIGIN
CSRF_FILTER_REFERER&lt;/PRE&gt;&lt;P&gt;and by trying to disable the filter but nothing seems to work&lt;/P&gt;&lt;P&gt;I modified the dockerfile to look like this (for share and proxy)&lt;/P&gt;&lt;PRE&gt;share:
    image: alfresco/alfresco-share:7.0.0
    mem_limit: 1g
    environment:
        REPO_HOST: "alfresco"
        REPO_PORT: "8080"
        CSRF_FILTER_ORIGIN: https://d-alfresco-tester.my.domain.com
        CSRF_FILTER_REFERER: https://d-alfresco-tester.my.domain.com/.*
        JAVA_OPTS: "
            -XX:MinRAMPercentage=50
            -XX:MaxRAMPercentage=80
            -Dalfresco.host=localhost
            -Dalfresco.port=8080
            -Dalfresco.context=alfresco
            -Dalfresco.protocol=http
            "

proxy:
    image: alfresco/alfresco-acs-nginx:3.2.0
    mem_limit: 128m
    environment:
        DISABLE_PROMETHEUS: "true"
        DISABLE_SYNCSERVICE: "true"
        DISABLE_ADW: "true"
        USE_SSL: "true"
        DOMAIN: "*.my.domain.com"
    depends_on:
        - alfresco
    ports:
        - 443:443
    links:
        - alfresco
        - share
    volumes:
        - /etc/pki/public/wildcard.crt:/etc/nginx/ssl/cert.crt
        - /etc/pki/private/wildcard.key:/etc/nginx/ssl/cert.key&lt;/PRE&gt;&lt;P&gt;With this configuration, when I access&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://d-alfresco-tester.my.domain.com/alfresco/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://d-alfresco-tester.my.domain.com/alfresco/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;it works just fine, however, after logging into the share&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://d-alfresco-tester.my.domain.com/share/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://d-alfresco-tester.my.domain.com/share/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I get this&lt;/P&gt;&lt;PRE&gt;400 bad request
The plain HTTP request was sent to HTTPS port&lt;/PRE&gt;&lt;P&gt;I can see this in the proxy log&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;http&lt;/STRONG&gt;://d-alfresco-tester.my.domain.com:&lt;STRONG&gt;443&lt;/STRONG&gt;/share/page/&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If I modify the origin to have a trailing '/'&lt;/P&gt;&lt;PRE&gt;CSRF_FILTER_ORIGIN: https://d-alfresco-tester.my.domain.com/&lt;/PRE&gt;&lt;P&gt;The alfresco link is fine again, however I get the csrf filter errors with the share link&lt;/P&gt;&lt;P&gt;I get the alfresco page that says&lt;/P&gt;&lt;PRE&gt;Something's wrong with this page...&lt;/PRE&gt;&lt;P&gt;and I see this in the share logs&lt;/P&gt;&lt;PRE&gt;Possible CSRF attack noted when asserting origin header 'https://d-alfresco-tester.my.domain.com'. Request: POST /share/page/dologin&lt;/PRE&gt;&lt;P&gt;If I click the *Back to My Dashboard* button, I get the&lt;/P&gt;&lt;PRE&gt;The plain HTTP request was sent to HTTPS port&lt;/PRE&gt;&lt;P&gt;I am not sure what I am missing based on some of these links where it seems setting the origin and referer was the solution&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-blog/introducing-the-csrfpolicy-in-alfresco-share/bc-p/286918/highlight/true" target="_blank" rel="nofollow noopener noreferrer"&gt;https://hub.alfresco.com/t5/alfresco-content-services-blog/introducing-the-csrfpolicy-in-alfresco-share/bc-p/286918/highlight/true&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://armedia.com/blog/a-tale-of-alfresco-share-with-csrf-and-bad-information/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://armedia.com/blog/a-tale-of-alfresco-share-with-csrf-and-bad-information/&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.giuseppeurso.eu/en/alfresco-tips-and-tricks-13-csrf-filter-error-on-share-login-with-apache-mod_proxy-and-sslengine-on/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.giuseppeurso.eu/en/alfresco-tips-and-tricks-13-csrf-filter-error-on-share-login-with-apache-mod_proxy-and-sslengine-on/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If I disable the filter I get the following after logging into the share page&lt;/P&gt;&lt;PRE&gt;The plain HTTP request was sent to HTTPS port&lt;/PRE&gt;&lt;P&gt;I attempted to modify the nginx proxy to set origin and referer headers with no luck of the share working.&lt;/P&gt;&lt;P&gt;I don't think this should be needed but I tried to modify the alfresco-global.properties in the alfresco container with&lt;/P&gt;&lt;PRE&gt;# CSRF filter overrides
csrf.filter.enabled=true
csrf.filter.referer=^https?://d-alfresco-tester\.my\.domain\.com(/.*)?
csrf.filter.referer.always=false
csrf.filter.origin=^https?://d-alfresco-tester\.my\.domain\.com(/.*)?
csrf.filter.origin.always=false&lt;/PRE&gt;&lt;P&gt;and still no luck with the alfresco share &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://connect.hyland.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt; I do not understand what I am doing wrong based on some of the links I found.&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 15:43:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143591#M38147</guid>
      <dc:creator>jjengel11</dc:creator>
      <dc:date>2021-09-24T15:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: another CSRF issue with Alfresco share and docker</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143592#M38148</link>
      <description>&lt;P&gt;It sounds to me like your proxy setup is not properly handling the forwarding of the protocol / scheme towards the Alfresco Share Tomcat backend, so that Tomcat uses the scheme of its connector to generate (back)links, because it is not aware of the fact that the nginx handles an HTTPS connection. Make sure your nginx &lt;A href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto" target="_self" rel="nofollow noopener noreferrer"&gt;forwards the protocol information&lt;/A&gt; (in addition to port + host, which I believe nginx does by default).&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 09:57:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143592#M38148</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2021-10-01T09:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: another CSRF issue with Alfresco share and docker</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143593#M38149</link>
      <description>&lt;P&gt;Thanks for the response to this.&amp;nbsp; I will look into your suggestions and let you know.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 17:33:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143593#M38149</guid>
      <dc:creator>jjengel11</dc:creator>
      <dc:date>2021-10-05T17:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: another CSRF issue with Alfresco share and docker</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143594#M38150</link>
      <description>&lt;P&gt;I found my issue.&amp;nbsp; My nginx config had this set&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;proxy_set_header Host $host:$server_port;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Which was causing the&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;The plain HTTP request was sent to HTTPS port&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I set to this just $host and all is working now&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 12:29:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/another-csrf-issue-with-alfresco-share-and-docker/m-p/143594#M38150</guid>
      <dc:creator>jjengel11</dc:creator>
      <dc:date>2021-10-08T12:29:36Z</dc:date>
    </item>
  </channel>
</rss>

