Have you look for this feature in other issues and in the wiki?
It is related to #1550, but I that ticket was closed due to inactivity, not because it was thoroughly thought through. Not knowing if opening a new issue, or appending to that closed ticket is better, I decided to open a new one. Feel free to correct me.
Is your feature request related to a problem? Please describe.
The web interface knows only 1 role: admin. I have 2 issues with that:
Describe the solution you'd like
Please allow 2 or 3 roles on the web interface.
/cm?user=viewer&password=XXXX&cmnd=status%208)Describe alternatives you've considered
Other channels than web APIs. I know that Tasmota started out with MQTT. But I like it for the other features: it has OTA, is versatile, and it has a rather nice web interface.
Just in case someone wants to tell me to use MQTT: I do not want to use MQTT anymore. Been there, done that, ran away screaming. I use WEB API (REST) wherever possible now. And before I get comments on that, I have created, and still maintain, a large scale commercial product that uses MQTT extensively. Seen enough of it to not want that anymore.
Additional context
I can help coding it, it is not that complicated. It gets more difficult if you want it to work on more than 2 roles, and/or on other endpoints than /cm?cmnd=status{....}, but even that is doable. If you factor out the authentication and authorization to one central location, we might even be able to lower the overall code size. And it would raise the config size by only a couple of bytes (20 bytes or so per role).
The main goal of Tasmota is using the device via mqtt. This will not be changed.
I think the project owner will not invest time in coding Web user roles.
You could do a PR, if code size increase is minimal there is a chance to get merged.
I think the project owner will not invest time in coding Web user roles.
Have seen that in other replies.
You could do a PR, if code size increase is minimal there is a chance to get merged.
Understood, will free up some time for that.
IMO this whole admin thing that already is in tasmota wastes space and (much more important) creates a false sense of security. It wont get better with roles.
If you need security:
@joba-1 I agree 100% with you in aspect security. A ESP8266 will never be secure with a accessible Web Frontend!
A usage scenario could be setting up the device and locking it only for viewing and using (switching).
Nothing can be changed by accident -> kids
Just out of curiosity: what are the drawbacks of mqtt that made you run away screaming?
To give context: I think mqtt is a very good way to keep status of not-always-on devices (without wearing their flash/eeprom - if they even have that) and to allow changing their status while they are off for the next time they come back.
I admit though, this is not the normal tasmota usecase, just my own on some external sensors. With tasmota it only has the advantage of being more lightweight than most other protocols. But if you implement everything in mqtt and other protocols (like html) that already defeats the point a bit...
@joba-1 What you are suggesting is adding a reverse proxy in front of them, acting like an API manager. That is possible of course. But it all goes over the air after that. Other SSID or not. And there we have another vulnerability (especially with 2.3.0, see KRACK), so in the end that kind of setup is not really much more secure. And yes, I use a separate SSID and a separate VLAN.
@Jason2866 I could work towards that. The software already has provisions for that, (see HttpOptions and see type in StartWebserver(int type, IPAddress ipweb)) , although that is not used fully, as only HTTP_MANAGER_RESET_ONLY and HTTP_MANAGER are used. I could complete that. Just need a way to switch between modes run time, and not only setup-time.
EDIT: I just see that I CAN switch to user mode via command "webserver 1". Just need to find out what the functionality is when I do that (I think that command 'STATUS...', used for reading the sensors, is not available then), and how to get back to 'admin mode' run time, without having to use MQTT or re-flashing.
@joba-1 about MQTT: the security part is really bothersome, as is the scalability (especially with a broker like mosquitto). MQTT is nice for devices on low quality (mobile) links, but networks get better all the time. The typical use case for the Sonoff devices is static installations with a link to a local hub, not mobile. Once you've seen the power of APIs/REST, together with API managers, you do not want to go back. It is just much easier to work with HTTP APIs, and can be very lightweight as well.
I'm not saying it is not possible, just that I've had too many bad experiences with MQTT. Plus, my network is fully 1-wire (for various wired sensors) + REST (for WiFi and for wired) + SNMP (mainly for network infra stuff), so I prefer not to add a broker in there for something that I can also do via other means.
Thanks @hb020 ,
regarding security: I dont really agree that cracking a wlan is somewhere near the same league as plain text sniffing, but I see your point and you are right that wlan encryption also is not 100% secure (well, basically nothing is). Just wanted to point out there might be better solutions available for your problem.
regarding mqtt: I see, you are talking of existing api protocols/libraries. For that I agree, http is just much more common, so much more stuff is based on that. But technically there is nothing that prevents you from implementing an api that exists for http on top of mqtt as well.
Here's what I found so far about the built-in 'USER' and 'ADMIN ' modes of the web server:
webserver 1.m parameter is not JSON, but a mix of HTML and text. I personally see 2 problems with that (in a non-MQTT situation). If one is in USER mode, ..
webserver 1 command behind the scenes. In reply to this action, a one time, system generated, write-down passphrase is shown. Going back to ADMIN mode will go through a specific URL, using that passphrase. The passphrase will need to be created random or (preferably not) calculated by the system from MAC address or so. Consequences: one string in settings, and relatively little code is needed.The last is more standard, and is probably easier to explain to users, but will add more code. Option "i" is also fine by me, but will require an explanation, preferably run-time. Option 'ii' has no real advantage.
I like that 'lock down' button. Make it easy for people to secure their device a bit more. Right now it is rather hard to find out how to do it, so I can bet not many people do it.
What would be your preferences?
I will not use this function since i am a mqtt guy and dont use webfrontend. So i am the wrong person to ask... I could imagine, best change for merge has the solution with smallest code size increase
So far my two cents to it.
Just to let you know I'm working on options i) and iii) from the post above (4 days ago). Will compare code footprint and ease of use.
PR made. Neither option i) nor iii) behave great. Both have counter intuitive edges, but the latter gives more freedom of use, and is more intuitive, hence the PR for option 3. And it only adds 208 bytes to sonoff.bin (Orig: 543聽040, New: 543聽248)
Closing this issue as the PR has been made for reviewing. Thanks for sharing your ideas.
Most helpful comment
IMO this whole admin thing that already is in tasmota wastes space and (much more important) creates a false sense of security. It wont get better with roles.
If you need security: