Getting an A- at observatory.mozilla.org security test
Steps to reproduce
- Download & Install Ubuntu 16.04 OVA
- Configure according to https://www.techandme.se/complete-install-instructions-nextcloud/
- Test Nextcloud on https://observatory.mozilla.org/
Expected behaviour
Maybe getting an A+ at observatory.mozilla.org security test
Actual behaviour
Following security problems getting detected:
- Content Security Policy: Content Security Policy (CSP) implemented, but allows 'unsafe-eval'
- Cookies: Cookies set without using the Secure flag, but transmission over HTTP prevented by HSTS
Server configuration
Server version: (see your admin page) 12.0.1 VM version (master / released version) Production server Ubuntu 16.04 OVA Updated from an older installed version or fresh install: Updated from 12.0.0 to 12.0.1
Network
Do you use DHCP? No Is port 80 and/or 443 open? only port 443 is open
Logs / Screenshots
Log file (/var/ncdata/nextcloud.log)
How to get it out of VirtualBox?
Installation log (command output)
Where to find?
How to get it out of VirtualBox?
Screenshoots

I use SSL Quality Labs for my tests which gives it A+, same goes for https://scan.nextcloud.com. But sure. I'll have a look when I have some time left over.
@LukasReschke Are the Mozilla tests wrong as they state that CSP isn't activated but scan.nextcloud.com does?
@Exception0815 Hey, could you try this and see if it helps:
- Ensure you have mod_headers.so enabled in Apache instance
- Add following entry in httpd.conf
Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure - Restart Apache Web Server
I get A+ with standard install, you can close this issue
Actually it shows A+ but still shows the same warning, and that entry in apache2.conf doesn't fix it
This should work but somehow its also not working...
Header set Content-Security-Policy "default-src 'self';"
from https://content-security-policy.com/
Since it's showing A+ I'm closing this, thanks for confirming!
Also the header works, but the observatory has some issue. But it breaks nextcloud ui, a bug should be open upstream to make it more secure and work with unsafe-eval and unsafe-inline.
a bug should be open upstream to make it more secure and work with unsafe-eval and unsafe-inline.
I don't think that's allowed per default IIRC.
I meant make nextcloud work correcly with CSP without needing unsafe-eval and unsafe-inline, following the security recommendations of Google and others for web apps.