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

LDAP module in docker with PostgreSQL installation not working #3485

Closed
Azziii opened this issue Oct 30, 2023 · 15 comments
Closed

LDAP module in docker with PostgreSQL installation not working #3485

Azziii opened this issue Oct 30, 2023 · 15 comments

Comments

@Azziii
Copy link

Azziii commented Oct 30, 2023

I am using an installation using Docker (php7.4-1.17.40) and the "LDAP Integration" module (1.0.30). After activating the module and entering the necessary settings, the "Connect & Fetch Attributes" button worked successfully. Specified the following parameters:
E-mail -> mail
First Name -> given name
Last Name -> sn
Job Title -> title
Phone Number -> telephonenumber

After that, I set "DNs and Filters"
dc=domain,dc=local(objectclass=person)

I chose "Automatic Import" and "LDAP Authentication" and saved the settings. But the "Import Now" button remained inactive and the import of users did not occur. I cleared the cache, deactivated-activated the module, restarted the module - nothing helped.
It turned out to go inside the container and execute "/www/html # php artisan adldap:import". But LDAP Authentication and automatic import do not work. When creating a ticket, imported users cannot be selected. What else do I need to configure?

@freescout-helpdesk
Copy link
Contributor

freescout-helpdesk commented Oct 31, 2023

Have Connect & Fetch Attributes fields been saved after saving settings?

Check errors in Manage > Logs > App Logs.

Are you able to automatically import users from ldap.forumsys.com? See details in Troubleshooting section of https://freescout.net/module/ldap/

@Azziii
Copy link
Author

Azziii commented Oct 31, 2023

No, the fields are empty after saving. But after manual import, the mappings were put down correctly.
LDAP log is empty.
That error appears in the laravel log every half hour:

Level	Context	Date	Content
  error	production	2023-10-31 20:30:02	 Aborted. {"exception":"[object] (Symfony\\Component\\Console\\Exception\\RuntimeException(code: 0): Aborted. at /www/html/vendor/symfony/console/Helper/QuestionHelper.php:181)
[stacktrace]
#0 /www/html/vendor/symfony/console/Helper/QuestionHelper.php(85): Symfony\\Component\\Console\\Helper\\QuestionHelper->doAsk(Object(Illuminate\\Console\\OutputStyle), Object(Symfony\\Component\\Console\\Question\\ConfirmationQuestion))
#1 /www/html/vendor/symfony/console/Helper/QuestionHelper.php(482): Symfony\\Component\\Console\\Helper\\QuestionHelper->Symfony\\Component\\Console\\Helper\\{closure}()
#2 /www/html/vendor/symfony/console/Helper/QuestionHelper.php(88): Symfony\\Component\\Console\\Helper\\QuestionHelper->validateAttempts(Object(Closure), Object(Illuminate\\Console\\OutputStyle), Object(Symfony\\Component\\Console\\Question\\ConfirmationQuestion))
#3 /www/html/vendor/symfony/console/Helper/SymfonyQuestionHelper.php(53): Symfony\\Component\\Console\\Helper\\QuestionHelper->ask(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle), Object(Symfony\\Component\\Console\\Question\\ConfirmationQuestion))
#4 /www/html/vendor/symfony/console/Style/SymfonyStyle.php(294): Symfony\\Component\\Console\\Helper\\SymfonyQuestionHelper->ask(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle), Object(Symfony\\Component\\Console\\Question\\ConfirmationQuestion))
#5 /www/html/vendor/symfony/console/Style/SymfonyStyle.php(222): Symfony\\Component\\Console\\Style\\SymfonyStyle->askQuestion(Object(Symfony\\Component\\Console\\Question\\ConfirmationQuestion))
#6 /www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(314): Symfony\\Component\\Console\\Style\\SymfonyStyle->confirm('Would you like ...', true)
#7 /data/Modules/Ldap/Console/Import.php(64): Illuminate\\Console\\Command->confirm('Would you like ...', true)
#8 [internal function]: Modules\\Ldap\\Console\\Import->handle()
#9 /www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#10 /www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#11 /www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#12 /www/html/overrides/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#13 /www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array)
#14 /www/html/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#15 /www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#16 /www/html/vendor/symfony/console/Application.php(992): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#17 /www/html/vendor/symfony/console/Application.php(255): Symfony\\Component\\Console\\Application->doRunCommand(Object(Modules\\Ldap\\Console\\Import), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#18 /www/html/vendor/symfony/console/Application.php(148): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#19 /www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#20 /www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#21 /www/html/artisan(62): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#22 {main}
"}

@freescout-helpdesk
Copy link
Contributor

This php artisan adldap:import command should not be used. Module provides freescout:ldap-import command.

Can you attach screenshot of your mapping settings.

Are you able to automatically import users from ldap.forumsys.com? See details in Troubleshooting section of https://freescout.net/module/ldap/

@Azziii
Copy link
Author

Azziii commented Oct 31, 2023

Before save:
1
After save:
2

@freescout-helpdesk
Copy link
Contributor

Are you using any non-official modules?

You need to figure out why mapping fields are not saved. Try to check the value of ldap_mapping option in DB options table:

SELECT * FROM options WHERE `name` = "ldap_mapping"

@freescout-helpdesk
Copy link
Contributor

And we are still waiting for this:

Are you able to automatically import users from ldap.forumsys.com? See details in Troubleshooting section of https://freescout.net/module/ldap/

@Azziii
Copy link
Author

Azziii commented Oct 31, 2023

Enabled Following, Maisen's Extendet Mail Vars and Unassigned Count community modules.

SELECT * FROM options WHERE name='ldap_mapping';
 id |     name     |                                                                          value

----+--------------+----------------------------------------------------------------------------------------------------------------------------------------------------
-----
 46 | ldap_mapping | a:5:{s:5:"email";s:4:"mail";s:10:"first_name";s:9:"givenname";s:9:"last_name";s:2:"sn";s:9:"job_title";s:5:"title";s:5:"phone";s:15:"telephonenumbe
r";}
(1 row)

Unfortunately, the server is on a local network without Internet, I can't check ldap.forumsys.com.

@Azziii
Copy link
Author

Azziii commented Oct 31, 2023

Deactivate and delete all community modules, clear cache, restart service - it didn't help.

@freescout-helpdesk
Copy link
Contributor

Check what you have in "ldap_attrs" option in DB "options" table:

SELECT * FROM options WHERE `name` = "ldap_attrs"

@Azziii
Copy link
Author

Azziii commented Nov 1, 2023

freescout=# SELECT * FROM options WHERE name = 'ldap_attrs';
 id |    name    |


                                                                     value



----+------------+------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
 47 | ldap_attrs | a:92:{s:11:"objectclass";s:3:"top";s:2:"cn";s:44:"Иванов Иван Иванович";s:2:"sn";s:14:"Иванов";s:5:"title";s:42:"Сотрудник";s:15:"te
lephonenumber";s:5:"11-11";s:9:"givenname";s:14:"Иван";s:17:"distinguishedname";s:148:"CN=Иванов Иван Иванович,OU=Users,DC=domain,DC=local";s:12:"instancetype";s:1:"4";s:11:"whencreated";s:17:"20230429122536.0Z";s:11:"whenchanged";s:17:"20231031054726.0Z";s:11:"displayname";s:44:"Иванов
 Иван Иванович";s:10:"usncreated";s:5:"12479";s:8:"memberof";s:58:"OU=Group,OU=Groups,DC=domain,DC=local";s:10:"usnchanged";s:7:"2989814";s:10:"d
epartment";s:64:"Департамент";s:14:"proxyaddresses";s:26:"smtp:ivanov@domain.com";s:4:"name";s:44:"Иванов Иван Иванович";s:10:"objectguid";
s:16:"\x7F@???\x1E?F?W݋+Oi?";s:18:"useraccountcontrol";s:5:"66048";s:11:"badpwdcount";s:1:"0";s:8:"codepage";s:1:"0";s:11:"countrycode";s:1:"0";s:9:"lastlogon";s:18:"133
432051161429005";s:10:"pwdlastset";s:18:"133272447365495183";s:14:"primarygroupid";s:3:"513";s:9:"objectsid";s:26:"\x01\x05
(1 row)

@freescout-helpdesk freescout-helpdesk changed the title LDAP module in docker installation not working LDAP module in docker with PostgreSQL installation not working Nov 2, 2023
@freescout-helpdesk
Copy link
Contributor

One more thing to check: can you connect to PostgreSQL and get the structure of the options table:

\d options;

We need to know the type of the value field.

@freescout-helpdesk
Copy link
Contributor

Also add the following code to the line 52 in /app/Option.php:

    if ($name == 'ldap_attrs') {
        \Log::error('[LDAP value] '.base64_encode(json_encode($value)));
        \Log::error('[LDAP serialized_value] '.base64_encode($serialized_value));
    }

After that open LDAP settings page, click "Connect & Fetch Attributes" and save settings. Then go to "Manage > Logs > App Logs" and send us two lines starting with "[LDAP value]" and "[LDAP serialized_value]".

@Azziii
Copy link
Author

Azziii commented Nov 2, 2023

freescout=# \d options;
                                    Table "public.options"
 Column |          Type          | Collation | Nullable |               Default
--------+------------------------+-----------+----------+-------------------------------------
 id     | integer                |           | not null | nextval('options_id_seq'::regclass)
 name   | character varying(191) |           | not null |
 value  | text                   |           | not null |
Indexes:
    "options_pkey" PRIMARY KEY, btree (id)
    "options_name_unique" UNIQUE CONSTRAINT, btree (name)

@freescout-helpdesk
Copy link
Contributor

freescout-helpdesk commented Nov 2, 2023

The problem here is in \u0000 symbol present in "objectsid" LDAP attribute. It works fine on MySQL but PostgreSQL truncates the string starting from this symbol when saving it to DB.
https://stackoverflow.com/questions/31671634/handling-unicode-sequences-in-postgresql

@freescout-helpdesk
Copy link
Contributor

Fixed in LDAP Integration Module v1.0.31.

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

2 participants