saltyorg / Saltbox

Ansible-based solution for rapidly deploying a Docker containerized cloud media server.
https://docs.saltbox.dev
GNU General Public License v3.0
571 stars 65 forks source link

Feat: Set External Auth for Sonarr v4 #117

Closed JigSawFr closed 8 months ago

JigSawFr commented 1 year ago

For Sonarr role:

IF

  1. sonarr_docker_image_tag is set to v4
  2. sonarr_traefik_sso_middleware is set to Authelia default SSO

Execute a subtask to set AuthMethod to <AuthenticationMethod>External</AuthenticationMethod>

Cf. https://wiki.servarr.com/sonarr/faq-v4#can-i-disable-forced-authentication

JigSawFr commented 1 year ago

Need also to set <UrlBase></UrlBase>

owine commented 1 year ago

Can potentially apply similar logic to other arr apps

An alternative (this is what I currently use) would be to provision a middleware to inject basic auth credentials and apply to the arr containers

JigSawFr commented 1 year ago

Can potentially apply similar logic to other arr apps

An alternative (this is what I currently use) would be to provision a middleware to inject basic auth credentials and apply to the arr containers

Yep, was doing it until now, prefer to use it on my side in last resort. As they offer external choice, it is better if you use health check for e.g. (And avoid multiple BA failures in logs :>)

But yeah there is other's vars that we can automate :)

saltydk commented 1 year ago

Do we really need to touch existing setups?

JigSawFr commented 1 year ago

Do we really need to touch existing setups?

I see it as an improvement only

saltydk commented 1 year ago

Well, I'd be against merging checks against user inventory edits. If this needs to be a thing then wait until v4 is the standard version.

owine commented 1 year ago

This is coming to Prowlarr stable soon fyi

JigSawFr commented 1 year ago

This is coming to Prowlarr stable soon fyi

Thanks for info !

saltydk commented 1 year ago

Need also to set <UrlBase></UrlBase>

That is the default so not sure why this is mentioned.

saltydk commented 1 year ago

So maybe something like


- name: Lookup AuthenticationMethod value
  community.general.xml:
    path: "/opt/{{ prowlarr_name }}/config.xml"
    xpath: "/Config/AuthenticationMethod"
    content: "text"
  register: xmlresp

- name: Toggle AuthenticationMethod to External
  block:
    - name: Remove the 'subjective' attribute of the 'rating' element
      community.general.xml:
        path: "/opt/{{ prowlarr_name }}/config.xml"
        xpath: "/Config/AuthenticationMethod"
        value: "External"

    - name: Restart Docker container
      ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/restart_docker_container.yml"

  when: ((xmlresp.matches[0].AuthenticationMethod is defined) and (xmlresp.matches[0].AuthenticationMethod != 'External'))```
JigSawFr commented 1 year ago

@saltydk yes, maybe we can add also another condition to check if sso middleware is defined to authelia, so we can keep initial behavior in case of ?

saltydk commented 1 year ago

I'd just have that in the include of the subtask

JigSawFr commented 1 year ago

Need also to set <UrlBase></UrlBase>

That is the default so not sure why this is mentioned.

Not sure how it's used in these programs, but in case of to avoid future problems ? At the moment it's working as expected without editing it.

saltydk commented 1 year ago

They won't set a UrlBase for you so don't worry about it.

saltydk commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

saltydk commented 1 year ago

https://github.com/saltyorg/Saltbox/commit/a8571593f49a2d442e96da6a7fed5b6eb59b4873