Hello fellow selfhoster! on my debian server I use Caddy as reverse proxy, and would like to protect some services and files with a password. I would like, however, to be able to access some protected files programmatically, from a script. using Caddy’s built-in basic_auth works as intended, but I’d like to be able to use a login form instead of just a browser prompt. This is AFAIK not possible, so I’m looking for alternatives. Any idea?

  • notquitenothing@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    12
    ·
    edit-2
    4 days ago

    Developer of VoidAuth here, you could give that a try! If you have any issues or questions I can help :) VoidAuth

    It does support basic_auth to ProxyAuth protected domains, so you can set up a user for that purpose. Docs for that are here: ProxyAuth

    • tubbadu@lemmy.kde.socialOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      This looks very interesting! I see that it supports users groups, would it be possible to create “named access policies” (like “admin_only_policy”, “group_XXX_policy” ecc) and then assign them to the various services directly in the Caddyfile? thank you very much!

      • notquitenothing@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        3 days ago

        I don’t think you could do that directly in the Caddyfile, but you can create those groups/policies inside VoidAuth and assign them to users there.

        The steps would be to (in VoidAuth) create the access group/policy, create the ProxyAuth Domain (protected.example.com/*) with the allowed group(s), make sure the user(s) have that group, then in Caddy add the forward_auth directive to the same route you want to protect.

        Then when you go to access that route in a browser it will redirect you to VoidAuth login, or if you pass an Authentication header with Basic Auth (like when using an API) it will use that.