authelia: Authelia Fails to Start: Duplicate key name 'webauthn_devices_kid_key'

Version

v4.38.0

Deployment Method

Docker

Reverse Proxy

Traefik

Reverse Proxy Version

2.10.7

Description

Authelia is unable to complete start up in v4.38.0. It appears the issue is due to the schema migration running into errors with webauthn_devices_kid_key. I am unsure why I have this error as I am not using WebAuthn in my configuration. Unfortunately, the documentation doesn’t yet have information on what the proper configuration for WebAuthn should be so I don’t know if other portions of my configuration are causing this issue. This configuration worked fine until the upgrade.

Docker config:


  authelia:
    image: ghcr.io/authelia/authelia:latest
    container_name: authelia
    volumes:
      - ${AUTHELIA_CONF_DIR_LOCAL}:/config
      - ${AUTHELIA_ETC_DIR_LOCAL}/etc/secrets
    networks:
      mariadb_net:
      t2_proxy:
        ipv4_address: 192.168.90.250
    labels:
      - traefik.enable=true
      - traefik.http.routers.authelia.rule=Host(`authelia.example.com`)
      - traefik.http.routers..authelia.entrypoints=https
      - traefik.http.routers..authelia.tls=true
      - traefik.http.routers..authelia.tls.options=default
      - traefik.http.routers..authelia.middlewares=middlewares-secure-headers@file
      
      - traefik.http.middlewares.authelia.forwardauth.address=http://192.168.90.250:9091/api/verify?rd=https://authelia.example.com'
      - traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true
      - traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email'  
    restart: unless-stopped
    depends_on:
      ldap:
        condition: service_started
        restart: true
      redis:
        condition: service_started
        restart: true
      mariadb:
        condition: service_started
        restart: true
    ports:
      - 9091:9091
    environment:
      TZ: ${TZ}
      PUID: ${PUID}
      PGID: ${PGID}
      LOG4J_FORMAT_MSG_NO_LOOKUPS: "true"
      AUTHELIA_IDENTITY_PROVIDERS_OIDC_ISSUER_PRIVATE_KEY_FILE: ${SECRETS_DIR_REMOTE}/authelia_oidc_issuer_key
      AUTHELIA_IDENTITY_PROVIDERS_OIDC_HMAC_SECRET_FILE: ${SECRETS_DIR_REMOTE}/authelia_oidc_hmac_secret 
      AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET_FILE: ${SECRETS_DIR_REMOTE}/authelia_jwt
      AUTHELIA_SESSION_SECRET_FILE: ${SECRETS_DIR_REMOTE}/authelia_session 
      AUTHELIA_SESSION_REDIS_PASSWORD_FILE: ${SECRETS_DIR_REMOTE}/authelia_redis
      AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE: ${SECRETS_DIR_REMOTE}/authelia_storage_encryption
      AUTHELIA_STORAGE_MYSQL_PASSWORD_FILE: ${SECRETS_DIR_REMOTE}/authelia_mysql
      AUTHELIA_NOTIFIER_SMTP_PASSWORD_FILE: ${SECRETS_DIR_REMOTE}/authelia_smtp
      AUTHELIA_AUTHENTICATION_BACKEND_LDAP_PASSWORD_FILE: ${SECRETS_DIR_REMOTE}/authelia_ldap_password
    secrets:
      - authelia_oidc_issuer_key
      - authelia_oidc_hmac_secret
      - authelia_mysql
      - authelia_smtp
      - authelia_jwt
      - authelia_session
      - authelia_redis
      - authelia_storage_encryption
      - authelia_ldap_password

Reproduction

Unsure on how to reproduce beyond upgrading to v12

Expectations

Authelia should not run into issues starting up.

Configuration (Authelia)

server:
    address: tcp://0.0.0.0:9091
    buffers:
        read: 16384
        write: 16384

log:
    level: debug

totp:
    issuer: example.com
    period: 30
    skew: 1

