modoboa-installer icon indicating copy to clipboard operation
modoboa-installer copied to clipboard

Wrong static files permissions if default umask has been modified

Open phaedrusrex opened this issue 6 years ago • 2 comments

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)

phaedrusrex avatar Oct 07 '19 17:10 phaedrusrex

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

tonioo avatar Oct 11 '19 13:10 tonioo

@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/

phaedrusrex avatar Oct 16 '19 13:10 phaedrusrex