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

File access trigger not working #92

Open
msi-tl opened this issue May 22, 2021 · 6 comments
Open

File access trigger not working #92

msi-tl opened this issue May 22, 2021 · 6 comments

Comments

@msi-tl
Copy link

msi-tl commented May 22, 2021

Steps to reproduce

  1. Create a workflow with trigger "file access"
  2. Filter: "filename like /.*/"
  3. Script: "echo '%e %i %a' >> /path/to/a/file"
  4. Open a file in web or webdav or sync with desktop client
  5. Run 'sudo -u www-data php -f /var/www/nextcloud/cron.php' on cli

Expected behaviour

The file should contain a line with the file operation file id and the user name.

Actual behaviour

There are nothing happened.
No log entries. Appears on NC 20 and NC 21
Trigger with file create, change, delete and rename are working fine.

Workflow Script app

Workflow Script app version: 1.5.1 & 1.6.0

Server configuration

Operating system:
Ubuntu 20.04.2

Web server:
Apache v2.4.41

Database:
MySQL8 v8.0.23-0ubuntu0.20.04.1

PHP version:
v7.4.16,

Nextcloud version: (see Nextcloud admin page)
20.0.10 & 21.0.2

@msi-tl msi-tl changed the title File access trigger not working (NC21) File access trigger not working May 22, 2021
@blizzz
Copy link
Member

blizzz commented May 25, 2021

did you check the flow.log in data dir?

@msi-tl
Copy link
Author

msi-tl commented May 26, 2021

It seems that flow.log is not be filled by workflow_script. There is not one entry by this app.
Watching with tail -f flow.log and doing the described steps not showing anything including the actions that are working properly (create, change etc.)
The app files_accesscontrol is writing to this log if an access is prevented.

@blizzz
Copy link
Member

blizzz commented May 26, 2021

ah, i think the loglevel should be set to 1 for this.

@msi-tl
Copy link
Author

msi-tl commented May 26, 2021

Ok, now flow.log is receiving information about the workflow stuff.
But with loglevel 1 there are again no information about the action "access file".
I tried with loglevel 0 and I got the following output from opening a text file in web ui.
Again, there are no information from workflow_script ... :-(

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:20+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"Flow activation: rules were requested","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"scopes":[{"scope":"admin"},{"scope":"user","uid":"[email protected]"}],"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"Flow activation: rules were requested"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"No flow configurations is going to run","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"No flow configurations is going to run"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"Flow activation: rules were requested","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"scopes":[{"scope":"admin"},{"scope":"user","uid":"[email protected]"}],"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"Flow activation: rules were requested"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"No flow configurations is going to run","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"No flow configurations is going to run"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"Flow activation: rules were requested","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"scopes":[{"scope":"admin"},{"scope":"user","uid":"[email protected]"}],"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"Flow activation: rules were requested"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"No flow configurations is going to run","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"No flow configurations is going to run"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"Flow activation: rules were requested","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"scopes":[{"scope":"admin"},{"scope":"user","uid":"[email protected]"}],"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"Flow activation: rules were requested"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"No flow configurations is going to run","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"No flow configurations is going to run"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"Flow activation: rules were requested","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"scopes":[{"scope":"admin"},{"scope":"user","uid":"[email protected]"}],"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"Flow activation: rules were requested"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"No flow configurations is going to run","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"No flow configurations is going to run"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"Flow activation: rules were requested","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"scopes":[{"scope":"admin"},{"scope":"user","uid":"[email protected]"}],"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"Flow activation: rules were requested"}}

{"reqId":"cmhhdn8YHuzIbow0blxG","level":0,"time":"2021-05-26T18:20:21+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"GET","url":"/apps/files_texteditor/ajax/loadfile?filename=1377.txt&dir=%2F","message":"No flow configurations is going to run","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\FilesAccessControl\Operation","name":"Zugriff auf Datei verhindern"},"message":"No flow configurations is going to run"}}

@msi-tl
Copy link
Author

msi-tl commented May 26, 2021

As a counterpart, here are the logs from saving a change to a file:

{"reqId":"VdUlQDZRF0n5LrYRBpg7","level":1,"time":"2021-05-26T18:17:02+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"PUT","url":"/apps/files_texteditor/ajax/savefile","message":"All qualified flow configurations are going to run","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"entity":{"class":"OCA\WorkflowEngine\Entity\File","name":"Datei"},"operation":{"class":"OCA\WorkflowScript\Operation","name":"Run script"},"configuration":[{"id":"8","class":"OCA\WorkflowScript\Operation","name":"","checks":"[10]","operation":"/nc-config/lock-file %i %a %e","entity":"OCA\WorkflowEngine\Entity\File","events":"["\\OCP\\Files::postTouch","\\OCP\\Files::postWrite"]","scope_type":"0","scope_actor_id":""}],"message":"All qualified flow configurations are going to run"}}

{"reqId":"VdUlQDZRF0n5LrYRBpg7","level":1,"time":"2021-05-26T18:17:02+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"PUT","url":"/apps/files_texteditor/ajax/savefile","message":"Flow handling for event done","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\WorkflowScript\Operation","name":"Run script"},"entity":{"class":"OCA\WorkflowEngine\Entity\File","name":"Datei"},"eventName":"\OCP\Files::postWrite","message":"Flow handling for event done"}}

{"reqId":"VdUlQDZRF0n5LrYRBpg7","level":1,"time":"2021-05-26T18:17:02+00:00","remoteAddr":"x.x.x.x","user":"[email protected]","app":"workflowengine","method":"PUT","url":"/apps/files_texteditor/ajax/savefile","message":"Flow handling for event done","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1","data":{"operation":{"class":"OCA\WorkflowScript\Operation","name":"Run script"},"entity":{"class":"OCA\WorkflowEngine\Entity\File","name":"Datei"},"eventName":"\OCP\Files::postWrite","message":"Flow handling for event done"}}

@krmax44
Copy link

krmax44 commented Jan 29, 2022

Any updates on this? Having the same problem...

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

3 participants