Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line authentication providers not working meta #130766

Open
avbor opened this issue Nov 16, 2024 · 1 comment
Open

Command line authentication providers not working meta #130766

avbor opened this issue Nov 16, 2024 · 1 comment

Comments

@avbor
Copy link

avbor commented Nov 16, 2024

The problem

If the authentication provider configuration for "command line" is set to "meta: true", then when the script is called, the user account is not filled in with additional data such as "group" and "local_only", but the name is filled in correctly. No errors were found in the logs. The values are printed in stdout one after another like this:

name = Alexander Borisov
group = system-admin
local_only = true

image

What version of Home Assistant Core has the issue?

2024.11.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

core

Link to integration documentation on our website

No response

Diagnostics information

./ldap-auth.sh
name = Alexander Borisov
group = system-admin
local_only = true

A piece of script responsible for printing to stdout:

on_auth_success() {
    # Print the meta entries for use in HA
    [[ ! -z "$DISPLAY_NAME" ]] && echo "name = $DISPLAY_NAME"

    if [[ "$IS_ADMIN" = true ]]; then
        echo "group = system-admin"
    else
        echo "group = system-users"
    fi


    if [[ "$IS_LOCAL" = true ]]; then
        echo "local_only = true"
    else
        echo "local_only = false"
    fi
}

Example YAML snippet

homeassistant:
  auth_providers:
    - type: command_line
      command: /config/ldap/ldap-auth.sh
      args:
        - !secret ldap_uri
        - !secret ldap_user_base
        - !secret ldap_ha_users_grp
        - !secret ldap_ha_admins_grp
        - !secret ldap_ha_local_only_grp
      meta: true


### Anything in the logs that might be useful for us?

_No response_

### Additional information

_No response_
@avbor
Copy link
Author

avbor commented Nov 16, 2024

Also, even if the logins (local and from command_line) match, when using the
auth_providers command_line always creates a new user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant