From c0c6dd7c7b05233edb091bc75b7bf8ce5e50c179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 21 Oct 2020 14:23:40 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20Make=20access=20control=20mandat?= =?UTF-8?q?ory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently no matter how often you tell people to not put their stuff unsecured on the public internet, they still will do that happily and then I get the resulting fallout from the security community. So you now will HAVE to enable access control. No more disabled ACL. Apparently you can't trust people with this kind of responsibility. If you want a bit more convenience, look into the trusted network settings in config.yaml. And get a password manager. And stop port forwarding and exposing your OctoPrint on the public internet please - it can be found, you are not invisible, and you are putting yourself at risk. Learn what a VPN is and to set one up on your router, that is a valuable skill in any case. --- src/octoprint/access/users.py | 30 +------- src/octoprint/cli/user.py | 2 - src/octoprint/plugins/appkeys/__init__.py | 6 +- src/octoprint/plugins/backup/__init__.py | 15 ++-- src/octoprint/plugins/corewizard/__init__.py | 2 +- .../corewizard/static/js/corewizard.js | 77 ++++++++----------- .../plugins/corewizard/subwizards.py | 19 ++--- .../templates/corewizard_acl_wizard.jinja2 | 51 ++---------- src/octoprint/server/__init__.py | 8 +- src/octoprint/server/api/__init__.py | 22 ++++-- src/octoprint/server/api/access.py | 24 ------ src/octoprint/server/api/settings.py | 10 ++- src/octoprint/server/util/__init__.py | 17 ++-- src/octoprint/server/util/flask.py | 15 ++-- src/octoprint/server/views.py | 15 +--- src/octoprint/settings.py | 1 - .../static/js/app/viewmodels/loginui.js | 5 +- .../static/js/app/viewmodels/wizard.js | 5 +- src/octoprint/templates/initscript.jinja2 | 2 +- 19 files changed, 96 insertions(+), 230 deletions(-) diff --git a/src/octoprint/access/users.py b/src/octoprint/access/users.py index 951928384..5e3115d15 100644 --- a/src/octoprint/access/users.py +++ b/src/octoprint/access/users.py @@ -35,7 +35,6 @@ class UserManager(GroupChangeListener, object): self._logger = logging.getLogger(__name__) self._session_users_by_session = {} self._sessionids_by_userid = {} - self._enabled = True if settings is None: settings = s() @@ -50,29 +49,14 @@ class UserManager(GroupChangeListener, object): self._login_status_listeners.remove(listener) def anonymous_user_factory(self): - if self.enabled: - return AnonymousUser([self._group_manager.guest_group]) - else: - return AdminUser( - [self._group_manager.admin_group, self._group_manager.user_group] - ) + return AnonymousUser([self._group_manager.guest_group]) def api_user_factory(self): return ApiUser([self._group_manager.admin_group, self._group_manager.user_group]) @property def enabled(self): - return self._enabled - - @enabled.setter - def enabled(self, value): - self._enabled = value - - def enable(self): - self._enabled = True - - def disable(self): - self._enabled = False + return True def login_user(self, user): self._cleanup_sessions() @@ -112,7 +96,7 @@ class UserManager(GroupChangeListener, object): return user def logout_user(self, user, stale=False): - if user is None or user.is_anonymous or isinstance(user, AdminUser): + if user is None or user.is_anonymous: return if isinstance(user, LocalProxy): @@ -1444,11 +1428,3 @@ class SessionUser(wrapt.ObjectProxy): class ApiUser(User): def __init__(self, groups): User.__init__(self, "_api", "", True, [], groups) - - -##~~ User object to use when access control is disabled - - -class AdminUser(User): - def __init__(self, groups): - User.__init__(self, "_admin", "", True, [], groups) diff --git a/src/octoprint/cli/user.py b/src/octoprint/cli/user.py index d988777fd..9e9a24f67 100644 --- a/src/octoprint/cli/user.py +++ b/src/octoprint/cli/user.py @@ -71,8 +71,6 @@ def user(ctx): err=True, ) user_manager = FilebasedUserManager(group_manager, settings=settings) - finally: - user_manager.enabled = settings.getBoolean(["accessControl", "enabled"]) ctx.obj.user_manager = user_manager diff --git a/src/octoprint/plugins/appkeys/__init__.py b/src/octoprint/plugins/appkeys/__init__.py index bf05ec9dd..855ac50b5 100644 --- a/src/octoprint/plugins/appkeys/__init__.py +++ b/src/octoprint/plugins/appkeys/__init__.py @@ -419,11 +419,7 @@ class AppKeysPlugin( with self._keys_lock: for user_id, data in self._keys.items(): if any(filter(lambda x: x.api_key == api_key, data)): - if self._user_manager.enabled: - return self._user_manager.find_user(userid=user_id) - elif user_id == "_admin" or user_id == "dummy": - # dummy = backwards compatible - return self._user_manager.anonymous_user_factory() + return self._user_manager.find_user(userid=user_id) return None def _api_keys_for_user(self, user_id): diff --git a/src/octoprint/plugins/backup/__init__.py b/src/octoprint/plugins/backup/__init__.py index b75985030..ab57aa5dc 100644 --- a/src/octoprint/plugins/backup/__init__.py +++ b/src/octoprint/plugins/backup/__init__.py @@ -1101,14 +1101,13 @@ class BackupPlugin( with io.open(configfile, "rt", encoding="utf-8") as f: configdata = yaml.safe_load(f) - if configdata.get("accessControl", {}).get("enabled", True): - userfile = os.path.join(temp, "basedir", "users.yaml") - if not os.path.exists(userfile): - if callable(on_invalid_backup): - on_invalid_backup("Backup lacks users.yaml") - if callable(on_restore_failed): - on_restore_failed(path) - return False + userfile = os.path.join(temp, "basedir", "users.yaml") + if not os.path.exists(userfile): + if callable(on_invalid_backup): + on_invalid_backup("Backup lacks users.yaml") + if callable(on_restore_failed): + on_restore_failed(path) + return False if callable(on_log_progress): on_log_progress("Unpacked") diff --git a/src/octoprint/plugins/corewizard/__init__.py b/src/octoprint/plugins/corewizard/__init__.py index d457c5879..d5fbec327 100644 --- a/src/octoprint/plugins/corewizard/__init__.py +++ b/src/octoprint/plugins/corewizard/__init__.py @@ -105,7 +105,7 @@ class CoreWizardPlugin( return result def get_wizard_version(self): - return 3 + return 4 # ~~ helpers diff --git a/src/octoprint/plugins/corewizard/static/js/corewizard.js b/src/octoprint/plugins/corewizard/static/js/corewizard.js index c92cb9beb..ba87f2f04 100644 --- a/src/octoprint/plugins/corewizard/static/js/corewizard.js +++ b/src/octoprint/plugins/corewizard/static/js/corewizard.js @@ -9,20 +9,19 @@ $(function () { self.confirmedPassword = ko.observable(undefined); self.setup = ko.observable(false); - self.decision = ko.observable(); self.required = false; self.passwordMismatch = ko.pureComputed(function () { - return self.password() != self.confirmedPassword(); + return self.password() !== self.confirmedPassword(); }); self.validUsername = ko.pureComputed(function () { - return self.username() && self.username().trim() != ""; + return self.username() && self.username().trim() !== ""; }); self.validPassword = ko.pureComputed(function () { - return self.password() && self.password().trim() != ""; + return self.password() && self.password().trim() !== ""; }); self.validData = ko.pureComputed(function () { @@ -31,11 +30,10 @@ $(function () { ); }); - self.keepAccessControl = function () { + self.createAccount = function () { if (!self.validData()) return; var data = { - ac: true, user: self.username(), pass1: self.password(), pass2: self.confirmedPassword() @@ -43,35 +41,27 @@ $(function () { self._sendData(data); }; - self.disableAccessControl = function () { - var message = gettext( - "If you disable Access Control and your OctoPrint installation is accessible from the internet, your printer will be accessible by everyone - that also includes the bad guys!" - ); - showConfirmationDialog({ - message: message, - onproceed: function (e) { - var data = { - ac: false - }; - self._sendData(data); - } - }); - }; - self._sendData = function (data, callback) { OctoPrint.postJson("plugin/corewizard/acl", data).done(function () { self.setup(true); - self.decision(data.ac); - if (data.ac) { - // we now log the user in - var user = data.user; - var pass = data.pass1; - self.loginStateViewModel.login(user, pass, true).done(function () { - if (callback) callback(); - }); - } else { + + // we now log the user in + var user = data.user; + var pass = data.pass1; + self.loginStateViewModel.login(user, pass, true).done(function () { if (callback) callback(); - } + }); + }); + }; + + self._showDecisionNeededDialog = function () { + showMessageDialog({ + title: gettext("Please set up Access Control"), + message: gettext( + "You haven't yet set up access control. You need to setup a " + + 'username and password and click "Create Account" before ' + + "continuing." + ) }); }; @@ -85,12 +75,17 @@ $(function () { ) { return true; } - showMessageDialog({ - title: gettext("Please set up Access Control"), - message: gettext( - 'You haven\'t yet set up access control. You need to either setup a username and password and click "Keep Access Control Enabled" or click "Disable Access Control" before continuing' - ) - }); + + self._showDecisionNeededDialog(); + return false; + }; + + self.onBeforeWizardFinish = function () { + if (!self.required) return true; + + if (self.setup()) return true; + + self._showDecisionNeededDialog(); return false; }; @@ -102,14 +97,6 @@ $(function () { response.corewizard.details.acl && response.corewizard.details.acl.required; }; - - self.onWizardFinish = function () { - if (!self.required) return; - - if (!self.decision()) { - return "reload"; - } - }; } function CoreWizardWebcamViewModel(parameters) { diff --git a/src/octoprint/plugins/corewizard/subwizards.py b/src/octoprint/plugins/corewizard/subwizards.py index 0655de0e5..f88575bc7 100644 --- a/src/octoprint/plugins/corewizard/subwizards.py +++ b/src/octoprint/plugins/corewizard/subwizards.py @@ -63,10 +63,10 @@ class WebcamSubwizard(object): # noinspection PyUnresolvedReferences,PyMethodMayBeStatic class AclSubwizard(object): def _is_acl_wizard_firstrunonly(self): - return True + return False def _is_acl_wizard_required(self): - return self._user_manager.enabled and not self._user_manager.has_been_customized() + return not self._user_manager.has_been_customized() def _get_acl_wizard_details(self): return {"required": self._is_acl_wizard_required()} @@ -81,11 +81,11 @@ class AclSubwizard(object): def acl_wizard_api(self): from flask import abort, request - from octoprint.server.api import NO_CONTENT, valid_boolean_trues + from octoprint.server.api import NO_CONTENT if ( not self._settings.global_get(["server", "firstRun"]) - or self._user_manager.has_been_customized() + and self._user_manager.has_been_customized() ): abort(404) @@ -94,17 +94,12 @@ class AclSubwizard(object): data = request.values if ( - "ac" in data - and data["ac"] in valid_boolean_trues - and "user" in data + "user" in data and "pass1" in data and "pass2" in data and data["pass1"] == data["pass2"] ): # configure access control - self._settings.global_set_boolean(["accessControl", "enabled"], True) - self._user_manager.enable() - self._user_manager.add_user( data["user"], data["pass1"], @@ -113,10 +108,6 @@ class AclSubwizard(object): [USER_GROUP, ADMIN_GROUP], overwrite=True, ) - elif "ac" in data and data["ac"] not in valid_boolean_trues: - # disable access control - self._settings.global_set_boolean(["accessControl", "enabled"], False) - self._user_manager.disable() self._settings.save() return NO_CONTENT diff --git a/src/octoprint/plugins/corewizard/templates/corewizard_acl_wizard.jinja2 b/src/octoprint/plugins/corewizard/templates/corewizard_acl_wizard.jinja2 index 0fae5bcdd..1537989d2 100644 --- a/src/octoprint/plugins/corewizard/templates/corewizard_acl_wizard.jinja2 +++ b/src/octoprint/plugins/corewizard/templates/corewizard_acl_wizard.jinja2 @@ -1,26 +1,10 @@

