Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong static files permissions if default umask has been modified #281

Open
phaedrusrex opened this issue Oct 7, 2019 · 2 comments
Open
Labels

Comments

@phaedrusrex
Copy link

Impacted versions

  • Distribution: Ubuntu
  • Codename: Bionic
  • Arch: 64 Bit
  • Database: PostgreSQL

Steps to reproduce

Ran ./run.py --upgrade

Full trace using --debug option or current behaviour

Here is a slightly anonymized snippet of the nginx error log:
2019/10/07 18:59:51 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/confirmation.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/confirmation.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"
2019/10/07 18:59:51 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/confirmation.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/confirmation.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"
2019/10/07 18:59:51 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/notify.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/notify.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"
2019/10/07 18:59:51 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/notify.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/notify.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"
2019/10/07 18:59:52 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/poller.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/poller.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"
2019/10/07 18:59:52 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/poller.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/poller.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"
2019/10/07 18:59:52 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/top_notifications.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/top_notifications.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"
2019/10/07 18:59:52 [crit] 24382#24382: *49 stat() "/srv/modoboa/instance/sitestatic/js/top_notifications.js" failed (13: Permission denied), client: aaaa:bbb:35:256::2, server: mail.domainname.com, request: "GET /sitestatic/js/top_notifications.js HTTP/1.1", host: "mail.domainname.com", referrer: "https://mail.domainname.com/dashboard/"

directory listing of /srv/modoboa/instance:
drwx------ 5 modoboa modoboa 4096 Oct 7 18:32 ./
drwxr-xr-x 8 modoboa modoboa 4096 Oct 7 18:32 ../
drwx------ 2 modoboa modoboa 4096 Oct 7 18:33 instance/
-rwxr-xr-x 1 modoboa modoboa 806 Oct 7 18:32 manage.py*
drwx------ 2 modoboa modoboa 4096 Oct 7 18:32 media/
drwx------ 27 modoboa modoboa 4096 Oct 7 18:32 sitestatic/

directory listing of sitestatic:
drwx------ 27 modoboa modoboa 4096 Oct 7 18:32 ./
drwx------ 5 modoboa modoboa 4096 Oct 7 18:32 ../
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 admin/
drwx------ 8 modoboa modoboa 4096 Oct 7 18:32 bootstrap/
drwx------ 3 modoboa modoboa 4096 Oct 7 18:32 c3/
drwx------ 5 modoboa modoboa 4096 Oct 7 18:32 ckeditor/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 core/
drwx------ 2 modoboa modoboa 4096 Oct 7 18:32 css/
drwx------ 2 modoboa modoboa 4096 Oct 7 18:32 d3/
drwx------ 6 modoboa modoboa 4096 Oct 7 18:32 eonasdan-bootstrap-datetimepicker/
drwx------ 6 modoboa modoboa 4096 Oct 7 18:32 font-awesome/
drwx------ 6 modoboa modoboa 4096 Oct 7 18:32 jquery/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 jquery-ui/
drwx------ 2 modoboa modoboa 4096 Oct 7 18:32 js/
drwx------ 3 modoboa modoboa 4096 Oct 7 18:32 microplugin/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 modoboa_amavis/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 modoboa_contacts/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 modoboa_radicale/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 modoboa_sievefilters/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 modoboa_stats/
drwx------ 4 modoboa modoboa 4096 Oct 7 18:32 modoboa_webmail/
drwx------ 6 modoboa modoboa 4096 Oct 7 18:32 moment/
drwx------ 2 modoboa modoboa 4096 Oct 7 18:32 pics/
drwx------ 7 modoboa modoboa 4096 Oct 7 18:32 rest_framework/
drwx------ 3 modoboa modoboa 4096 Oct 7 18:32 selectize/
drwx------ 2 modoboa modoboa 4096 Oct 7 18:32 sifter/
drwx------ 3 modoboa modoboa 4096 Oct 7 18:32 transport/

Expected behavior

Normal access to the website. Instead https://mail.domainname.com/dashboard renders as the attached picture:
image

Video/Screenshot link (optional)

@tonioo
Copy link
Member

tonioo commented Oct 11, 2019

@phaedrusrex Looks like you ran the installer using the wrong user...

@phaedrusrex
Copy link
Author

phaedrusrex commented Oct 16, 2019

@tonioo I ran the installer (in upgrade mode) as root, same as I did for the initial installation, where the permissions were correct and the web interface worked.

However, I figured out what the issue was. umask was set to 077 for the root user the first time I ran the upgrade. I set it to 022 and reran the upgrade, now the web interface works fine. It would make sense to set this in the script or include some other mechanism to ensure that file permissions are correct.

~modoboa/instance# ls -la
total 24
drwxr-xr-x 5 modoboa modoboa 4096 Oct 16 15:33 ./
drwxr-xr-x 8 modoboa modoboa 4096 Oct 16 15:33 ../
drwxr-xr-x 2 modoboa modoboa 4096 Oct 16 15:33 instance/
-rwxr-xr-x 1 modoboa modoboa 806 Oct 16 15:33 manage.py*
drwxr-xr-x 2 modoboa modoboa 4096 Oct 16 15:33 media/
drwxr-xr-x 27 modoboa modoboa 4096 Oct 16 15:33 sitestatic/

@tonioo tonioo changed the title Upgrade breaks file system permissions for nginx? Wrong static files permissions if default umask has been modified Dec 6, 2019
@tonioo tonioo added the bug label Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants