-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webaccess basic auth #980
Webaccess basic auth #980
Conversation
Removed old changes
- User is informed about such incident - Application will behave as if basic auth was disabled - This allows for later creation of this file by online tool
Note: this is untested
Why did travis fail? I don't think it's my fault (looks like missing lib)? or is it? |
Hi, thanks for this PR. |
I was thinking this should work like basic auth in apache or nginx - access to everything or nothing. I'm thinking about 3 levels of access:
What do you think about it? |
Also, what do you think about adding this HTML fix to this PR? |
These are only under the hood changes - no UI stuff done yet. Passwords file format is now: `username:password:level` where level is positive integer and is optional. Current levels: - 10 - Virtual Console only - 20 - Virtual Console and Simple Desk - 100 - Access to everything
Okay, so above two commits add permission levels. It is possible to logout user using javascript (sending an XHR request with invalid credentials) but it is hacky and I've seen cases where it didn't work for unknown reasons. PS. I'll look at and fix codacy later, when I have the time. |
Alright, I gave it a go. I think by default there should be complete access with no authentication. This is to preserve backward compatibility (think for example about users who already created scripts to control QLC+ via web)
|
webaccess/src/webaccess.cpp
Outdated
return; | ||
WebAccessUser user; | ||
|
||
if(m_auth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug here!
If m_auth
is null (when no --web-passwords
is specified) there is no default user.
This may be fixed by having default constructor set WebAccessUserLevel::NOT_PROVIDED
, I'm not sure now about implications of this - will check on Monday.
Umm, sorry, I broke it when I added permissions. I'll fix it tomorrow.
The idea behind this was that
This is also a possibility, I'm not sure if I like it though, because it would mean that user cannot disable this feature (i.e. the user management panel is always visible) |
…d create WebAccessAuth instance inside WebAccess Fixed configuration page divs
@mcallegari 2862f3f#diff-88036c1aff96ca72233e90ca2009ad2cR47
I believe this should be |
Indeed ! Fixed now.
Makes sense, but then we should add another option to enable/disable web auth |
Not trivial to implement and doesn't really protect from anything plus adds another information that user has to acquire from documentation/manual/anything.
This may not always be the case. For example in my usecase we sell device and users don't have shell access to it. That's why I've decided that this feature should be "opt in" rather than "opt out" in the first place - to avoid confusion and people locking themselves out + I believe that most users do not need this feature at all.
I would go with this one. It can be "opt out" if you want, but I think that there should be an option to disable it entirely. Maybe adding information that removing passwords file (and providing path to it) will disable authorization requirement will limit confusion of users who accidentally locked themselves out(provided they have read it before). (under existing one about at least one admin user?) EDIT:
This may be the best option or adding a separate option that enables auth. This is a matter of taste I think. PS. I'm on the road and won't get access to computer/programming environment until tomorrow evening. |
…thorization feature If -w/--web is provided, authorized user list is not even displayed in configuration page
Done. And fixed also 401 error I've had before if no auth is enabled |
@mcallegari is there anything that I should change here (not counting bugfixes if anything comes up)? |
@enbyted I have done some quick tests of this PR (thanks) and it looks OK so far. |
I'm happy with how it looks now. I'm sure someone will break it sooner or later, I'll merge this change onto few devices in my city, so we'll have some real world test before any release with this happens. BTW. Any idea what might have be wrong with windows QtCreator installation? I wanted to work on some of the VC stuff and tried to install it, but it only has broken my existing Qt install and doesn't build QLC+ (looks like it thinks that it's on linux and tries to use linux utilities like rm and such). Also I cannot start normal QLC+ install because of that :( I'm sorry, I know it's not right place to ask, but maybe you know the answer right away. |
On the contrary, I'm afraid a patch release is needed quite soon, cause of some regressions on VCSlider.
On Windows I use MSYS2 (which is a linux-like system) and I don't use QtCreator to build. Once you start using it, if you are a Linux user you will find yourself at home |
I didn't have time to apply our patches to 4.11 yet, thus we (my company) haven't really used it in any useful environment (plus I have expected problems to occur, cause it's a pretty big change in QLC+). I'm pretty sure that this PR doesn't break anything when it is not turned on, so it should be safe to push it in 4.11.
Yeah, that's what I used and then I installed QtCreator and it broke everything. Anyway, I feel that I'm going mostly off-topic in this thread. I'm happy with this PR. Once you'll test it yourself and nothing comes up I think it can be merged. I'll port our patches and do an arm build on Wednesday and I'll pass it to our staging team, they'll test it. If any problems with anything in webaccess come up I can work on them, just give me a @-ping in case I don't notice it (I don't follow forums, no time for that, but I do subscribe to this repo). |
Two quick notes:
|
@mcallegari I'm sorry, I wasn't aware that QLC+ still supports QT4. I'll be much more cautious next time. With that in mind @janosvitok 's idea is probably the way to go. I'm on the road and I'll be moving for next week. I can implement it on weekend. I would propose this format: And
BTW. |
OBS (openSuse Build Service): https://build.opensuse.org/ https://build.opensuse.org/project/show/home:mcallegari79 |
@mcallegari Would you be happy with proposed solution? Maybe you have some suggestions? |
@enbyted I think that will work OK |
Awesome, I'll work on that next weekend. Should be done before Sunday
arrives.
…--
Pozdrawiam
Bartosz Grabias
+48 793669953
HIPERNET Sp z o.o.
ul. Kcyńska 48
85-304 Bydgoszcz
2017-07-15 15:32 GMT+02:00 Massimo Callegari <notifications@github.com>:
@enbyted <https://github.com/enbyted> I think that will work OK
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#980 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAtkE2WCFecUYFhSWUT33iRS9NrGdhs4ks5sOL9ZgaJpZM4OBb5j>
.
|
@enbyted any news on this ? I think I need to release a 4.11.1 with some fixes of issues slipped into 4.11.0 and it would be nice to have the web auth feature completed. |
@mcallegari I'm sorry for the delay, I've fallen very sick month ago. I'm working on it right now (or rather fixing my qt install...), should be ready in a couple of hours. Again, I'm very sorry that I couldn't work on it sooner. EDIT: You can take a look at the commit here: enbyted@3da3703 I ran compilation of QLC, it takes about an hour for me to do a full rebuild. I've got to go for now, but I will get back to it later today. Note that this is not testes, so might as well crash. It's in a comment somewhere, but new line format is: username:passwordHash:userLevel:hashType:salt
Should be backwards compatible. |
@enbyted no problem for the delay. I'm still finishing some things and by the way your health is far more important than some lines of code ! |
So, I've wanted to implement this for a while.This is basically a simple implementation on HTTP basic auth.
About this PR:
This change is 100% backwards compatible - without new program argument everything works as before.
Changes to existing QLC+ stuff:
--web-passwords
it accepts a path to a file with authorized users listWebAccess
constructor accepts new argument (optional)configuration.js
Additions:
WebAccessAuth
responsible for managing user/passwords listQLC+AUTH
that enables runtime user managementAuthorized users
where user can manage data in web passwords fileBehavior:
username:sha256(password)
Known issues:
:
and|
or things will break|
or things will breakI'm not sure how these should be approached - ban these characters or escape them?
Also I don't know how Qt translations work and how to update existing translation files to match new code (line number changes and new translation entries)
Other things I noticed:
HTML on configuration page is not formatted correctly - each sections opens two divs and closes only one I'm not sure if it is intentional or not. Here you can see patch (against latest commit in this PR) that fixes it (and screenshots before and after the patch)
Screenshots:
Any feedback is highly appreciated. I'm happy to change anything here if required, however tomorrow I'm going on small vacation and I'll be back available on Wednesday.