Skip to content

Sign out Link with Reverse Proxy & SSO #1401

@luckylinux

Description

@luckylinux

Is there an existing issue for this?

  • I have searched the existing open and closed issues

Is your feature request related to a problem? Please describe

The Sign-Out Link could be improved.

On one Hand, if Authentication is disabled, then the Sign Out Link should not be shown at all (right now it is shown anyways).

On the other Hand, since I just implemented Reverse Proxy SSO with Authentik Proxy Outpost, having the Sign Out Link pointing to the correct Target would be way better 😉.

As it is right now, nothing Happens (obviously) when I click it, since I am NOT authenticated via NetAlertX itself.

I'll do a PR for the Documentation on how to setup Caddy Reverse Proxy + Authentik Outpost Proxy SSO soon 😉.

Describe the solution you'd like

I don't want to mess too much of your Code and in particular the Application Settings for app.conf I would prefer that implement the Change @jokob-sk, because I think there are also quite a few Tests & some JSON Files to adjust correctly.

This is the Relevant Part in front/php/templates/header.php at https://github.com/jokob-sk/NetAlertX/blob/main/front/php/templates/header.php#L255:

<li class="user-footer">
    <div class="pull-right">
        <a href="index.php?action=logout" class="btn btn-danger"><?= lang('About_Exit');?></a>
    </div>
</li>

I would suggest to use a Variable called SETPWD_SIGNOUT_LINK_TARGET (or something along those Lines, please feel free to come up with a better Name 😉) with the following Logic (pseudo-Code):

if SETPWD_enable_password is True:
    # Password Authentication is enabled
    # Keep the Sign-Out Link as it is
    signout_link = "index.php?action=logout"

else:
    # Password Authentication is disabled
    # Either we don't have any Authentication at all or we use SSO
    # Alternatively if no signout Target is Set we could consider just aborting everything since it's completely unsafe ? Could be a startup self-test.

    if SETPWD_SIGNOUT_LINK_TARGET == "":
        # Authentication is disabled for Real
        # Don't even show the Button
        signout_link = ""
    else:
        # Authentication is disabled but we configured SSO so we use that Sign-Out Link instead
        signout_link = SETPWD_SIGNOUT_LINK_TARGET

I would set (for Authentik SSO with Authentik Outpost Proxy):

SETPWD_SIGNOUT_LINK_TARGET = "https://netalertx.MYDOMAIN.TLD/outpost.goauthentik.io/sign_out"

Then in the Template (pseudo-Code) basically decide whether to show the Sign-Out Button or not:

{% if signout_link != "" %}
              <li class="user-footer">
                <div class="pull-right">
                  <a href="{{signout_link}}" class="btn btn-danger"><?= lang('About_Exit');?></a>
                </div>
              </li>
{% endif %}

Describe alternatives you've considered

If could also be possible to implement a Select-Box with something along the Lines of a SIGNIN_TYPE with Possible Values:

  • (None)
  • Built-In
  • Authentik SSO

And then do the Logic on the Server-Side. Basically just give an Option to select the Type of Login / Authentication, but implement the URLs in the Code.

This would however be less flexible and require updates & newer Entries if new SSO Providers are added.

Anything else?

I can help with the Documentation to setup Reverse Proxy + SSO (Authentik Proxy Outpost is by far the easiest in my Experience).

Basically I just need to take my compose.yml Files (I'll provide also Podman Quadlets as an alternative), .env* Files, Caddyfile and redact some of the Information, plus obviously provide some Screenshots.

Am I willing to test this? 🧪

  • I will do my best to test this feature on the netlertx-dev image when requested within 48h and report bugs to help deliver a great user experience for everyone and not to break existing installations.

Can I help implement this? 👩‍💻👨‍💻

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions