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

[attachment permissions] new installation attachments have forbidden error #597

Closed
raramuridesign opened this issue May 1, 2020 · 14 comments

Comments

@raramuridesign
Copy link

Hi Guys
We have a brand new installation with no errors on the install and all functionality is working 100%, except the attachments to emails.

When clicking on an attachment we get the error

image

On checking the file server we can see the file is there on the server.
We have checked the folder & file permissions and this is all ok.
Storage location is the new location since the changes a few versions back.

The url looks like this
/storage/attachment/8/4/1/filename.pdf?id=199&token=11ca304ba85d04217d69dd4b3ceedbab

I am not sure what else we should provide to troubleshoot this, it would be appreciated to understand why this is happening.

Thanks
M.

@freescout-helpdesk
Copy link
Contributor

Can you provide nginx or Apache config?

@raramuridesign
Copy link
Author

We use runcloud for our server
The ngnix config looks like this
https://runcloud.io/docs/guide/cheat-sheet/nginx#custom-nginx-config

We tried to use the custom changes as suggested on the setup but this did not work.
Your guidance would be appreciated.
M.

@raramuridesign
Copy link
Author

@freescout-helpdesk Any possibility of some feedback on this issue?

@raramuridesign
Copy link
Author

This has been resolved.
We had some very tight security settings preventing attachments from downloading.
M.

@pool-alpin
Copy link

@raramuridesign I'm also having issues with the standard nginx config on runcloud regarding attachments.
What did you change to get it working?

@raramuridesign
Copy link
Author

@pool-alpin - The first place to look is your PHP Extensions, if you have some disabled. There are some required modules which need to be installed. as a minimum look at these first to ensure you have them setup. The very last thing to check is the permissions on folders/files (see second screenshot) - hope this helps.

image

image

@pool-alpin
Copy link

@raramuridesign Thanks for your reply!
I have allowed serveral modules until everything showed OK in the system overview, permissions are also ok.
I believe it has to do with the nginx runcloud config, which for example does not have this setting:

location ~* ^/storage/attachment/ {
        expires 1M;
        access_log off;
        try_files $uri $uri/ /index.php?$query_string;
    }

I guess I will have to find external help with this.
Thanks again!

@raramuridesign
Copy link
Author

@pool-alpin What error do you get when viewing the attachment?

@pool-alpin
Copy link

@raramuridesign When clicking on an image, it opens in a new, empty tab. A PDF goes to a preview tab, with an error "can't load document". Downloads result in a "server error" entry.

This is what I get in the laravel log inside freescout:

Call to undefined function Illuminate\Filesystem\fpassthru() {"userId":1,"email":"[email protected]","exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to undefined function Illuminate\\Filesystem\\fpassthru() at /home/poolalpin/webapps/freescout/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php:136)
[stacktrace]
#0 /home/poolalpin/webapps/freescout/vendor/symfony/http-foundation/StreamedResponse.php(114): Illuminate\\Filesystem\\FilesystemAdapter->Illuminate\\Filesystem\\{closure}()
#1 /home/poolalpin/webapps/freescout/overrides/symfony/http-foundation/Response.php(373): Symfony\\Component\\HttpFoundation\\StreamedResponse->sendContent()
#2 /home/poolalpin/webapps/freescout/public/index.php(86): Symfony\\Component\\HttpFoundation\\Response->send()
#3 {main}
"}

And this entry is in runcloud under nginx errors:
2022/08/29 09:47:53 [error] 3206977#3206977: *360352 upstream prematurely closed FastCGI request while reading upstream, client: 194.x.x.x, server: xxxxxxxx, request: "GET /storage/attachment/2/6/1/22AT930200ENB2GXI6_EX431.pdf?id=1186&token=8e376cdc122dd31f365cbb80a1f1209c HTTP/2.0", upstream: "fastcgi://unix:/var/run/freescout.sock:", host: "xxxxxxxxxx", referrer: "https://xxxxxxxxxxx/conversation/786?folder_id=16"

@raramuridesign
Copy link
Author

@pool-alpin
Copy link

pool-alpin commented Aug 31, 2022

@raramuridesign It was the disabled fpassthru function that prevented downloads. After allowing it through the runcloud panel, it startet working.

@freescout-helpdesk Maybe the system page could also check for the fpassthru function?

@raramuridesign
Copy link
Author

@freescout-helpdesk I think it might be good to add this to the troubleshooting section
https://github.com/freescout-helpdesk/freescout/wiki/Installation-Guide#11-troubleshooting

@freescout-helpdesk
Copy link
Contributor

We've added fpassthru function to the System Status page.

@mrjcgoodwin
Copy link

Hi all, just to add a note for anyone else using Runcloud that also stumbles onto this thread.
All of the listed PHP required functions in the system status screen are disabled by default by Runcloud's default web app config. Updating your list of disabled PHP functions in the Runcloud dashboard for your FreeScout web app solves the issue of missing/broken images/attachments for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants