Repository navigation
Description
Dear Colleagues,
STR:
- Update to 9.1 version
- Try to log in using https://myhost/owncloud
Expected result:
Logged in
Actual result:
I receive "Access denied. CSRF check failed" after I click Enter.
Strange thing is that for http version everything is fine.
I've also switched to 9.2 alpha and now have owncloud-files-9.2.0-0.1.1.prealpha.20160822.noarch but the issue still in place.
Similar issues were discussed in #25557 and #25799 but @PVince81 asked me to create a new issue.
Here is the tech details:
OS: CentOS 6.8 x64
WebServer: httpd=2.2.27
DB: MariaDB-server-10.1.16
PHP: 5.5.38
Owncloud version: 9.2.0-0.1.1.prealpha.20160822 updated from 9.1 and older ones
APPS:
root /var/www/html/owncloud # sudo -u owncloud php occ app:list
Enabled:
- calendar: 1.3.2
- comments: 0.3.0
- dav: 0.2.5
- direct_menu: 0.8.1
- encryption: 1.3.0
- federatedfilesharing: 0.3.0
- federation: 0.1.0
- files: 1.5.1
- files_excel_reader: 0.1.0
- files_mv: 0.8.2
- files_sharing: 0.10.0
- files_trashbin: 0.9.0
- files_versions: 1.3.0
- provisioning_api: 0.5.0
- systemtags: 0.3.0
- tasks: 0.9.2
- updatenotification: 0.2.1
Disabled:
- activity
- bookmarks
- calendarplus
- contacts
- documents
- external
- files_antivirus
- files_external
- files_pdfviewer
- files_texteditor
- files_videoplayer
- firstrunwizard
- gallery
- galleryplus
- notifications
- ojsxc
- ownnote
- sharelinks
- tasksplus
- templateeditor
- user_external
- user_ldap
- vids
CONFIG:
root /var/www/html/owncloud # sudo -u owncloud php occ config:list system
{
"system": {
"debug": true,
"instanceid": "ocjl3amsodm7",
"passwordsalt": "_REMOVED SENSITIVE VALUE",
"secret": "_REMOVED SENSITIVE VALUE",
"trusted_domains": [
"mydomain.com"
],
"datadirectory": "/var/www/html/owncloud/data",
"overwrite.cli.url": "https://mydomain.com/owncloud",
"dbtype": "mysql",
"version": "9.2.0.1",
"dbname": "owncloud",
"dbhost": "localhost",
"dbtableprefix": "oc_",
"dbuser": "_REMOVED SENSITIVE VALUE",
"dbpassword": "_REMOVED SENSITIVE VALUE",
"installed": true,
"forcessl": true,
"forceSSLforSubdomains": true,
"mail_from_address": "root",
"mail_smtpmode": "php",
"mail_domain": "mydomain.com",
"theme": "",
"maintenance": false,
"loglevel": 1,
"trashbin_retention_obligation": "auto",
"updatechecker": false,
"htaccess.RewriteBase": "/owncloud"
}
}
As for logs - no new lines in owncloud.log and in httpd logs and browser ones there were no info about error also.
Please check and do not hesitate to ask if any additional information is required
Activity
PVince81 commentedon Aug 24, 2016
Can you check your access log and see whether it's using http or https when posting the login form ?
The CSRF token is stored in the session, which is handled by the cookies. If the form is posted to a different domain / protocol, the session would be a different one and the CSRF token wouldn't match.
So far it looks like an environment/config issue. I assume you already checked http://central.owncloud.org/ and the forums for similar issues ? (https + csrf)
sonanchenko commentedon Aug 26, 2016
Hi,
Sorry for re-opening.
I've checked logs - in httpd logs I see that everything is handled by https:
[26/Aug/2016:19:12:54 +0300] 31.135.132.106 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "POST /owncloud/index.php/login HTTP/1.1" 8965
[26/Aug/2016:19:12:55 +0300] 31.135.132.106 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /owncloud/index.php/core/js/oc.js?v=e2c0a62bf817618e92f96d24613b7250 HTTP/1.1" 3934
[26/Aug/2016:19:12:56 +0300] 31.135.132.106 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /owncloud/core/vendor/jquery/dist/jquery.min.map HTTP/1.1" 127576
[26/Aug/2016:19:12:58 +0300] 31.135.132.106 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /owncloud/cron.php HTTP/1.1" 20
Also, I have not found any useful info on central.owncloud.org that may be connected with my issue.
(I've only added opcache.save-comments that is suggested at https://central.owncloud.org/t/known-problems-with-php-webserver-modules-or-configs/835)
Could you please help me with my issue ?
I appreciate any help you can provide. What other info about my system can be useful ?
mmattel commentedon Sep 1, 2016
After reinstalling 9.1 from scratch, I got one time the same error when trying to logon. When retrying it worked and I have no clue why. My working nginx config did not change between killing and reinstalling the instance.
sonanchenko commentedon Sep 17, 2016
hi2all
any updates on this issue ?
9.2 alpha is also affected with this issue (
PVince81 commentedon Sep 19, 2016
Could you guys all post your configs so we can see what is similar ?
From the first config I see this:
I suppose you're all using the exact same options ?
thommierother commentedon Sep 21, 2016
The issue is still present in the just released 9.1.1 (session cookies were cleared before testing).
I only use
'forcessl' => true,
But not "forceSSLforSubdomains" I disabled and enabled the forcessl value, no difference. Note that this apache itself has a rewrite rule for https
RewriteRule ^/owncloud(.*) https://%{SERVER_NAME}/owncloud$1 [R,L]
So forcessl inside OC is not really necessary in my case
Is there any option to log the login procedure?
lolnerd commentedon Sep 22, 2016
Here is my config regarding the "CSRF check failed" issue, after upgrading from 9.0 to 9.1 and persistent after upgrade to 9.1.1:
root@mydomain:/var/www/owncloud# sudo -u www-data php occ config:list system
{
"system": {
"updatechecker": false,
"instanceid": "ocwnXXXXXXX",
"passwordsalt": "_REMOVED SENSITIVE VALUE",
"secret": "_REMOVED SENSITIVE VALUE",
"trusted_domains": [
"mydomain.com"
],
"datadirectory": "/var/www/owncloud/data",
"overwrite.cli.url": "https://cloud.mydomain.com",
"dbtype": "mysql",
"version": "9.1.1.3",
"dbname": "ownclouddb",
"dbhost": "localhost",
"dbtableprefix": "oc_",
"dbuser": "_REMOVED SENSITIVE VALUE",
"dbpassword": "_REMOVED SENSITIVE VALUE",
"logtimezone": "UTC",
"installed": true,
"mail_from_address": "info",
"mail_smtpmode": "php",
"mail_domain": "cloud.mydomain.com",
"maintenance": false,
"loglevel": 3,
"htaccess.RewriteBase": "/",
"theme": ""
}
}
ycollet commentedon Sep 27, 2016
I have the same problem here with 9.1.1.
"Access forbidden
CSRF check failed"
after successful login.
ycollet commentedon Sep 27, 2016
I found an old topic related to CSRF check failed in the forum:
https://forum.owncloud.org/viewtopic.php?f=26&t=21889&start=10
lep86 commentedon Sep 28, 2016
that don't work. Have some problem with OC 9.1.1 Fresh install on ubuntu 16.04 tls

takenek commentedon Sep 30, 2016
Same problem here - just upgrade from 9.0.2 to 9.1.0 and got CSRF check failed....
ycollet commentedon Sep 30, 2016
I rebooted my server and everything went fine. I don't know if this was due to an openssl update ...
tudorthe1ntruder commentedon Oct 2, 2016
I was having the same issue from an out of box installation on CentOS and discovered that 2 cookies which were set when first accessing the login page had the "Secure" flag on.
Because I have not installed the SSL certificate at that time and running on a plain HTTP connection, I realized that the browser was simply not sending the cookies to the server due to the "Secure flag".
This is a bug for non-ssl installations, secure flag should not be set when plain http is used by owncloud.
takenek commentedon Oct 2, 2016
No - my server use only SSL and got this issue.
take a look: https://owncloud.taken.pl
73 remaining items
ckhung commentedon Sep 29, 2017
Just a quick note for those who might have made the same mistake as me: after seeing @sorintelecom's note, I also tried chromium and then realized that it was because I was fiddling with privacy options in firefox and inadvertently disabled all cookies. For me, re-enabling cookie in firefox solved the problem. Maybe if owncloud's code checks for the ability to write cookie and print a more clear error message, it will be easier to debug further problems?
cars10 commentedon Oct 4, 2017
Edit: solved! See below.
I still experience the same issue and cannot find a way to fix it.
I was on
9.1.6, the issue already persisted there. i then upgraded to10.0.3.3(viaapt-get install owncoud-files)What i tried:
data/owncloud.logare super unhelpful, no permissions error or anything else, just the following:I am completely lost right now. Any hints on what i could try?
Edit: solved! Thanks to #25927 (comment) it works now. Steps:
tempfolder in your owncloud dirPVince81 commentedon Nov 6, 2017
Raised #29462 to make error more user friendly in case it happens on the login page.
bobalo2 commentedon Dec 4, 2017
I am also having this problem on my new installed owncloud instance v. 10.0.03.
Tried everything from the above mentioned fixes. I'm unsure about the session save path configurations ,as I changed it's permissions with root user, and unsure how to change it as application's user.
Please advise.
Running owncloud via cPanel / softacolous. CentOS
issic commentedon Jan 9, 2018
Solved:
Couldnt find a solution, but then discovered that this was in my VirtualHost /etc/apache2/vhost/ip-based.config
Header edit Set-Cookie ^(.*)$ ;HttpOnly;Securecomment it out with # or remove it and it's good to go.
ownclouders commentedon Feb 17, 2018
Hey, this issue has been closed because the label
status/STALEis set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.(This is an automated comment from GitMate.io.)
PVince81 commentedon Feb 19, 2018
Please note that since 10.0.5 is more user friendly and will ask for login again.
I'll leave this ticket closed unless someone finds a CSRF error case that is really a bug and not an environment issue.
alexolinux commentedon May 24, 2018
Error: CSRF check failed
This happens when we log out on owncloud.
Scenario:
owncloud (backend) - Apache http port 80
my frontend - https port 443
I've a virtualhost with Reverse Proxy.
Solution:
Edit $HTML/owncloud/config.php
'overwrite.cli.url' => 'https://OWNCLOUD_IP/',
'overwriteprotocol' => 'https',
'forcessl' => true,
lock commentedon Jul 30, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.