authentication_backend:
    ldap:
        implementation: custom
        address: ldap://192.168.XX.36
        timeout: 5s
        base_dn: DC=example,DC=com
        additional_users_dn: ou=users
        users_filter: (&({username_attribute}={input})(objectClass=person))
        additional_groups_dn: ou=groups
        groups_filter: (&(member={dn})(objectClass=group))
        attributes:
            group_name: cn
            display_name: displayName
            mail: mail
            username: uid
        permit_referrals: false
        user: cn=admin,dc=example,dc=com

access_control:
    default_policy: deny
    rules:
    - domain: "*.example.com"
      policy: two_factor
    - domain: "example.com"
      policy: deny
    - domain: authelia.example.com
      policy: bypass

session:
    cookies:
      - name: authelia_session
        expiration: 180d
        inactivity: 14d
        domain: example.com
        authelia_url: 'https://auth.example.com'
        default_redirection_url: https://example.com
    name: authelia_session
    expiration: 180d
    inactivity: 14d

    redis:
        host: 192.168.86.36
        port: 6379

regulation:
    max_retries: 3
    find_time: 120
    ban_time: 300

storage:
    mysql:
        address: tcp://mariadb:3306
        database: authelia
        username: authelia

notifier:
    smtp:
        username: XXXX@gmail.com
        address: smtp://smtp.gmail.com:587
        sender: XXXX@gmail.com

identity_providers:
    oidc:
        lifespans:
            authorize_code: 1m
            id_token: 1h
            access_token: 1h
            refresh_token: 90m
        enforce_pkce: public_clients_only
        enable_client_debug_messages: false
        cors:
            endpoints:
                - authorization
                - token
                - revocation
                - introspection
            allowed_origins:
                - https://example.com
            allowed_origins_from_client_redirect_uris: false
        clients:
            - client_id: app1
              client_name: Log In to app1
              client_secret: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              public: false
              authorization_policy: two_factor
              audience: []
              scopes:
                  - openid
                  - profile
                  - groups
                  - email
              redirect_uris:
                  - https://app1.example.com
              userinfo_signed_response_alg: none

            - client_id: app2
              client_name: Log In to app2
              client_secret: $plaintext$XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              authorization_policy: two_factor
              audience: []
              scopes:
                  - openid
                  - profile
                  - groups
                  - email
              redirect_uris:
                  - https://app2.example.com
              userinfo_signed_response_alg: none

            - client_id: app3
              client_name: app3
              client_secret: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              public: false
              authorization_policy: two_factor
              audience: []
              scopes:
                  - openid
                  - profile
                  - groups
                  - email
              redirect_uris:
                  - https://app3.example.com/apps/oidc_login/oidc
                  - https://app3.example.com/apps/sociallogin/custom_oidc/app3
              grant_types:
                  - refresh_token
                  - authorization_code
              response_types:
                  - code
              userinfo_signed_response_alg: none

Build Information

Unable to get this information due to Authelia stuck restarting.

Logs (Authelia)

