Postal mail campaign

Done.

I freshly created documents PDFs. I then left the first one “as is” (it gets perms 604) while I chmoded the second one to 755 and the third one to 775.
I then ran getfacl on them (please check the attachment).

I also included the output of the same command on the folder where the all suite is installed and on the upload folder where the pdf files are located.

As you can see it seems group permission are set to — by the server’s ACL. which could be part of an explanation for why it doesn’t work or is it ?

I think the ACL explains why the file gets 604 permissions. But it doesn’t explain why the server doesn’t serve it. If your web server is running as omegatrawf/users, it should be allowed read/write access even with 604.

Can you now please go back and check the two questions on my post before the last one? htaccess is probably the culprit, though I’m not sure you can change it without talking to your hosting provider.

Upload has :

drwxrwxr-x    6 omegatrawf users       13 févr.  7 12:15 upload

No .htaccess in the root folder of my webhost. There’s a .ovhconfig file which is there to change the following parameters :


app.engine=php
app.engine.version=7.0
http.firewall=none
environment=production
container.image=stable

php_value max_input_time 60
php_value max_execution_time 60

Ah. Regarding the 403 error I get while trying to access the pdf file from my browser, I think the culprit is in suitecrm’s .htaccess :


# BEGIN SUGARCRM RESTRICTIONS
RedirectMatch 403 .*\.log$
RedirectMatch 403 /+not_imported_.*\.txt
RedirectMatch 403 /+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules)/+.*\.(php|tpl)
RedirectMatch 403 /+emailmandelivery\.php
RedirectMatch 403 /+upload
RedirectMatch 403 /+custom/+blowfish
RedirectMatch 403 /+cache/+diagnostic
RedirectMatch 403 /+files\.md5$
# END SUGARCRM RESTRICTIONS

