FHEM Forum

FHEM => Automatisierung => Thema gestartet von: bend94 am 28 März 2017, 20:59:18

Titel: problem with curl http://192.168.0.4:8083/fhem?cmd.PorteSms=attr%20PorteSms%20di
Beitrag von: bend94 am 28 März 2017, 20:59:18
Hi

I was using this command through curl to enable or disable attribute

enable:

curl "http://192.168.0.4:8083/fhem?cmd.PorteSms=attr%20PorteSms%20disable%200"

disable:

curl "http://192.168.0.4:8083/fhem?cmd.PorteSms=attr%20PorteSms%20disable%201"


I did an upgrade of fhem and reboot

now it doesn't work anymore
Please advise

regards
Titel: Antw:problem with curl http://192.168.0.4:8083/fhem?cmd.PorteSms=attr%20PorteSms%20di
Beitrag von: MadMax-FHEM am 28 März 2017, 21:10:11
Now fhem uses a random token csrfToken in order to be safe against cross side resource forgery:

https://forum.fhem.de/index.php/topic,67419.0.html

sorry is in german but here is a short description in the commandref:

https://fhem.de/commandref.html#FHEMWEB

Regards, Joachim
Titel: Antw:problem with curl http://192.168.0.4:8083/fhem?cmd.PorteSms=attr%20PorteSms%20di
Beitrag von: roedert am 28 März 2017, 22:48:05
attr <FHEMWEB-device> csrfToken none
Titel: Antw:problem with curl http://192.168.0.4:8083/fhem?cmd.PorteSms=attr%20PorteSms%20di
Beitrag von: MadMax-FHEM am 28 März 2017, 22:56:38
Zitat von: roedert am 28 März 2017, 22:48:05
attr <FHEMWEB-device> csrfToken none

That was NOT the intention of "inventing" that token!

Doing so is UNSAFE!!

Everyone is responsible for his own installation...
...and so can do whatever he wants...
...I just wanted to mention that!

Regards, Joachim
Titel: Antw:problem with curl http://192.168.0.4:8083/fhem?cmd.PorteSms=attr%20PorteSms%20di
Beitrag von: rudolfkoenig am 29 März 2017, 09:09:41
Zitatnow it doesn't work anymore
Please advise
If you take a look into your FHEM Log, you'll see a message like
FHEMWEB WEB CSRF error:  ne csrf_500476365397455. For detals see the csrfToken FHEMWEB attribute


If you follow the instruction, and check https://fhem.de/commandref.html#csrfToken, you get a short explanation:
ZitatIf set, FHEMWEB requires the value of this attribute as fwcsrf Parameter for each command. It is used as countermeasure for Cross Site Resource Forgery attacks. If the value is random, then a random number will be generated on each FHEMWEB start. If it is set to the literal string none, no token is expected. Default is random for featurelevel 5.8 and greater, and none for featurelevel below 5.8