Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. proxyAuth addon

proxyAuth addon

Scheduled Pinned Locked Moved App Packaging & Development
54 Posts 15 Posters 10.4k Views 15 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mehdiM mehdi

    @girish I think the best would be to have the path in proxyAuth be an array, where given paths can be either positive or negative. It's the way things like .gitignore work.

    For example, in this case, it would be:

    {
      "proxyAuth": [
        "/",
        "!/webbooks/"
      ]
    }
    
    T Offline
    T Offline
    thetomester13
    App Dev
    wrote on last edited by
    #31

    @mehdi I like this solution and its flexibility. It could also be backwards compatible with the currently version - if no paths are specified, everything is auth'ed.

    1 Reply Last reply
    1
    • jimcavoliJ Offline
      jimcavoliJ Offline
      jimcavoli
      App Dev
      wrote on last edited by
      #32

      Agree on the default behavior - I imagine it's unlikely that anything more specific than path-level exceptions are unlikely. Perhaps as an extension to the solution that @mehdi suggests, we could extend the existing format of:

      {
        "proxyAuth": {
          "path": "/admin" 
        }
      }
      

      To take exceptions:

      {
        "proxyAuth": {
          "path": "/admin" ,
          "exclude": [
            "/webhook",
            "/
          ]
        }
      }
      

      Or with probably over-the-top features, make everything a map of path and exception(s):

      {
        "proxyAuth": {
          "paths": {
            "/" : [
              "/webhook",
              "/public"
            ],
            "/admin": []
          }
        }
      }
      

      Honestly, I appreciate the minimal-first approach, and I think the middle option of adding a (understood to be auto-wildcarded) array of exclusions is the easier next step. I can't imagine anything that would need the super-complex variant would be something that would or should rely on such a mechanism to secure it.

      girishG 1 Reply Last reply
      0
      • girishG girish

        Back in the day, we had an "oauth proxy" for apps that didn't support any authentication to put up an auth wall. This was brought up https://forum.cloudron.io/topic/1451/alternative-to-oauth-proxy . We removed that proxy when we removed OAuth support altogether.

        Recently, there is a bunch of apps that require an auth wall including:

        • Prometheus server/alert manager
        • Cloud torrent
        • Transmission
        • Apps like surfer
        • Many of our internal apps

        I have put in this "proxy auth" feature in Cloudron 6. Just have to add it to addons in the manifest like:

        "addons": {
            "proxyAuth": {}
        }
        

        Just like the ldap addon, user can then select which users/groups can authenticate. If the manifest also has optionalSso, then user can choose to let the app have no auth wall altogether.

        When using this feature, two routes are "reserved" - /login and /logout. Some benefits of having this on the platform side (as opposed in the app are):

        • 2FA login
        • Session management in the user's profile page. i.e can logout from apps etc
        • Easier for us to maintain this feature. Currently, this feature has already been re-implemented in the apps using 3 different stacks - nginx/apache/node...

        I took a lot of inspiration from https://github.com/andygock/auth-server and @mehdi's transmission code. So, big thanks to them!

        njN Offline
        njN Offline
        nj
        wrote on last edited by
        #33

        @girish I don't see the 2FA code prompt on the login page of Simple Torrent. Am I missing something?

        Some benefits of having this on the platform side (as opposed in the app are):

        • 2FA login

        Founder / Coder • My Apps

        mehdiM 1 Reply Last reply
        0
        • njN nj

          @girish I don't see the 2FA code prompt on the login page of Simple Torrent. Am I missing something?

          Some benefits of having this on the platform side (as opposed in the app are):

          • 2FA login
          mehdiM Offline
          mehdiM Offline
          mehdi
          App Dev
          wrote on last edited by
          #34

          @nj I don't think this is implemented either:

          • Session management in the user's profile page. i.e can logout from apps etc

          I think @girish just meant that it would be possible to implement this in the future, not that it would be in the first version of proxyAuth.

          1 Reply Last reply
          0
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #35

            @nj I have logged it here - https://git.cloudron.io/cloudron/box/-/issues/748 . As @mehdi said, it wasn't implemented as part of the first iteration of proxyAuth.

            1 Reply Last reply
            0
            • jimcavoliJ jimcavoli

              Agree on the default behavior - I imagine it's unlikely that anything more specific than path-level exceptions are unlikely. Perhaps as an extension to the solution that @mehdi suggests, we could extend the existing format of:

              {
                "proxyAuth": {
                  "path": "/admin" 
                }
              }
              

              To take exceptions:

              {
                "proxyAuth": {
                  "path": "/admin" ,
                  "exclude": [
                    "/webhook",
                    "/
                  ]
                }
              }
              

              Or with probably over-the-top features, make everything a map of path and exception(s):

              {
                "proxyAuth": {
                  "paths": {
                    "/" : [
                      "/webhook",
                      "/public"
                    ],
                    "/admin": []
                  }
                }
              }
              

              Honestly, I appreciate the minimal-first approach, and I think the middle option of adding a (understood to be auto-wildcarded) array of exclusions is the easier next step. I can't imagine anything that would need the super-complex variant would be something that would or should rely on such a mechanism to secure it.

              girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #36

              @jimcavoli Shall I go with path: "!/webhooks" for now? Will this be enough for n8n ?

              jimcavoliJ 1 Reply Last reply
              0
              • girishG girish

                @jimcavoli Shall I go with path: "!/webhooks" for now? Will this be enough for n8n ?

                jimcavoliJ Offline
                jimcavoliJ Offline
                jimcavoli
                App Dev
                wrote on last edited by
                #37

                @girish Yeah, that would be enough for n8n I think, though if we're going to go that route, I think making paths an array of either path(s) and/or ! paths makes the most sense in general (at least somehow providing for the option of multiple excluded paths)

                girishG 1 Reply Last reply
                0
                • jimcavoliJ jimcavoli

                  @girish Yeah, that would be enough for n8n I think, though if we're going to go that route, I think making paths an array of either path(s) and/or ! paths makes the most sense in general (at least somehow providing for the option of multiple excluded paths)

                  girishG Offline
                  girishG Offline
                  girish
                  Staff
                  wrote on last edited by
                  #38

                  @jimcavoli won't having it plural cause some confusing semantics if you mix ! and no ! paths ? Let me think 🤔

                  mehdiM saikarthikS 2 Replies Last reply
                  0
                  • girishG girish

                    @jimcavoli won't having it plural cause some confusing semantics if you mix ! and no ! paths ? Let me think 🤔

                    mehdiM Offline
                    mehdiM Offline
                    mehdi
                    App Dev
                    wrote on last edited by
                    #39

                    @girish It works for .gitignore files 🤷

                    girishG 1 Reply Last reply
                    1
                    • mehdiM mehdi

                      @girish It works for .gitignore files 🤷

                      girishG Offline
                      girishG Offline
                      girish
                      Staff
                      wrote on last edited by
                      #40

                      @mehdi great point. I can copy what they do.

                      murgeroM 1 Reply Last reply
                      1
                      • girishG girish

                        @mehdi great point. I can copy what they do.

                        murgeroM Offline
                        murgeroM Offline
                        murgero
                        App Dev
                        wrote on last edited by murgero
                        #41

                        @girish Currently I have an app that this does not work on - is there something special I need to do in the app beyond adding the addon to the addon list?

                        Edit: I am blind I swear - just formatted the JSON incorrectly for the manifest.

                        --
                        https://urgero.org
                        ~ Professional Nerd. Freelance Programmer. ~

                        1 Reply Last reply
                        1
                        • girishG girish

                          @jimcavoli won't having it plural cause some confusing semantics if you mix ! and no ! paths ? Let me think 🤔

                          saikarthikS Offline
                          saikarthikS Offline
                          saikarthik
                          wrote on last edited by
                          #42

                          @girish Hi Girish, what is the status of this? selectively exposing certain paths to public?

                          mehdiM 1 Reply Last reply
                          0
                          • saikarthikS saikarthik

                            @girish Hi Girish, what is the status of this? selectively exposing certain paths to public?

                            mehdiM Offline
                            mehdiM Offline
                            mehdi
                            App Dev
                            wrote on last edited by
                            #43

                            @saikarthik Girish answered here : https://forum.cloudron.io/post/23886

                            Yes, proxyAuth exclusion is implemented. I only implemented a simple approach with a ! pattern for now (not an array).

                            1 Reply Last reply
                            1
                            • H Offline
                              H Offline
                              hendrikvl
                              wrote on last edited by
                              #44

                              I have a question regarding the proxyAuth addon: If I understand it correctly, it has to added to the manifest file and therefore is only suitable for custom apps. How about an option to enable it for apps that have built-in authentication as well?

                              In my case, I would like to hide the public site of an Shaarli-instance behind the proxyAuth login. Such that authenticated users can browse the public page and I can additionally login using the builtin auth as admin.
                              I know, that this usecase is somewhat specific and customary, but it is just meant as an example of possible use cases for an proxyAuth-option with the standard apps.

                              mehdiM girishG 2 Replies Last reply
                              0
                              • H hendrikvl

                                I have a question regarding the proxyAuth addon: If I understand it correctly, it has to added to the manifest file and therefore is only suitable for custom apps. How about an option to enable it for apps that have built-in authentication as well?

                                In my case, I would like to hide the public site of an Shaarli-instance behind the proxyAuth login. Such that authenticated users can browse the public page and I can additionally login using the builtin auth as admin.
                                I know, that this usecase is somewhat specific and customary, but it is just meant as an example of possible use cases for an proxyAuth-option with the standard apps.

                                mehdiM Offline
                                mehdiM Offline
                                mehdi
                                App Dev
                                wrote on last edited by
                                #45

                                @hendrikvl I don't use Shaarli, so I don't know about it very well, but in my opinion, the clean way to do this would be to request the upstream project (Shaarli) to allow an option to protect stuff behind its own auth wall, and have 2 types of users, normal & admin. It seems "hacky" to me to solve this usecase with Cloudron's proxyAuth

                                1 Reply Last reply
                                2
                                • H hendrikvl

                                  I have a question regarding the proxyAuth addon: If I understand it correctly, it has to added to the manifest file and therefore is only suitable for custom apps. How about an option to enable it for apps that have built-in authentication as well?

                                  In my case, I would like to hide the public site of an Shaarli-instance behind the proxyAuth login. Such that authenticated users can browse the public page and I can additionally login using the builtin auth as admin.
                                  I know, that this usecase is somewhat specific and customary, but it is just meant as an example of possible use cases for an proxyAuth-option with the standard apps.

                                  girishG Offline
                                  girishG Offline
                                  girish
                                  Staff
                                  wrote on last edited by
                                  #46

                                  @hendrikvl Currently, proxyAuth is designed for cases where the app has no user management at all. I think if an app already has user support like shaarli, it's best to ask the upstream project to password protect the public page as @mehdi suggests. BTW, if you post a request upstream, please do post the link here.

                                  murgeroM H 2 Replies Last reply
                                  1
                                  • girishG girish

                                    @hendrikvl Currently, proxyAuth is designed for cases where the app has no user management at all. I think if an app already has user support like shaarli, it's best to ask the upstream project to password protect the public page as @mehdi suggests. BTW, if you post a request upstream, please do post the link here.

                                    murgeroM Offline
                                    murgeroM Offline
                                    murgero
                                    App Dev
                                    wrote on last edited by
                                    #47

                                    @girish This plugin works amazing on my alpha build of code-server. Works like a treat.

                                    --
                                    https://urgero.org
                                    ~ Professional Nerd. Freelance Programmer. ~

                                    1 Reply Last reply
                                    3
                                    • girishG girish

                                      @hendrikvl Currently, proxyAuth is designed for cases where the app has no user management at all. I think if an app already has user support like shaarli, it's best to ask the upstream project to password protect the public page as @mehdi suggests. BTW, if you post a request upstream, please do post the link here.

                                      H Offline
                                      H Offline
                                      hendrikvl
                                      wrote on last edited by
                                      #48

                                      @girish @mehdi Thanks for your replies. Since Shaarli is designed as a single-user application, I don't see much chances of getting LDAP integration implemented for the public page.
                                      But you're of course right, that my proposal for the Shaarli public page is a bit "hacky". It was rather meant as an example of what a dynamic proxyAuth-option could be used for. My thought was, that others might have a need for such an option in similar situations as well.

                                      1 Reply Last reply
                                      0
                                      • infogulchI Offline
                                        infogulchI Offline
                                        infogulch
                                        wrote on last edited by infogulch
                                        #49

                                        I think it would be nice if more apps supported the option to switch to proxyAuth+X-REMOTE-USER-based authentication for multi-user apps. I prefer proxy-based auth for a couple reasons:

                                        • I don't trust the login page and password handling to apps. Even if they auth via ldap -- they're still touching the password. Proxy auth eliminates this problem altogether, since they only receive the attestation of the user's identity (the header), no secrets, no cookies. I trust the proxy's auth login page way more.
                                        • Ideally the app is never even accessible to the outside world until you're logged in. Apps often have vulnerabilities that can expose data even if you're not logged in. By putting the app behind an authenticating proxy, one can shield it from general internet access, narrowing the scope of attackers from "everyone that can access my ip" to "users on my cloudron" -- a large improvement.
                                        • It's by far the easiest auth system to implement first if you write something custom.

                                        Of course, all apps may not support this yet, and sometimes you do want a public-facing service, and some apps could never work like this (bitwarden), etc, hence "optional".

                                        mehdiM 1 Reply Last reply
                                        1
                                        • infogulchI infogulch

                                          I think it would be nice if more apps supported the option to switch to proxyAuth+X-REMOTE-USER-based authentication for multi-user apps. I prefer proxy-based auth for a couple reasons:

                                          • I don't trust the login page and password handling to apps. Even if they auth via ldap -- they're still touching the password. Proxy auth eliminates this problem altogether, since they only receive the attestation of the user's identity (the header), no secrets, no cookies. I trust the proxy's auth login page way more.
                                          • Ideally the app is never even accessible to the outside world until you're logged in. Apps often have vulnerabilities that can expose data even if you're not logged in. By putting the app behind an authenticating proxy, one can shield it from general internet access, narrowing the scope of attackers from "everyone that can access my ip" to "users on my cloudron" -- a large improvement.
                                          • It's by far the easiest auth system to implement first if you write something custom.

                                          Of course, all apps may not support this yet, and sometimes you do want a public-facing service, and some apps could never work like this (bitwarden), etc, hence "optional".

                                          mehdiM Offline
                                          mehdiM Offline
                                          mehdi
                                          App Dev
                                          wrote on last edited by
                                          #50

                                          @infogulch said in proxyAuth addon:

                                          It's by far the easiest auth system to implement first if you write something custom.

                                          I don't think it is.

                                          Cloudron used to have something very similar (in usage, if not technologically), using OAuth. They decided to drop it, because almost no apps supported it.

                                          What you are describing would be indeed quite interesting, but more or less custom to cloudron : i think this would be even more difficult to convince upstream devs to implement, because it's so custom.

                                          Do you know of any apps that currently support a similar thing ?

                                          infogulchI 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Bookmarks
                                          • Search