mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
8.58k stars 1.15k forks source link

user sync of keycloak IDP crashes #5408

Closed tja-X closed 12 months ago

tja-X commented 1 year ago

Contribution guidelines

I've found a bug and checked that ...

Description

we configured a keycloak/ldap IDP and activated "Periodic Full Sync" and "Import Users".
nothing gets imported and the logs (see below) will throw a fatal every few minutes.

Logs:

mailcowdockerized-ofelia-mailcow-1     | 2023-09-04T07:39:49.574+02:00  common.go:125 ▶ NOTICE [Job "phpfpm_keycloak_sync" (5d7e1d235c62)] StdOut: 
mailcowdockerized-ofelia-mailcow-1     | Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /crons/keycloak-sync.php:158
mailcowdockerized-ofelia-mailcow-1     | Stack trace:
mailcowdockerized-ofelia-mailcow-1     | #0 {main}
mailcowdockerized-ofelia-mailcow-1     |   thrown in /crons/keycloak-sync.php on line 158
mailcowdockerized-ofelia-mailcow-1     | 2023-09-04T07:39:49.574+02:00  common.go:125 ▶ NOTICE [Job "phpfpm_keycloak_sync" (5d7e1d235c62)] Finished in "571.07256ms", failed: false, skipped: false, error: none

Steps to reproduce:

configure an keycloak/LDAP IDP
acitivate "Periodic Full Sync" and "Import Users"

Which branch are you using?

nightly

Operating System:

Debian GNU/Linux 12

Server/VM specifications:

8GB / 2 cores

Is Apparmor, SELinux or similar active?

no

Virtualization technology:

KVM

Docker version:

24.0.5

docker-compose version or docker compose version:

v2.20.2

mailcow version:

2023-08

Reverse proxy:

--

Logs of git diff:

--

Logs of iptables -L -vn:

--

Logs of ip6tables -L -vn:

--

Logs of iptables -L -vn -t nat:

--

Logs of ip6tables -L -vn -t nat:

--

DNS check:

--
FreddleSpl0it commented 12 months ago

The crash should be fixed, but I think the main problem in your case is that some users have attributes in Keycloak but no mailcow_template attribute