-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Feature request: support for basic auth for octoprint #650
Comments
Can you please elaborate what you mean by:
The standard way right now of authenticating to Octoprint is via the API key. Is this insufficient for you? |
My octo server is behind ha proxy with basic auth, so I cant upload directly. the whole server is inaccessible until authentication has succeeded. |
@Tirpitz93 Ah, I see now what you mean. I'm not sure I see the reason for having this feature though. Can you describe your usecase or why you need it? Ie. specifically what the benefit is over authorization via an API key? Honestly I don't think we have enough cycles to implement it unless there is a convincing reason to do so... |
No response for a long time, closing. Feel free to comment further if needed. |
because my printer is behind basic authentication before it even gets to the octoprint api authentication. AFAIK the only thing that would be required is sending authentication headers in the requests already being made. |
Yes, that's the easy part. The thing I'm more worried about is how a GUI would be made for this. Two additional configuration options for Octoprint would be required, and the GUI is already kind of cluttered. We would also need to explain to other users that this login+password is not the one used for logging into Octoprint and that it's something completely else which most of them will probably never need. I'm not sure how this could be done without confusing people. If I understand the setup right, the idea is to first authenticate with a proxy before passing through to Octoprint, because Octoprint's security is kind of questionable. That's reasonable, although I'd have two reservations:
I would prefer the latter to adding more config options. We could maybe write a tutorial on how to setup a proxy like that (when someone has time to do that 😀). |
This has nothing to do with octoprint. In my setup basic authentication is managed through HAProxy, then I log in to octoprint again. which I manage through SSH. This means that octoprint continues to serve on plain http on the loopback IP and only the "secure" https haproxy faces the internet. |
@Tirpitz93 Yes, I understand. Maybe the best solution would be the ability to add arbitrary http headers. |
That's a rather peculiar setup. What I have done is install https://github.com/OctoPrint/OctoPrint-ForceLogin. So users must login to access anything through the web interface, but the API key still works for Slic3r etc. It does feel rather fragile relying on a plugin to load to enable auth requirement, and the default Octoprint setup is quite woeful in a number of ways in terms of security, compliance with FSH standard etc. sadly. |
Well, perhaps the proxy serves other purposes as well. Although I still think even then it would be better to have the proxy verify the API key rather than using the basic auth. I'm not very keen on an explicit support for basic auth, since it would be interface-wise confusing with Octoprint login, but we could add support for it via arbitrary http headers, which might be useful for other reasons too. Still a bit low-prio at the moment though. But I'll keep it in mind. |
This seams to be a relatively common set up AFAIK, |
That first guide is kind of bad in that it advises to use http on port 80 for the public interface, ie. no https, in which case both the basic auth and the API key are pretty much useless, since they're both publicly visible. Whoever follows that guide without adding additional steps to make https work will end up exposing octoprint in an insecure way. However with https the setup does make sense and we might want to add some kind of a support for it, preferably in a non-confusing way. It won't happen in the upcomming release, as it has a lot of features already, but I'll look into it afterwards. |
I too have haproxy enabled using that guide but configured with https and would love this feature |
Did you consider the Octoprint-ForceLogin plugin first? Then the API key can be used without login (as is normal e.g. for GitHub API). Maybe there are some issues with this plugin I'm unware of, and if so I'd like to hear about them as I'm currently using it. |
I'd rather not have my security based on a plugin functioning, more secure using haproxy and https in my opinion. |
Well this is emabrassing - it turns out we proably already support HTTP Baisc Auth (through libcurl). If you guys want to try it out, just use an URL in this shape:
I can't test it right now but if you can, it would be great if you could report whether it worked. Thanks! Note: This only applies to the new OctoPrint implementation with libcurl since Slic3r PE 1.40.0 (currently beta). |
I'll give it a shot this afternoon :D |
Ha! Good catch. 😁
Yes, I am uneasy about that. I get the feeling that upstream OctoPrint are probably not that interested in patches to make it secure by default. 😞 |
Did anyone get the chance to test if this works? |
@vojtechkral |
@mcristina422 Great! I'll still leave this bug open as a reminder to better document the feature / make it discoverable, because the way it is right now it's pretty much invisible... |
Having two extra fields in the Octoprint Upload section labeled Username and Password would be a great, easy edition to give this feature more exposure. |
@GreatGrizzly that is what I was originally hoping for, but @vojtechkral does have a point with it being a point of confusion for new users. |
@mcristina422 I tested it and got it to work this morning too. |
I've got Octoprint Version 1.3.9 I get the following Error Message:
I've double checked my Username, Password and API Key. I also tried whitelisting my remote IP address which I thought would be a better solution. My browser will load Octoprint without the additional auth step, but Slic3r still gives me the same error. |
Yes. You'll need to import your self-signed certificate, this depends on the OS. On Windows, you'll need to import it into system certificate storage. On Linux / OS X there's a configuration line in Slic3r named |
@vojtechkral I get a new error message: SSL Connect Error (35) |
@Sneakers82 I'm afraid there's no way to get more detailed error message out of Slic3r at the moment since I'm not reading curl's verbose error buffer. (Which I very much should do and I'm putting it on my to-do list, it will be improved in the next release.) In the meantime, you can download
One thing that comes to mind is that by default curl verifies that the hostname matches the name in the certificate and we honor this default for security reasons. This means that if you're connecting to the OctoPrint via an IP address and the certificate instead specifies a hostname, it will be rejected. |
@vojtechkral Thank you! I owe you a beer! I followed this guide and regenerated the cert using my IP for both the issuer and organization Everything works perfectly now! |
@Sneakers82 no problem, glad you got it working. |
in the print_host tooltip. Improves Feature request: support for basic auth for octoprint #650
basic auth is supported through the
convention. The following hint has been added to the tooltip Raw URL was passed to libcurl, while it should have been URL encoded. The changes will be in PrusaSlicer 2.3.0-beta2. Closing. |
The commit 1b720db was not correct, I had to revert it. I believe we have either to leave the escaping of special characters to you or we have to add new input fields for user / password, escape them and combine them into an URL. That is a lot more work though and I don't think that the user base is large enough to justify the effort. |
Nice, thanks. Now somebody "just" needs to implement that. Frankly it would be better, if Octoprint implements HTTP digest authentization, which is much safer than the plain authentization. |
Version
future
Operating system type + version
ALL
Behavior
Enable connecting to octoprint behind a basic auth login.
AFAIK this is a new feature request.
The text was updated successfully, but these errors were encountered: