diff --git a/docs/features/accesscontrol.rst b/docs/features/accesscontrol.rst index f932002e3..23bf90b75 100644 --- a/docs/features/accesscontrol.rst +++ b/docs/features/accesscontrol.rst @@ -18,14 +18,15 @@ users out of the box. webcam URL, they will thus be able to see it. Upon first start a configuration wizard is provided which allows configuration -of the first administrator account to be used for OctoPrint. After initial setup, -you can then create more users under Settings > Access Control for customisation of -the granular permission system. +of the first administrator account to be used for OctoPrint. After initial setup, +you can then create more users and groups under Settings > Access Control for +customisation of the granular permission system. -The predefined Guest group can be used to configure default permissions of anonymous -users, that is those who have not logged in. By default, no permissions are granted to these users. +The predefined "Guests" group can be used to configure default permissions of anonymous +users, that is those who have not logged in. By default, no permissions are granted to +these users. -A predefined Read-only Access group with no users is configured which grants +A predefined "Read-only Access" group with no users is configured which by default grants read-only access to the following parts of the UI to any users assigned to this group: * printer state @@ -38,13 +39,13 @@ read-only access to the following parts of the UI to any users assigned to this * any components provided through plugins which are enabled for anonymous users -Logged in users without admin flag will be allowed to access everything besides the -Settings and System Commands, which are admin-only. +Another predefined "Operator" group is the default group for newly created users and +by default gives access to all aspects of OctoPrint that involve regular printer +operation. It matches the old "user" role from OctoPrint prior to 1.4.0. -Upon first start a configuration wizard is provided which allows configuration -of the first administrator account to be used for OctoPrint. After initial setup, -you can then create more users under Settings > Access Control for customisation of -the granular permission system. +Finally, the predefined "Admins" group gives full admin access to the platform. You should +be careful of who you put into that. It matches the old "admin" role from OctoPrint prior +to 1.4.0. .. hint:: @@ -59,8 +60,175 @@ the granular permission system. publicly reachable by everyone with an internet connection, even with access control enabled. -.. _sec-features-access_control-hooks: +.. _sec-features-access_control-autologin: +Autologin +--------- + +While access control cannot be disabled as of OctoPrint 1.5+, the Autologin feature can +be used to bypass authentication for hosts on the network(s) that you trust. + +Starting with OctoPrint 1.5.0, OctoPrint makes enabled access control mandatory. This +might be an inconvience for some who run OctoPrint in an isolated setup where a login is +not required to ensure security, at a benefit for a huge number of users out there who +continue to underestimate or simply ignore the risk of keeping their OctoPrint instance +unsecured and then happily exposing it on the public internet. + +That being said, even as far back as OctoPrint 1.0.0 (released in 2013) there has existed +a way to have OctoPrint automatically log you in, if you connect from a trusted local +network address. This functionality has not been exposed on the UI, and for now also won't +be (to make it a bit harder to once again create an insecure setup for those who simply +won't listen to common sense), but it's easy to set up with a bit of configuration +editing. + +When set up properly, it will make sure to automatically log you in as a configured user +whenever you connect from a device on your local network. To get back pretty much the same +behaviour as with disabled access control, you'll only need to create a single (admin) +account and then set up autologin for it. + + +.. warning:: + + **Do not do this if you cannot trust EVERYONE on your local network.** And that really + means mean everyone. If you ignore this and then someone takes over your OctoPrint + instance, installs malware on it and makes your printer print an endless stream of + benchies, that's on you. + +.. _sec-features-access_control-autologin-gather_config_info: + +Gather configuration information +................................ + +You can configure Autologin via a plugin (the easy way), or manually (the hard way), but +in either case you will need to specify which user should be automatically logged in, and +which hosts are permitted access this way. + +**Improperly setting this subnet option can lead to the compromise of your system, or even +your entire network. Proceed with extreme caution.** + +The subnet to use is usually the IP address range of your LAN, which sounds scary but +actually isn't. Just `figure out your PC's IP address and subnet mask `_ +and then combine both with a / in between. + +On OctoPi (or another Linux distribution) you can use the follwing command: + +.. code-block:: + + ip route | grep -P 'eth0|wlan0' | awk '{print $1}' + +Or, for IPv6, use this: + +.. code-block:: + + ip -6 route | grep -P 'eth0|wlan0' | awk '{print $1}' + +This will be what you set as the subnet in the plugin, or where it says +```` below on the manual configuration instructions. + +Example: Your PC has an IP address of ``192.168.23.42`` and a subnet mask of +``255.255.255.0``. Your address range is ``192.168.23.42/255.255.255.0``. + +.. _sec-features-access_control-autologin-plugin: + +The easy way: Using the OctoPrint-AutoLoginConfig plugin +........................................................ + +The easist way to configure AutoLogin is to install the +`OctoPrint-AutoLoginConfig plugin `_ +via the plugin manager. + +Open its settings and follow the instructions on the screen. + +.. _sec-features-access_control-autologin-manual: + +The hard way: Manual editing of config.yaml +........................................... + +Preparation +*********** + +First of all, read :ref:`the YAML primer `. You +will have to edit OctoPrint's main configuration file, and thus should make sure +you understand at least roughly how things work and that you should keep your +hands off the Tab key. If you don't, you might break your config file, and +while the steps include making a backup, this still can be easily avoided by +learning about the DOs and DONTs first. + +Then, take a look at :ref:`the docs on config.yaml ` +on where to find that central configuration file of OctoPrint. + +Configuration +************* + +Ready? Let's do some editing then. I'll outline what to do and where first, and then +further down there's also a dedicated list of steps for OctoPi specifically. + +1. Shutdown OctoPrint +2. Make a backup of your config.yaml +3. Open it in a text editor (e.g. nano). Right at the very top it'll say something like + this: + + .. code-block:: yaml + + accessControl: + salt: aabbccddee1234523452345 + + Edit this, adding lines so it looks like this (making absolutely sure not to touch the + salt line): + + .. code-block:: yaml + accessControl: + salt: aabbccddee1234523452345 + autologinLocal: true + autologinAs: "" + localNetworks: + - "127.0.0.0/8" + - "" + +4. Restart OctoPrint, check that everything works. + +This will automatically log you in as the user you specified whenver you connect to +OctoPrint from an address in the address range (e.g. a device on your local network). + +OctoPi specific steps +********************* + +If you are running OctoPi you will have to SSH into your Raspberry Pi. Then issue +the following commands: + +1. ``sudo service octoprint stop`` +2. ``cp ~/.octoprint/config.yaml ~/.octoprint/config.yaml.back`` +3. ``nano ~/.octoprint/config.yaml, make the edits as described above`` +4. ``sudo service octoprint start`` + +If something went wrong, you can restore the config backup with + +.. code-block:: + + cp ~/.octoprint/config.yaml.back ~/.octoprint/config.yaml + + +If you are using a VPN and your setup ABSOLUTELY REQUIRES disabling internal OctoPrint access controls +...................................................................................................... + +.. warning:: + + You probably shouldn't do this, EVER. There are usually other options. Don't even + THINK about it, unless you have a VPN layer for security. Only consider proceeding + with this configuration after exhausting ALL other possibilities, and even then, you + should think long and hard about whether this is a good idea. You almost certainly + don't need or want to do this. + +While access controls can no longer be disabled in OctoPrint 1.5+, this can be +approximated by an Autologin configuration that automatically logs in all users, that is +by using subnets that match all possible IP addresses. By specifying the ``0.0.0.0/0`` +subnet (for IPv4) and ``::/0`` for IPv6 in the AutoLogin configuration, you can achieve +this. This configuration is permitted, but highly, highly discouraged. + +Please don't do this. You will almost certainly regret it. You alone are responsible for +your actions. + +.. _sec-features-access_control-hooks: Available Extension Hooks ------------------------- @@ -78,125 +246,7 @@ See :ref:`here `. .. _sec-features-access_control-hooks-loginui: -octoprint.plugin.loginui.theming -................................ - -See :ref:`here `. - - -Autologin -------------------------- - -While access control cannot be disabled as of OctoPrint 1.5+, the Autologin feature can be used to -bypass authentication for hosts on the network(s) that you trust. - -Starting with OctoPrint 1.5.0, OctoPrint makes enabled access control mandatory. This might be an inconvience for some who run OctoPrint in an isolated setup where a login is not required to ensure security, at a benefit for a huge number of users out there who continue to underestimate or simply ignore the risk of keeping their OctoPrint instance unsecured and then happily exposing it on the public internet. And frankly, it will also make me sleep better at night. - -That being said, even as far back as OctoPrint 1.0.0 (released in 2013) there has existed a way to have OctoPrint automatically log you in, if you connect from a trusted local network address. This functionality has not been exposed on the UI, and for now also won't be (to make it a bit harder to once again create an insecure setup for those who simply won't listen to common sense), but it's easy to set up with a bit of configuration editing. - -When set up properly, it will make sure to automatically log you in as a configured user whenever you connect from a device on your local network. To get back pretty much the same behaviour as with disabled access control, you'll only need to create a single (admin) account and then set up autologin for it. - - -.. warning:: - - **Do not do this if you cannot trust EVERYONE on your local network.** And I really mean everyone. If you ignore this and then someone takes over your OctoPrint instance, installs malware on it and makes your printer print an endless stream of benchies, that's on you. - - -Gather configuraiton information -............................ - -You can configure Autologin via a plugin (the easy way), or manually (the hard way), but in either case you will need to specify which user should be automatically logged in, and which hosts are permitted access this way. - -**Improperly setting this subnet option can lead to the compromise of your system, or even your entire network. Proceed with extreme caution.** - -The subnet to use is usually the IP address range of your LAN, which sounds scary but actually isn't. Just `figure out your PC's IP address and subnet mask ` and then combine both with a / in between. - -On OctoPi (or another Linux distribution) you can use the follwing command: - -.. code-block:: - ip route | grep -P 'eth0|wlan0' | awk '{print $1}' - -Or, for IPv6, use this: - -.. code-block:: - ip -6 route | grep -P 'eth0|wlan0' | awk '{print $1}' - -This will be what you set as the subnet in the plugin, or where it says below om the manual configuration instructions - -E.g.: Your PC has an IP address of ``192.168.23.42`` and a subnet mask of ``255.255.255.0.`` Your address range is ``192.168.23.42/255.255.255.0.`` - - -The easy way: Using the OctoPrint-AutoLoginConfig plugin -............................ - -The easist way to configure AutoLogin is to install the `OctoPrint-AutoLoginConfig ` plugin via the plugin manager. - -Open its settings and follow the instructions on the screen. - -The hard way: Manual editing of config.yaml -............................ - -**Preparation** - -First of all, read `the YAML primer in the docs, please. ` You will have to edit OctoPrint's main configuration file, and thus should make sure you understand at least roughly how things work and that you should keep your hands off the Tab key. If you don't, you might break your config file, and while I'll tell you to make a backup, this still can be easily avoided by educating yourself on the DOs and DONTs first. - -Then, take a look at `the docs on config.yaml ` and where to find that central configuration file of OctoPrint: - -.. code-block:: - If not specified via the command line, the main configuration file config.yaml for OctoPrint is expected in its settings folder, which unless defined differently via the command line is located at ~/.octoprint on Linux, at %APPDATA%/OctoPrint on Windows and at ~/Library/Application Support/OctoPrint on macOS. - - -**Configuration** - - -Ready? Let's do some editing then. I'll outline what to do and where first, and then further down there's also a dedicated list of steps for OctoPi specifically. - -1. Shutdown OctoPrint -2. Make a backup of your config.yaml -3. Open it in a text editor (e.g. nano). Right at the very top it'll say something like this: -.. code-block:: - accessControl: - salt: aabbccddee1234523452345 - -Edit this, adding lines so it looks like this (making absolutely sure not to touch the salt line): -.. code-block:: - accessControl: - salt: aabbccddee1234523452345 - autologinLocal: true - autologinAs: "" - localNetworks: - - "127.0.0.0/8" - - "" - -4. Restart OctoPrint, check that everything works. - -This will automatically log you in as the user you specified whenver you connect to OctoPrint from an address in the address range (e.g. a device on your local network). - - -**OctoPi specific steps** - -If you are running OctoPi you will have to SSH into your Raspberry Pi (username: pi, default password: raspberry, but you hopefully changed that - if not, do so right away please via sudo raspi-config!). Then: - -1. ``sudo service octoprint stop`` -2. ``cp ~/.octoprint/config.yaml ~/.octoprint/config.yaml.back`` -3. ``nano ~/.octoprint/config.yaml, make the edits as described above`` -4. ``sudo service octoprint start`` - -If something went wrong, you can restore the config backup with -.. code-block:: - cp ~/.octoprint/config.yaml.back ~/.octoprint/config.yaml - - -If you are using a VPN and your setup ABSOLUTELY REQUIRES disabling internal OcotPrint access controls -............................ - -.. warning:: - - **You probably shouldn't do this, EVER. There are usually other options. Don't even THINK about it, unless you have a VPN layer for security. Only consider proceeding with this configuration after exhausting ALL other possibilities, and even then, you should think long and hard about whether this is a good idea. You almost certainly don't need or want to do this.** - - -While access controls can no longer be disabled in OctoPrint 1.5+, this can be approximated by an Autologin configuration that automatically logs in all users, that is by using subnets that match all possible IP addresses. By specifying the `0.0.0.0/0` subnet (for IPv4) and `::/0` for IPv6 in the AutoLogin configuration, you can achieve this. This configuration is permitted, but highly, highly discouraged. - -Please don't do this. You will almost certainly regret it. - +octoprint.theming.login +....................... +See :ref:`here `.