Good morning,
for some days now I am trying to schedule a cronjob to initiate email fetching every 5 minutes.
The osTicket project runs in an azure web app. Email server is elsewhere. As it is PaaS I don't seem to have an option to start the cron from the web app using .../api/cron.php. Never mind, I go with an external trigger.
I am not a php developer but need to get this one done.
I have tried 3 ways to trigger the action. For each, I created an api key for the given IP.
In each variant, I have tried 3 urls
domain.com/osticket/api/tickets.email, domain.com/osticket/api/tickets and domain.com/osticket/api/email
For each I tried to authenticate with api key and also with no auth.
1) Deployed an azure function to call the urls
( btw code looks like this
headers = {'user-agent': 'our API Client v1.7'}
auth = HTTPBasicAuth('apikey', 'key')
response = requests.post('http://domain.com/osticket/api/tickets.email', headers=headers, auth=auth)
)
2) Local azure function to call the urls
3) Local crontab cronjob from my machine as which is as follows
*/1 * * * * klex wget --output-file=/var/log/cron_log/us.txt --user-agent=85BA96...S https://domain.com/api/cron.php
In file cron.php there is a valid api key and domain.com/api.cron.php and in auptomail.php, there is a valid api key with domain.com/osticket/api/tickets.email
All the endpoints return 404 not found or moved except for cron.php which returns
"cron.php only supports local cron calls - use http -> api/tasks/cron"
Just a brainstorming - what I percieve as room for further investigation is
A) osticket in http://domain.com/osticket/api/tickets.emai, not sure if this is it I don't know how to verify, this is by docs by the project folder structure is
wwwroot/
api/
apps/
assets/
css/
images/
include/
js/
kb/
old/
pages/
scp/
setupoff/
vendor/
and setupoff/scripts/ is where cron.php, automail.php, and so on are located.
B) specification of the request method,
C) invalid form of authentication
Nothing seems to be working. Any tip on how to get this moving will be much appreciated.
Edit:
after careful project exploration, it is even more confusing - there are multiple crons; running gobuster against the website finds:
/cron.php
/Cron.php
/api/cron.php
/api/Cron.php
in the project there is also a path defined as /api/tasks/cron
there are also 2 cron.php files on the server; one in the root dir, second in setupoff/scripts/