Thanks but meanwhile problem is solved:
-
Removed the CRLF in the exec.whitelist file and replaced by LF only;
-
Restarted OpenHab;
Did solved my problem!
Thanks but meanwhile problem is solved:
Removed the CRLF in the exec.whitelist file and replaced by LF only;
Restarted OpenHab;
Did solved my problem!
Hi to all,
the solution with CRLF and LF didnât wok for meâŠ
I wrote this rule:
when
System started
then
executeCommandLine(âchmod -v 775 /etc/openhab2/misc/exec.whitelistâ)
end
I found out every time (at startup of my openHAB) when I re-saved the exec.whitelist file the scripts start working until the next start of openhabâŠ
Itâs only a workaround but I hope I could help a little bit as a newbie
This line ending character(s) behaviour is quite weird.
I had a quick look at the source code and the ExecWhitelistWatchService class uses Files.lines().forEach()
which ultimately leads to BufferedReader.readLine()
.
The readLine
method documentation states:
âReads a line of text. A line is considered to be terminated by any one of a line feed (â\nâ), a carriage return (â\râ), or a carriage return followed immediately by a linefeed.â
and its result is specified as:
âA String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reachedâ
Also, the Java documentation states the following as valid line termination characters:
\u000D
followed by \u000A
, CARRIAGE RETURN followed by LINE FEED\u000A
, LINE FEED\u000D
, CARRIAGE RETURNCould this be a character encoding issue?
Is everyone reporting issues here running on Linux or are there also Windows users?
For me it was CRLF. Changed to LF as it should be helpded.
butâŠ
âŠafter restart it does not work again.
No.
after openhab start try:
sudo -u openhab chmod -v 775 /etc/openhab2/misc/exec.whitelist
and look at the openhab.log/events.log if ur scripts are working correctlyâŠ
for me itâs working and the rule does the rest after every start
I am on Linux and converting the file to DOS format did the job (after a while, you need to wait until the file observer detected the change). Reading the other comments in the thread it looks like DOS people need Linux line endings and Linux people DOS line endings. Or some other weird environment issues happen. Nothing in the code looks wrong to me.
Very strange indeed.
I can confirm this behavior: only changes to the exec.whitelist file makes it realized by openhab. No matter if you change characters or file permission settings.
My openhab : 2.5.2 running on openhabian/raspi/stretch
I guess we will have to live with that bug until 2.5.3
Only if youâre not bright enough to install the fix that already exists.
Thanks for kindness.
There may be more not bright enough like me.
I will live with it.
Iâm definitely not bright enough, indeed.
Also - where do I find the 2.5.1 jar? That was my main question.
I found the newest version here:
https://openhab.jfrog.io/openhab/webapp/#/builds/PR-openHAB2-Addons/17461/1582472126712/published%20/org.openhab.addons.bundles:org.openhab.binding.exec:2.5.3-SNAPSHOT
first, I removed the existing binding via Paper-UI and then moved that jar file to the conf/addons folder in openhab⊠I waited 1 min⊠then it worked
Thanks @papaPhiL, this did the trick for me.
For others: lookup the correct location of the âconf/addonsâ folder in the documentation:
see âAdditional add-on filesâ in https://www.openhab.org/docs/installation/linux.html
Whats with the misc
directory? are we just inventing random configuration directories now? Where is this supposed to go? Iâve seen people mention /home/openhab2/conf
(which I donât have), /etc/openhab2
but there is no misc
directory.
Are we supposed to just âknowâ where this non existent directory is intended to be?
There should be an option to disable this check in a config file (like addons.cfg, or runtime.cfg), or a reasonable alternative (like wildcards) until a workable solution can be implemented.
It does feel odd. Typically this whitelist sounds like the sort of thing that should go in /services/. Maybe the idea is that you can more easily lock down write access to a âspecialâ directory.
So where does this file go? Iâm also getting no log entries at all, the exec command just donât work anymore.
OK I got this log entry:
26-Feb-2020 12:16:04.496 [DEBUG] [ab.binding.exec.internal.ExecWhitelistWatchService] - Updated command whitelist:
But thatâs it, nothing when I actually try to trigger a command. log level is set to DEBUG. Iâve updated to the 2.5.3 SNAPSHOT build, but still nothing.
Iâm assuming this means i have the exec.whitelist
file in the right place /etc/openhab2/misc
.
Honestly, I understand security concerns, but when the security prevents you from actually doing anything, well there is no point in having an exec binding in the first place.
Finally went back to 2.5.1 binding, and all works again, including logging.
Seriously WTF?
This is strange to me. I have several âexecuteCommandLineâ rules and they all still run flawlessly, no mention of whitelist errors in the logs.
Which OH version are you running?