LDAP sync not working if Username Attribute not specified #9515

Closed
opened 2025-11-02 08:41:25 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @pezhovski on GitHub (Sep 5, 2022).

Description

When LDAP Authentication configured only with required fields, sync_external_users not creating accounts.
Enable user synchronization option is checked.

When trying to login with user from connected LDAP, new user is created with username taken from uid probably.
On the next sync this user is marked as inactive.

It either documentation problem or a bug.

Gitea Version

1.17.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Using compose file

---
version: "2"

services:
  db:
    image: bitnami/postgresql:latest
    user: 1001
    environment:
      - POSTGRESQL_USER=gitea
      - POSTGRESQL_PASSWORD=gitea
      - POSTGRESQL_DATABASE=gitea
    networks:
      - gitea-network

  gitea:
    image: gitea/gitea:1.17.1-rootless
    user: 1000:1000
    environment:
      - DB_TYPE=postgres
      - DB_HOST=db:5432
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
    volumes:
      - ./gitea-config:/etc/gitea
      - ./gitea-data:/var/lib/gitea
    ports:
      - "3000:3000"
    depends_on:
      - db
    networks:
      - gitea-network

  ldap1:
    image: glauth/glauth
    user: 1000
    volumes:
      - ./ldap-config.cfg:/app/config/config.cfg
    networks:
      - gitea-network

Database

PostgreSQL

Originally created by @pezhovski on GitHub (Sep 5, 2022). ### Description When LDAP Authentication configured only with required fields, sync_external_users not creating accounts. Enable user synchronization option is checked. When trying to login with user from connected LDAP, new user is created with username taken from uid probably. On the next sync this user is marked as inactive. It either [documentation](https://docs.gitea.io/en-us/authentication/#ldap-via-binddn) problem or a bug. ### Gitea Version 1.17.1 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Using compose file ```yaml --- version: "2" services: db: image: bitnami/postgresql:latest user: 1001 environment: - POSTGRESQL_USER=gitea - POSTGRESQL_PASSWORD=gitea - POSTGRESQL_DATABASE=gitea networks: - gitea-network gitea: image: gitea/gitea:1.17.1-rootless user: 1000:1000 environment: - DB_TYPE=postgres - DB_HOST=db:5432 - DB_NAME=gitea - DB_USER=gitea - DB_PASSWD=gitea volumes: - ./gitea-config:/etc/gitea - ./gitea-data:/var/lib/gitea ports: - "3000:3000" depends_on: - db networks: - gitea-network ldap1: image: glauth/glauth user: 1000 volumes: - ./ldap-config.cfg:/app/config/config.cfg networks: - gitea-network ``` ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 08:41:25 -06:00
Author
Owner

@Zettat123 commented on GitHub (Jun 15, 2023):

related to 73ae71824d/services/auth/source/ldap/source_sync.go (L89-L91)

@Zettat123 commented on GitHub (Jun 15, 2023): related to https://github.com/go-gitea/gitea/blob/73ae71824d64aa242451f54af5df7e8f8bfcf579/services/auth/source/ldap/source_sync.go#L89-L91
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9515