-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Request] Create a more granular permission system #1110
Comments
Documentation of Flask Principal: https://pythonhosted.org/Flask-Principal/ |
This would be a very useful improvement. For beginner users it will be necessary to print files without the risk of damaging the printer by using the movement controls or the Terminal. Simple guest users don't provide this. Especially for third parties this will be the minimum security requirement. |
Fun fact: movement controls are disabled while printing for that exact reason. |
Sure I know while printing it's off, but not before and after. In my case I granted access to a beginner user and he watched the printer head moving trough the camera (top view position), but he didn't noticed the heater bed was at Z0 and he moved it down (up arrow) several times. Now the Z motor is damaged and need to be replaced on UM2 Extended. |
That on the other hand is something your firmware shouldn't even allow you to do (move past end stop). |
Strange, as the standard marlin firmware 15.04.2 is installed on this UM2 Extended. Also with the printer itself I can't lower the heater bed to much, it stops automatically. But with Octoprint control buttons it's possible all the time to lower it even on end stop position. |
OctoPrint only send regular move commands, nothing special, same stuff that is in your sliced files. So if it's possible in your printer's firmware to move past the end stops with a simple G0, you don't need to OctoPrint to "achieve" that. Now I might be mistaken, but I seem to remember that at least my ultimaker classic and definitely my printrbot refuse to move steppers past any end stops. Which would be the sane thing to do too. |
The difference is jog buttons use relative mode whereas gcode files are absolute moves, so it is possibly a firmware bug. Or perhaps the axis had not been homed. Very odd to damage a motor. Stepper motors don't mind being stalled. |
Apparently UM2 firmware by default disables any end stop checks unless homing and relies on software end stops instead. Make of that what you will. Easily fixed by recompiling the firmware. |
Yes but that is normal and soft limits should prevent it going below zero after it has homed. |
That may well be (although I'd not consider disabled end stops normal personally but ymmv), but even if you have not homed the soft limits should prevent you from moving to a lower coordinate than from where you started (zero being assumed then to be the initial position on boot). So either the firmware there indeed has some serious bug or the printer in question is started up with the head inside the bed. In any case, nothing that OctoPrint can solve or which actually belongs into this ticket, so I suggest to take further discussions of that topic to the mailing list (if necessary) :) |
Actually the bed moves, not the head on UM2, so if it it was moving down, that is away from Z0 towards Z MAX. That direction is allowed before homing. A better firmware would enable the limits until it had homed, rather than just during homing. |
;) |
Yes but a lower Z coordinate is bed moving upwards. The reported crash is the bed moving downwards, which is a higher coordinate. |
Considering that the bed was at Z0 (head right next to bed, or am I misinformed here and th is can also mean Zmax?) and the user didn't notice that when moving it, I assumed that the mentioned up arrow was with inverted z axis configured in OctoPrint and hence negative z direction (which makes sense for a UM) and the user moved the bed against the head repeatedly. Otherwise I'm unclear why the initial position of Z0 would even be of relevance for that tale. Maybe @UM2EXTENDED wants to shed some light on this to solve this mystery of what really happened, because I'm sure confused now. |
OK, here comes the bright light for the almighty darkness :-) I have printed a file created with Cura and RepRap gcode settings by using Octoprint. Cura start.gcode Cura end.gcode After this the beginner user connected to octoprint and started to control the printer by using the arrow buttons in control tab. He pressed the up arrow several times which causes lowering the build plate right into the basement. |
Ok, @nophead you were right then, sorry :D Impressive though, traveling the full z length with video feedback and not noticing that this might be bad O.o |
I expect the bed moves out of the view of the camera at the bottom, just as the nozzle moves out of range of mine at the top. I have actually done the same thing. I moved Z upwards remotely and had forgotten to home it so it smashed into the endstop. Didn't damage anything but it did move the endstop requiring calibration. |
Just wanted to say that I think this is a fantastic idea. Thank you to everyone for your work on this issue. |
I'd love this feature. |
A few incidences like this on mine lead me to enable end stops permanently (not just homing) and to also add max end stops for all the axes. I can smash that move button as much as I like even without homing and it'll stop once it gets to an end stop at either end of any axis. |
@foosel, have you (or anyone else) started on this? I might take a crack at a PR if not. |
My motivation was simply: Make my Octopi secure. Not because I want to port-forward the internet onto it (although that would make it critical), but just because it is best practice as far as I am concerned. I also don't let anyone on my network just read the content on my XMBC RPi or get to the pages on my router without authenticating themselves. On my Octopi I mainly didn't want webcam images of my printer room flying around my network without any auth on them, but the same goes for much of the other content on the octoprint UI. I understand that it is non-trivial to secure the Octoprint installation as this was not part of the original architecture. The best suggested, simple method is http-basic-auth on haproxy. I thought it might be useful to document right here in this github-issue how to do that, having spent a couple of hours fiddling with the options, so here is my relevant haproxy.cfg section:
Note that I have disabled port 80 altogether. As Snowden might agree, unencrypted http over port 80 is basically deprecated, especially if you are using http-basic-auth which sends the password in plain text. It's not that hard to type "https://". Note that I am using my own SSL cert, to avoid those security warnings, ie proper trusted SSL. There are some notes in there about how to produce the crypt(3)'ed password strings. Hope this helps someone, until Gina comes up with something much better. Keep up the great work Gina. Everyone else should support her financially. |
I am not seeing this needs to be built into the core system. As others have mentioned maybe some sort LDAP integration plug point is required, with maybe some default sort of YAML based one provided by default. The issue is when you get into some kind of role based security taxonomy, every other person will want to do it differently, and so there are no macro groups by default that everyone can agree upon. Every single method will have to have a distinct @authorize attribute if you will, and then there would need to be a UI that maps those distinct privileges to admin defined groups. This is reinventing group policy, and if you ever worked with that, it is a full-time job for some poor soul. Maybe @foosel can come up with a more clever solution than I can even imagine to plug this in without polluting the code base with IsAllowed wrappers for some atomic granular security mechanism that 99% of people will never use. And so there is the challenge :) And I love cookies, still. |
@Salandora I took the liberty to assign this to you since it's you who's been working on this for a while now. |
Is it difficult changing the login to a splash screen instead of the top right corner (something similar to NanoDLP)? The ideas above are good (improved permissions management) but it sounds difficult to implement and requires more discussion. If there is a simple method maybe that is the best place to start and then improve on it with future upgrades. |
@HongkaiWuLab It's not difficult enforcing a login screen instead of the usual web interface if no login session is detected (and I even wrote a proof of concept plugin for that a long time ago), but that's equivalent to taping a sticker to your unlocked car that says "locked". If the underlying API still allows anonymous access to the printer status or download of the file, putting a scary login dialog in front of things doesn't help. That's merely simulating security. The API needs to enforce more restrictive permissions, and there's no easy and fast way to do this properly. If you need a solution now, look into further protection one layer above OctoPrint (read: something like HTTP BasicAuth done by the reverse proxy in front of it). |
#2198 has been merged, this will be part of 1.4.0 (no timeline yet, other large stuff that needs to go in there still needs to be done) |
1.4.0 has been released. |
At the moment OctoPrint only distinguishes between three user roles if ACLs are enabled:
As various tickets (e.g. #950, #1109 and #640 to name a view) and posts on mailinglist etc have shown, that is not granular enough for many usage scenarios.
Instead there should be a more granular permission system that allows:
In order to do this we need to
The text was updated successfully, but these errors were encountered: