From 8231edc54ec438a18124657025d93f1a86a21f03 Mon Sep 17 00:00:00 2001
From: rudolfkoenig <>
Date: Thu, 23 Feb 2017 09:11:20 +0000
Subject: [PATCH] 96_allowed: update documentation for basicAuth/passwort
git-svn-id: https://svn.fhem.de/fhem/trunk@13492 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/96_allowed.pm | 123 +++++++++++++---------------------------
1 file changed, 39 insertions(+), 84 deletions(-)
diff --git a/fhem/FHEM/96_allowed.pm b/fhem/FHEM/96_allowed.pm
index ddc1bf5af..d3270f45d 100755
--- a/fhem/FHEM/96_allowed.pm
+++ b/fhem/FHEM/96_allowed.pm
@@ -360,30 +360,19 @@ EOF
basicAuth, basicAuthMsg
- request a username/password authentication for FHEMWEB access. You have
- to set the basicAuth attribute to the Base64 encoded value of
- <user>:<password>, e.g.:
- # Calculate first the encoded string with the commandline program
- $ echo -n fhemuser:secret | base64
- ZmhlbXVzZXI6c2VjcmV0
- # Set the FHEM attribute
- attr allowed_WEB basicAuth ZmhlbXVzZXI6c2VjcmV0
-
- You can of course use other means of base64 encoding, e.g. online
- Base64 encoders.
-
- If the argument of basicAuth is enclosed in { }, then it will be
- evaluated, and the $user and $password variable will be set to the
- values entered. If the return value is true, then the password will be
- accepted.
-
- If basicAuthMsg is set, it will be displayed in the
- popup window when requesting the username/password.
-
- Example:
+ request a username/password authentication for FHEMWEB access.
+ It can be a base64 encoded string of user:password, an SHA256 hash
+ (which should be set via the corresponding set command) or a perl
+ expression if enclosed in {}, where $user and $password are set, and
+ which returns true if accepted or false if not. Examples:
- attr allowedWEB basicAuth { "$user:$password" eq "admin:secret" }
+ attr allowed basicAuth ZmhlbXVzZXI6c2VjcmV0
+ attr allowed basicAuth SHA256:F87740B5:q8dHeiClaPLaWVsR/rqkzcBhw/JvvwVi4bEwKmJc/Is
+ attr allowed basicAuth {"$user:$password" eq "fhemuser:secret"}
+ If basicAuthMsg is set, it will be displayed in the popup window when
+ requesting the username/password. Note: not all browsers support this
+ feature.
@@ -399,20 +388,9 @@ EOF
password
Specify a password for telnet instances, which has to be entered as the
- very first string after the connection is established. If the argument
- is enclosed in {}, then it will be evaluated, and the $password
- variable will be set to the password entered. If the return value is
- true, then the password will be accepted. If this parameter is
- specified, FHEM sends telnet IAC requests to supress echo while
- entering the password. Also all returned lines are terminated with
- \r\n.
- Example:
-
-
- attr allowed_tPort password secret
- attr allowed_tPort password {"$password" eq "secret"}
-
-
+ very first string after the connection is established. The same rules
+ apply as for basicAuth, with the expception that there is no user to be
+ specified.
Note: if this attribute is set, you have to specify a password as the
first argument when using fhem.pl in client mode:
@@ -522,31 +500,20 @@ EOF
- basicAuth, basicAuthMsg
- Betrifft nur FHEMWEB Instanzen (siehe validFor): Fragt username /
- password zur Autentifizierung ab. Es gibt mehrere Varianten:
-
- - falls das Argument nicht in { } eingeschlossen ist, dann wird
- es als base64 kodiertes benutzername:passwort interpretiert.
- Um sowas zu erzeugen kann man entweder einen der zahlreichen
- Webdienste verwenden, oder das base64 Programm. Beispiel:
-
- $ echo -n fhemuser:secret | base64
- ZmhlbXVzZXI6c2VjcmV0
- fhem.cfg:
- attr WEB basicAuth ZmhlbXVzZXI6c2VjcmV0
-
-
- - Werden die Argumente in { } angegeben, wird es als perl-Ausdruck
- ausgewertet, die Variablen $user and $password werden auf die
- eingegebenen Werte gesetzt. Falls der Rückgabewert wahr ist,
- wird die Anmeldung akzeptiert.
-
- Beispiel:
-
- attr allwedWEB basicAuth { "$user:$password" eq "admin:secret" }
-
-
-
+ Erzwingt eine Authentifizierung mit Benutzername/Passwort für die
+ zugerdnete FHEMWEB Instanzen. Der Wert kann entweder das base64
+ kodierte Benutzername:Passwort sein, ein SHA256 hash (was man am besten
+ mit dem passenden set Befehl erzeugt), oder, falls er in {}
+ eingeschlossen ist, ein Perl Ausdruck. Für Letzteres wird
+ $user und $passwort gesetzt, und muss wahr zurückliefern, falls
+ Benutzername und Passwort korrekt sind. Beispiele:
+
+ attr allowed basicAuth ZmhlbXVzZXI6c2VjcmV0
+ attr allowed basicAuth SHA256:F87740B5:q8dHeiClaPLaWVsR/rqkzcBhw/JvvwVi4bEwKmJc/Is
+ attr allowed basicAuth {"$user:$password" eq "fhemuser:secret"}
+
+ basicAuthMsg wird (in manchen Browsern) in dem Passwort Dialog als
+ Überschrift angezeigt.
@@ -554,30 +521,18 @@ EOF
- password
Betrifft nur telnet Instanzen (siehe validFor): Bezeichnet ein
Passwort, welches als allererster String eingegeben werden muss,
- nachdem die Verbindung aufgebaut wurde. Wenn das Argument in { }
- eingebettet ist, dann wird es als Perl-Ausdruck ausgewertet, und die
- Variable $password mit dem eingegebenen Passwort verglichen. Ist der
- zurückgegebene Wert wahr (true), wird das Passwort akzeptiert.
- Falls dieser Parameter gesetzt wird, sendet FHEM telnet IAC Requests,
- um ein Echo während der Passworteingabe zu unterdrücken.
- Ebenso werden alle zurückgegebenen Zeilen mit \r\n abgeschlossen.
-
- Beispiel:
-
-
- attr allowed_tPort password secret
- attr allowed_tPort password {"$password" eq "secret"}
-
-
- Hinweis: Falls dieses Attribut gesetzt wird, muss als erstes Argument
- ein Passwort angegeben werden, wenn fhem.pl im Client-mode betrieben
- wird:
-
-
+ nachdem die Verbindung aufgebaut wurde. Für die Werte gelten die
+ Regeln von basicAuth, mit der Ausnahme, dass nur Passwort und kein
+ Benutzername spezifiziert wird.
Falls dieser Parameter gesetzt
+ wird, sendet FHEM telnet IAC Requests, um ein Echo während der
+ Passworteingabe zu unterdrücken. Ebenso werden alle
+ zurückgegebenen Zeilen mit \r\n abgeschlossen.
+ Falls dieses Attribut gesetzt wird, muss als erstes Argument ein
+ Passwort angegeben werden, wenn fhem.pl im Client-mode betrieben wird:
+
perl fhem.pl localhost:7072 secret "set lamp on"
-
-
-
+
+
globalpassword