is not curl or monit that site is doing CSRF check, probably a django site or similar? many web frameworks do that automatically you should point the curl to the specific IP or hostname that the site is expecting
bests, David On Sat, 18 Jul 2020 at 16:42, Norbert Preining <[email protected]> wrote: > Hi all, > > I am trying to control a few operations (read write) via curl. > Unfortunately, the simple approach > curl -u user:pass -s 'http://localhost:NNNN/myservice' --data > 'action=restart' > (monit http is running on port NNNN) finished with > Invalid CSRF Token > > A bit of search brought me to > https://mmonit.com/documentation/http-api/Examples/cURL > which seems exactely what I want to do, alas, the very first invocation > given > curl -c ~/.mmonit/cookie http://localhost:NNNN/index.csp > or > curl -c ~/.mmonit/cookie http://127.0.0.1:NNNN/index.csp > ended with > There is no service named "index.csp" > Even adding the -u user:pass didn't help at all. > > Could someone please explain how to set up read/write access to monit > via curl? It seems that the wiki page/documentation is incorrect. > > Thanks > > Norbert > > -- > PREINING Norbert https://www.preining.info > Accelia Inc. + IFMGA ProGuide + TU Wien + JAIST + TeX Live + Debian Dev > GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13 > >