{{ _('Access Control') }}

-{% trans safe_remote_url='https://octoprint.org/blog/2018/09/03/safe-remote-access/' %}

- Please read the following, it is very important for your printer's health! -

-

- OctoPrint by default ships with Access Control enabled, meaning you won't be able to do anything with the - printer unless you login first as a configured user. This is to prevent strangers - possibly with - malicious intent - to gain access to your printer via an untrustworthy network - and using it in such a way that it is damaged or worse (i.e. causes a fire). -

-

- If you plan on accessing OctoPrint remotely over the internet, you should not only rely on the built-in - Access Control mechanisms however - - take additional precautions. - Your OctoPrint enabled printer is a critical home appliance you really should not give anyone who happens to be - connected to the internet access to - even read-only! An instance available publicly on the internet - will be found, and people will try to break it open. -

-

- It looks like you haven't configured access control yet. Please set up a username and password for the - initial administrator account who will have full access to both the printer and OctoPrint's settings, then click - on "Keep Access Control Enabled": +{% trans %}

+ It looks like you haven't configured access control yet, which is now mandatory. + Please set up a username and password for the + initial administrator account who will have full access to both the printer and + OctoPrint's settings:

{% endtrans %}
@@ -42,26 +26,7 @@ {{ _('Passwords do not match') }}
+
-{% trans %}

- Note: In case that your OctoPrint installation is only accessible from within a trustworthy local network and you don't - need Access Control for other reasons, you may alternatively disable Access Control. You should only - do this if you are absolutely certain that only people you know and trust will be able to connect to it. -

-

- Do NOT underestimate the risk of access from the internet to your printer and OctoPrint instance! -

{% endtrans %} - -
- {{ _('Disable Access Control') }} - {{ _('Keep Access Control Enabled') }} -
- - diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index f438c2538..2166898b6 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -175,7 +175,7 @@ def on_user_logged_out(sender, user=None): def load_user(id): - if id is None or not userManager.enabled: + if id is None: return None if id == "_api": @@ -553,10 +553,6 @@ class Server(object): "falling back to FilebasedUserManager!".format(user_manager_name) ) userManager = octoprint.access.users.FilebasedUserManager(groupManager) - finally: - userManager.enabled = self._settings.getBoolean( - ["accessControl", "enabled"] - ) components.update({"user_manager": userManager}) # create printer instance @@ -1349,7 +1345,7 @@ class Server(object): if "X-Locale" in request.headers: return Locale.negotiate([request.headers["X-Locale"]], LANGUAGES) - if hasattr(g, "identity") and g.identity and userManager.enabled: + if hasattr(g, "identity") and g.identity: userid = g.identity.id try: user_language = userManager.get_user_setting( diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 392ec8626..5499a0463 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -162,7 +162,11 @@ def pluginCommand(name): @api.route("/setup/wizard", methods=["GET"]) def wizardState(): - if not s().getBoolean(["server", "firstRun"]) and not Permissions.ADMIN.can(): + if ( + not s().getBoolean(["server", "firstRun"]) + and octoprint.server.userManager.has_been_customized() + and not Permissions.ADMIN.can() + ): abort(403) seen_wizards = s().get(["server", "seenWizards"]) @@ -199,7 +203,11 @@ def wizardState(): @api.route("/setup/wizard", methods=["POST"]) def wizardFinish(): - if not s().getBoolean(["server", "firstRun"]) and not Permissions.ADMIN.can(): + if ( + not s().getBoolean(["server", "firstRun"]) + and octoprint.server.userManager.has_been_customized() + and not Permissions.ADMIN.can() + ): abort(403) data = {} @@ -278,7 +286,7 @@ def login(): if not data: data = request.values - if octoprint.server.userManager.enabled and "user" in data and "pass" in data: + if "user" in data and "pass" in data: username = data["user"] password = data["pass"] @@ -296,10 +304,10 @@ def login(): if not user.is_active: return make_response(("Your account is deactivated", 403, [])) - if octoprint.server.userManager.enabled: - user = octoprint.server.userManager.login_user(user) - session["usersession.id"] = user.session - g.user = user + user = octoprint.server.userManager.login_user(user) + session["usersession.id"] = user.session + g.user = user + login_user(user, remember=remember) identity_changed.send( current_app._get_current_object(), identity=Identity(user.get_id()) diff --git a/src/octoprint/server/api/access.py b/src/octoprint/server/api/access.py index c88c33883..0090940a0 100644 --- a/src/octoprint/server/api/access.py +++ b/src/octoprint/server/api/access.py @@ -141,9 +141,6 @@ def remove_group(key): @no_firstrun_access @Permissions.SETTINGS.require(403) def get_users(): - if not userManager.enabled: - return jsonify(SUCCESS) - return jsonify(users=list(map(lambda u: u.as_dict(), userManager.get_all_users()))) @@ -151,9 +148,6 @@ def get_users(): @no_firstrun_access @Permissions.SETTINGS.require(403) def add_user(): - if not userManager.enabled: - return jsonify(SUCCESS) - if "application/json" not in request.headers["Content-Type"]: return make_response("Expected content-type JSON", 400) @@ -189,9 +183,6 @@ def add_user(): @api.route("/access/users/", methods=["GET"]) @no_firstrun_access def get_user(username): - if not userManager.enabled: - return jsonify(SUCCESS) - if ( current_user is not None and not current_user.is_anonymous @@ -213,9 +204,6 @@ def get_user(username): @no_firstrun_access @Permissions.SETTINGS.require(403) def update_user(username): - if not userManager.enabled: - return jsonify(SUCCESS) - user = userManager.find_user(username) if user is not None: if "application/json" not in request.headers["Content-Type"]: @@ -254,9 +242,6 @@ def update_user(username): @no_firstrun_access @Permissions.SETTINGS.require(403) def remove_user(username): - if not userManager.enabled: - return jsonify(SUCCESS) - try: userManager.remove_user(username) return get_users() @@ -302,9 +287,6 @@ def change_password_for_user(username): @api.route("/access/users//settings", methods=["GET"]) @no_firstrun_access def get_settings_for_user(username): - if not userManager.enabled: - return jsonify(SUCCESS) - if ( current_user is None or current_user.is_anonymous @@ -324,9 +306,6 @@ def get_settings_for_user(username): @api.route("/access/users//settings", methods=["PATCH"]) @no_firstrun_access def change_settings_for_user(username): - if not userManager.enabled: - return jsonify(SUCCESS) - if ( current_user is None or current_user.is_anonymous @@ -355,9 +334,6 @@ def change_settings_for_user(username): @api.route("/access/users//apikey", methods=["DELETE"]) @no_firstrun_access def delete_apikey_for_user(username): - if not userManager.enabled: - return jsonify(SUCCESS) - if ( current_user is not None and not current_user.is_anonymous diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index b029e5378..d9cb61c13 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -14,7 +14,7 @@ from werkzeug.exceptions import BadRequest import octoprint.plugin import octoprint.util from octoprint.access.permissions import Permissions -from octoprint.server import pluginManager, printer +from octoprint.server import pluginManager, printer, userManager from octoprint.server.api import NO_CONTENT, api from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking from octoprint.settings import settings, valid_boolean_trues @@ -83,11 +83,13 @@ def _etag(lm=None): etag_factory=_etag, lastmodified_factory=_lastmodified, unless=lambda: request.values.get("force", "false") in valid_boolean_trues - or settings().getBoolean(["server", "firstRun"]), + or settings().getBoolean(["server", "firstRun"]) + or not userManager.has_been_customized(), ) def getSettings(): - if not Permissions.SETTINGS_READ.can() and not settings().getBoolean( - ["server", "firstRun"] + if not Permissions.SETTINGS_READ.can() and not ( + settings().getBoolean(["server", "firstRun"]) + or not userManager.has_been_customized() ): abort(403) diff --git a/src/octoprint/server/util/__init__.py b/src/octoprint/server/util/__init__.py index 39585b92c..859eee4d6 100644 --- a/src/octoprint/server/util/__init__.py +++ b/src/octoprint/server/util/__init__.py @@ -113,10 +113,7 @@ def requireLoginRequestHandler(): if _flask.request.endpoint.endswith(".static"): return - if not ( - octoprint.server.userManager.enabled - and octoprint.server.userManager.has_been_customized() - ): + if not octoprint.server.userManager.has_been_customized(): return user = flask_login.current_user @@ -211,11 +208,10 @@ def get_user_for_apikey(apikey): # master key was used return octoprint.server.userManager.api_user_factory() - if octoprint.server.userManager.enabled: - user = octoprint.server.userManager.find_user(apikey=apikey) - if user is not None: - # user key was used - return user + user = octoprint.server.userManager.find_user(apikey=apikey) + if user is not None: + # user key was used + return user apikey_hooks = plugin_manager().get_hooks("octoprint.accesscontrol.keyvalidator") for name, hook in apikey_hooks.items(): @@ -233,9 +229,6 @@ def get_user_for_apikey(apikey): def get_user_for_remote_user_header(request): - if not octoprint.server.userManager.enabled: - return None - if not settings().getBoolean(["accessControl", "trustRemoteUser"]): return None diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 417d88c97..e715f0dec 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -1523,22 +1523,17 @@ def no_firstrun_access(func): If you decorate a view with this, it will ensure that first setup has been done for OctoPrint's Access Control. - If OctoPrint's Access Control has not been setup yet (indicated by the "firstRun" - flag from the settings being set to True and the userManager not indicating - that it's user database has been customized from default), the decorator + If OctoPrint's Access Control has not been setup yet (indicated by the userManager + not reporting that its user database has been customized from default), the decorator will cause a HTTP 403 status code to be returned by the decorated resource. """ @functools.wraps(func) def decorated_view(*args, **kwargs): # if OctoPrint hasn't been set up yet, abort - if ( - settings().getBoolean(["server", "firstRun"]) - and settings().getBoolean(["accessControl", "enabled"]) - and ( - octoprint.server.userManager is None - or not octoprint.server.userManager.has_been_customized() - ) + if settings().getBoolean(["server", "firstRun"]) and ( + octoprint.server.userManager is None + or not octoprint.server.userManager.has_been_customized() ): return flask.make_response("OctoPrint isn't setup yet", 403) return func(*args, **kwargs) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 649351efd..73b1f2f49 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -332,7 +332,6 @@ def index(): if ( request.headers.get("X-Preemptive-Recording", "no") == "no" - and userManager.enabled and userManager.has_been_customized() ): if not _has_permissions(Permissions.STATUS, Permissions.SETTINGS_READ): @@ -376,7 +375,6 @@ def index(): now = datetime.datetime.utcnow() - enable_accesscontrol = userManager.enabled enable_timelapse = settings().getBoolean(["webcam", "timelapseEnabled"]) enable_loading_animation = settings().getBoolean(["devel", "showLoadingAnimation"]) enable_sd_support = settings().get(["feature", "sdSupport"]) @@ -387,19 +385,12 @@ def index(): sockjs_connect_timeout = settings().getInt(["devel", "sockJsConnectTimeout"]) def default_template_filter(template_type, template_key): - if template_type == "navbar": - return template_key != "login" or enable_accesscontrol - elif template_type == "tab": + if template_type == "tab": return template_key != "timelapse" or enable_timelapse - elif template_type == "settings": - return template_key != "accesscontrol" or enable_accesscontrol - elif template_type == "usersettings": - return enable_accesscontrol else: return True default_additional_etag = [ - enable_accesscontrol, enable_timelapse, enable_loading_animation, enable_sd_support, @@ -613,7 +604,7 @@ def index(): ) wizard = wizard_active(filtered_templates) - accesscontrol_active = enable_accesscontrol and userManager.has_been_customized() + accesscontrol_active = userManager.has_been_customized() render_kwargs = _get_render_kwargs( filtered_templates, _plugin_names, _plugin_vars, now @@ -622,7 +613,7 @@ def index(): { "enableWebcam": enable_webcam, "enableTemperatureGraph": enable_temperature_graph, - "enableAccessControl": enable_accesscontrol, + "enableAccessControl": True, "accessControlActive": accesscontrol_active, "enableLoadingAnimation": enable_loading_animation, "enableSdSupport": enable_sd_support, diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index cd27d1cfd..e921d66b9 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -377,7 +377,6 @@ default_settings = { "controls": [], "system": {"actions": []}, "accessControl": { - "enabled": True, "salt": None, "userManager": "octoprint.access.users.FilebasedUserManager", "groupManager": "octoprint.access.groups.FilebasedGroupManager", diff --git a/src/octoprint/static/js/app/viewmodels/loginui.js b/src/octoprint/static/js/app/viewmodels/loginui.js index 579b3d401..667e52a69 100644 --- a/src/octoprint/static/js/app/viewmodels/loginui.js +++ b/src/octoprint/static/js/app/viewmodels/loginui.js @@ -18,10 +18,7 @@ $(function () { self.access.permissions.STATUS, self.access.permissions.SETTINGS_READ ) && - (!CONFIG_FIRST_RUN || - (self.coreWizardAcl && - self.coreWizardAcl.setup() && - self.coreWizardAcl.decision())) + CONFIG_ACCESS_CONTROL_ACTIVE ) { location.reload(); } diff --git a/src/octoprint/static/js/app/viewmodels/wizard.js b/src/octoprint/static/js/app/viewmodels/wizard.js index bc75dd33d..78d79fc43 100644 --- a/src/octoprint/static/js/app/viewmodels/wizard.js +++ b/src/octoprint/static/js/app/viewmodels/wizard.js @@ -20,10 +20,7 @@ $(function () { self.showDialog = function () { if ( !CONFIG_WIZARD || - !( - (CONFIG_FIRST_RUN && !CONFIG_ACCESS_CONTROL_ACTIVE) || - self.loginState.isAdmin() - ) + !(!CONFIG_ACCESS_CONTROL_ACTIVE || self.loginState.isAdmin()) ) return; diff --git a/src/octoprint/templates/initscript.jinja2 b/src/octoprint/templates/initscript.jinja2 index 7593db69a..af53c6373 100644 --- a/src/octoprint/templates/initscript.jinja2 +++ b/src/octoprint/templates/initscript.jinja2 @@ -12,7 +12,7 @@ var CONFIG_USERSPERPAGE = 10; var CONFIG_GROUPSPERPAGE = 10; var CONFIG_WEBCAM_STREAM = "{{ webcamStream|e }}"; // deprecated, only left for compatibility reasons - var CONFIG_ACCESS_CONTROL = {% if enableAccessControl -%} true; {% else %} false; {%- endif %} + var CONFIG_ACCESS_CONTROL = true; // deprecated, only left for compatibility reasons var CONFIG_ACCESS_CONTROL_ACTIVE = {% if accessControlActive -%} true; {% else %} false; {%- endif %} var CONFIG_SD_SUPPORT = {% if enableSdSupport -%} true; {% else %} false; {%- endif %} var CONFIG_FIRST_RUN = {% if firstRun -%} true; {% else %} false; {%- endif %}