I’m really puzzled. When I read your post I thought, “stupid me, obviously SuiteCRM won’t let you directly pick up a file from the upload directory, you need to go through one of the php entrypoints”. But I just tried uploading a new PDF on my system (it got 422 permissions, by the way) and I could download t from the browser with direct URL (http://www.mysite.com/upload/d391f543-84c3-a58e-f352-5899ca25657e). So much for security.

If I take the normal route, through the UI, it also works (http://www.mysite.com/index.php?entryPoint=download&id=d391f543-84c3-a58e-f352-5899ca25657e&type=Documents)

My .htaccess is like yours, I didn’t change it.

This might be the time to contact your hosting provider. With all the information you have gathered, you can be very specific and just ask them why the web server gives a 403 on the file with id ending in d3666f, when it should have read access. I’m sure they will be able to track that down easily.

(as a side note, I think you might one day need to increase those two configurations php_value max_input_time 60 and php_value max_execution_time 60, these are sometimes insufficient when uploading big upgrade files and performing the upgrades).

If I take this route, (obviously changing the “mysite.com” with the real thing on my side), I get an error I had never seen before (it’s evne in French !) : “Erreur de récupération de l’enregistrement. Cet enregistrement est peut être supprimé ou vous n’avez pas le droit de le visualiser.”

That is the ‘ERROR_NO_RECORD’ string in my language…

I’m just wondering how many people have the same issue as me and how many just decide to not go any further with suitecrm because of these type of issues…

Anyway, I’m not sure how OVH can help if SuiteCRM has its own way of setting up permissions. I’ll contact them though.

Thanks again for your help ! :slight_smile:

That would be the error if the file is in the filesystem, but there is no record for it in SuiteCRM’s database.

Maybe with all this confusion you were using a file you had put directly into the upload folder, instead of uploading it through the SuiteCRM UI?

Or maybe your entire problem is that something is broken in the database, not in the filesystem.

It’s a file that was generated by the system when I tried to generate a document from a template. (I don’t get a link but a file is generated in ‘./upload’)
This is the file that gets permission 604…

Anyway. this file is a pdf and if I retrieve it via my sftp client, I can open it as a pdf. So far, this is the only workaround I found for my postal mail needs.
1- I download all the files generated by the system (let’s say if I chose 150 leads, I’ll get 150 files) 2-I add a .pdf extension and merge them all together using a command line tool and 3-I print the resulting pdf document and voilà ! :slight_smile:

Obviously, I had rather step 1 and 2 were replaced with the CRM’s normal behaviour :slight_smile: and I’m sure we’ll find a way !

Perhaps you could try doing it like I did, just for the sake of testing:

  • go to any contact detail
  • scroll down to the Documents subpanel
  • click Create
  • enter any PDF file from your local computer. This will get uploaded to the server.
  • check which ID it gets by looking at the link shown for the file on the Contact detail, after you save
  • see what permissions and ACL it gets
  • try getting it from the URL and see if it gets served

Creating a document and uploading it works fine. Clicking on it to download it works fine as well. Yet, I can’t check permissions an ACL as I don’t know where it is stored. Not in the upload folder… Any idea where it is stored so I can check permissions and ACL ?

I found mine in the upload folder. I just do a “ls -trl” there to list everything in reverse chronological order, the most recent document comes up last.

What might be causing confusion - as if we didn’t need any more confusion : - ) - is that documents have an id, and then a list of revisions. Each revision gets it’s own id, and these are the ones that point to files in upload folder.

I’m not sure this test is going to help, anyway. Maybe we’ll just have to let this rest for a few days until one of us has some brilliant idea.

I see ! :slight_smile: Ok then, found it under a different ID. I confirm I can’t access it via my browser (not allowed) I get a 403 error


$ ls -l 33e42613-352b-6de6-522a-5899fc1789d1
# file: 33e42613-352b-6de6-522a-5899fc1789d1
# owner: omegatrawf
# group: users
user::rw-
group::---
mask::rwx
other::r--

$ ls -l 33e42613-352b-6de6-522a-5899fc1789d1
-rw----r--+ 1 omegatrawf users 45486 févr.  7 16:59 33e42613-352b-6de6-522a-5899fc1789d1

This makes it clear that your problem is not just with campaigns and letter generation from templates, every document attachment seems to be failing.

Definitely take this up with your hosting, this is a quite tested area of the application, it really should work. Sometimes hosting companies tighten their security in ways that break applications, and they need to be told about it, so they can fine-tune their settings.

Let me make sure we’re on the same line :slight_smile: :

1- I have no problem with docs and attachments as long as they’re accessed via SuiteCrm (eg : doc attached to a lead or a contact / pdf templates…), but I cannot access them directly via my web browser. As I understand it, this is a normal intended behaviour defined in SuiteCRM’s .htaccess.

2- My problem seems to come from the fact wrong permissions are given by some ACL at my webhost thus preventing documents to be processed correctly byt SuiteCRM. These documents are those which should normally be generated by SuiteCRM from any given PDF templates and for which I should get a link to download or a prompt with the download content.

Are we on the same line ?

These URL’s shouldn’t work (but they work on my system):

www.mysite.com/upload/d391f543-84c3-a58e-f352-5899ca25657e

These URL’s should work as long as some user is logged in on that browser:

http://www.mysite.com/index.php?entryPoint=download&id=d391f543-84c3-a58e-f352-5899ca25657e&type=Documents

I was thinking the way the document was generated (from template, or simple upload) was not making a difference, but maybe I was wrong.

The way I see it is that the CRM needs some minimum permissions to be able to complete the process. Apparently it gets stuck at some step where he should be able to retrieve data from the upload folder to be able to generate a link. As the permissions are set at a wrong value by my webhost through their ACL, the process is stopped at that stage.

Could it be what actually happens ?

Yeah, something like that. But I still don’t see why the read permissions for user are not enough. Maybe they have your apache running as another user (probably in the same group, but that doesn’t help because no permissions are given to the group).