time="2024-03-14T10:54:16-04:00" level=debug msg="Process user information" gid=1000 uid=1000
time="2024-03-14T10:54:16-04:00" level=warning msg="Configuration: configuration key 'jwt_secret' is deprecated in 4.38.0 and has been replaced by 'identity_validation.reset_password.jwt_secret': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-14T10:54:16-04:00" level=warning msg="Configuration: configuration key 'identity_providers.oidc.issuer_private_key' is deprecated in 4.38.0 and has been replaced by 'identity_providers.oidc.jwks': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0 : see https://www.authelia.com/c/oidc for more information"
time="2024-03-14T10:54:16-04:00" level=warning msg="Configuration: identity_providers: oidc: clients: client 'app1': option 'client_secret' is plaintext but for clients not using the 'token_endpoint_auth_method' of 'client_secret_jwt' it should be a hashed value as plaintext values are deprecated with the exception of 'client_secret_jwt' and will be removed in the near future"
time="2024-03-14T10:54:16-04:00" level=warning msg="Configuration: identity_providers: oidc: clients: client 'app2': option 'client_secret' is plaintext but for clients not using the 'token_endpoint_auth_method' of 'client_secret_jwt' it should be a hashed value as plaintext values are deprecated with the exception of 'client_secret_jwt' and will be removed in the near future"
time="2024-03-14T10:54:16-04:00" level=warning msg="Configuration: identity_providers: oidc: clients: client 'app3': option 'grant_types' should only have the 'refresh_token' value if the client is also configured with the 'offline_access' scope"
time="2024-03-14T10:54:16-04:00" level=warning msg="Configuration: identity_providers: oidc: clients: client 'app3': option 'client_secret' is plaintext but for clients not using the 'token_endpoint_auth_method' of 'client_secret_jwt' it should be a hashed value as plaintext values are deprecated with the exception of 'client_secret_jwt' and will be removed in the near future"
time="2024-03-14T10:54:16-04:00" level=warning msg="Configuration: identity_providers: oidc: clients: warnings for clients above indicate deprecated functionality and it's strongly suggested these issues are checked and fixed if they're legitimate issues or reported if they are not as in a future version these warnings will become errors"
time="2024-03-14T10:54:16-04:00" level=info msg="Authelia v4.38.0 is starting"
time="2024-03-14T10:54:16-04:00" level=info msg="Log severity set to debug"
time="2024-03-14T10:54:16-04:00" level=debug msg="Registering client app1 with policy two_factor (two_factor)"
time="2024-03-14T10:54:16-04:00" level=debug msg="Registering client app2 with policy two_factor (two_factor)"
time="2024-03-14T10:54:16-04:00" level=debug msg="Registering client app3 with policy two_factor (two_factor)"
time="2024-03-14T10:54:16-04:00" level=info msg="Storage schema is being checked for updates"
time="2024-03-14T10:54:16-04:00" level=info msg="Storage schema migration from 11 to 15 is being attempted"
time="2024-03-14T10:54:16-04:00" level=error msg="Error occurred running a startup check" error="error during schema migrate: error applying migration version 12 to version 11 for rollback: schema migration 12 (WebAuthnMultiCookieDomain) failed: Error 1061 (42000): Duplicate key name 'webauthn_devices_kid_key'. rollback caused by: schema migration 12 (WebAuthnMultiCookieDomain) failed: Error 1061 (42000): Duplicate key name 'webauthn_credentials_kid_key'" provider=storage stack="github.com/authelia/authelia/v4/internal/commands/root.go:107 doStartupChecks\ngithub.com/authelia/authelia/v4/internal/commands/root.go:87  (*CmdCtx).RootRunE\ngithub.com/spf13/cobra@v1.8.0/command.go:983                  (*Command).execute\ngithub.com/spf13/cobra@v1.8.0/command.go:1115                 (*Command).ExecuteC\ngithub.com/spf13/cobra@v1.8.0/command.go:1039                 (*Command).Execute\ngithub.com/authelia/authelia/v4/cmd/authelia/main.go:10       main\nruntime/internal/atomic/types.go:194                          (*Uint32).Load\nruntime/asm_amd64.s:1695                                      goexit"
time="2024-03-14T10:54:16-04:00" level=debug msg="LDAP Supported OIDs. Control Types: 2.16.840.1.113730.3.4.18, 2.16.840.1.113730.3.4.2, 1.3.6.1.4.1.4203.1.10.1, 1.3.6.1.1.22, 1.2.840.113556.1.4.319, 1.2.826.0.1.3344810.2.3, 1.3.6.1.1.13.2, 1.3.6.1.1.13.1, 1.3.6.1.1.12. Extensions: 1.3.6.1.4.1.1466.20037, 1.3.6.1.4.1.4203.1.11.1, 1.3.6.1.4.1.4203.1.11.3, 1.3.6.1.1.8"
time="2024-03-14T10:54:16-04:00" level=error msg="Your LDAP Server supports TLS but you don't appear to be utilizing it. We strongly recommend using the scheme 'ldaps://' or enabling the StartTLS option to secure connections with your LDAP Server." stack="github.com/authelia/authelia/v4/internal/commands/root.go:163 doStartupCheck\ngithub.com/authelia/authelia/v4/internal/commands/root.go:116 doStartupChecks\ngithub.com/authelia/authelia/v4/internal/commands/root.go:87  (*CmdCtx).RootRunE\ngithub.com/spf13/cobra@v1.8.0/command.go:983                  (*Command).execute\ngithub.com/spf13/cobra@v1.8.0/command.go:1115                 (*Command).ExecuteC\ngithub.com/spf13/cobra@v1.8.0/command.go:1039                 (*Command).Execute\ngithub.com/authelia/authelia/v4/cmd/authelia/main.go:10       main\nruntime/internal/atomic/types.go:194                          (*Uint32).Load\nruntime/asm_amd64.s:1695                                      goexit"
time="2024-03-14T10:54:17-04:00" level=fatal msg="One or more providers had fatal failures performing startup checks, for more detail check the error level logs" providers="[storage]" stack="github.com/authelia/authelia/v4/internal/commands/root.go:149 doStartupChecks\ngithub.com/authelia/authelia/v4/internal/commands/root.go:87  (*CmdCtx).RootRunE\ngithub.com/spf13/cobra@v1.8.0/command.go:983                  (*Command).execute\ngithub.com/spf13/cobra@v1.8.0/command.go:1115                 (*Command).ExecuteC\ngithub.com/spf13/cobra@v1.8.0/command.go:1039                 (*Command).Execute\ngithub.com/authelia/authelia/v4/cmd/authelia/main.go:10       main\nruntime/internal/atomic/types.go:194                          (*Uint32).Load\nruntime/asm_amd64.s:1695                                      goexit"

Logs (Proxy / Application)

N/A

Documentation

https://www.authelia.com/blog/4.38-release-notes/

Pre-Submission Checklist

  • I agree to follow the Code of Conduct

  • This is a bug report and not a support request

  • I have read the security policy and this bug report is not a security issue or security related issue

  • I have either included the complete configuration file or I am sure it’s unrelated to the configuration

  • I have either included the complete debug / trace logs or the output of the build-info command if the logs are not relevant

  • I have provided all of the required information in full with the only alteration being reasonable sanitization in accordance with the Troubleshooting Sanitization reference guide

  • I have checked for related proxy or application logs and included them if available

  • I have checked for related issues and checked the documentation

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 31 (13 by maintainers)

Commits related to this issue

Most upvoted comments

I upgraded to the latest version (4.38.4) but the schema migration from 11 to 12 is still failing for me for some reason. Is there something that I should do manually to solve the problem?

Here’s the log:

time="2024-03-18T18:44:30+01:00" level=debug msg="Loaded Configuration Sources" files="[/config/configuration.yml]" filters="[]"
time="2024-03-18T18:44:30+01:00" level=debug msg="Process user information" gid=99 uid=99
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration key 'server.write_buffer_size' is deprecated in 4.36.0 and has been replaced by 'server.buffers.write': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration key 'authentication_backend.disable_reset_password' is deprecated in 4.36.0 and has been replaced by 'authentication_backend.password_reset.disable': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration key 'server.enable_pprof' is deprecated in 4.38.0 and has been replaced by 'server.endpoints.enable_pprof': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration key 'server.read_buffer_size' is deprecated in 4.36.0 and has been replaced by 'server.buffers.read': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration key 'server.enable_expvars' is deprecated in 4.38.0 and has been replaced by 'server.endpoints.enable_expvars': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration key 'jwt_secret' is deprecated in 4.38.0 and has been replaced by 'identity_validation.reset_password.jwt_secret': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration key 'session.remember_me_duration' is deprecated in 4.38.0 and has been replaced by 'session.remember_me': you are not required to make any changes as this has been automatically mapped for you, but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration keys 'notifier.smtp.host' and 'notifier.smtp.port' are deprecated in 4.38.0 and has been replaced by 'notifier.smtp.address' in the format of '[tcp://]<hostname>[:<port>]': you are not required to make any changes as this has been automatically mapped for you to the value 'submission://smtp.gmail.com:587', but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration keys 'storage.mysql.host' and 'storage.mysql.port' are deprecated in 4.38.0 and has been replaced by 'storage.mysql.address' in the format of '[tcp://]<hostname>[:<port>]': you are not required to make any changes as this has been automatically mapped for you to the value 'tcp://192.168.1.38:3306', but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: configuration keys 'server.host', 'server.port', and 'server.path' are deprecated in 4.38.0 and has been replaced by 'server.address' in the format of '[tcp[(4|6)]://]<hostname>[:<port>][/<path>]' or 'tcp[(4|6)://][hostname]:<port>[/<path>]': you are not required to make any changes as this has been automatically mapped for you to the value 'tcp://0.0.0.0:9091/', but to stop this warning being logged you will need to adjust your configuration, and this configuration key and auto-mapping is likely to be removed in 5.0.0"
time="2024-03-18T18:44:30+01:00" level=warning msg="Configuration: session: option 'domain' is deprecated in v4.38.0 and has been replaced by a multi-domain configuration: this has automatically been mapped for you but you will need to adjust your configuration to remove this message and receive the latest messages"
time="2024-03-18T18:44:30+01:00" level=info msg="Authelia v4.38.4 is starting"
time="2024-03-18T18:44:30+01:00" level=info msg="Log severity set to debug"
time="2024-03-18T18:44:30+01:00" level=info msg="Storage schema is being checked for updates"
time="2024-03-18T18:44:30+01:00" level=info msg="Storage schema migration from 11 to 15 is being attempted"
time="2024-03-18T18:44:30+01:00" level=error msg="Error occurred running a startup check" error="error during schema migrate: error applying migration version 12 to version 11 for rollback: schema migration 12 (WebAuthnMultiCookieDomain) failed: Error 1061 (42000): Duplicate key name 'webauthn_devices_kid_key'. rollback caused by: schema migration 12 (WebAuthnMultiCookieDomain) failed: Error 1305 (42000): PROCEDURE authelia.PROC_DROP_INDEX does not exist" provider=storage stack="github.com/authelia/authelia/v4/internal/commands/root.go:107 doStartupChecks\ngithub.com/authelia/authelia/v4/internal/commands/root.go:87  (*CmdCtx).RootRunE\ngithub.com/spf13/cobra@v1.8.0/command.go:983                  (*Command).execute\ngithub.com/spf13/cobra@v1.8.0/command.go:1115                 (*Command).ExecuteC\ngithub.com/spf13/cobra@v1.8.0/command.go:1039                 (*Command).Execute\ngithub.com/authelia/authelia/v4/cmd/authelia/main.go:10       main\nruntime/internal/atomic/types.go:194                          (*Uint32).Load\nruntime/asm_amd64.s:1695                                      goexit"
time="2024-03-18T18:44:30+01:00" level=debug msg="notification provider: startup check skipped as it is disabled"
time="2024-03-18T18:44:30+01:00" level=fatal msg="One or more providers had fatal failures performing startup checks, for more detail check the error level logs" providers="[storage]" stack="github.com/authelia/authelia/v4/internal/commands/root.go:149 doStartupChecks\ngithub.com/authelia/authelia/v4/internal/commands/root.go:87  (*CmdCtx).RootRunE\ngithub.com/spf13/cobra@v1.8.0/command.go:983                  (*Command).execute\ngithub.com/spf13/cobra@v1.8.0/command.go:1115                 (*Command).ExecuteC\ngithub.com/spf13/cobra@v1.8.0/command.go:1039                 (*Command).Execute\ngithub.com/authelia/authelia/v4/cmd/authelia/main.go:10       main\nruntime/internal/atomic/types.go:194                          (*Uint32).Load\nruntime/asm_amd64.s:1695                                      goexit"

No worries, for those that didn’t notice the fix for this issue was released.