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

ERROR 500 When savin LDAP CONF #273

Open
GamerClassN7 opened this issue Apr 20, 2023 · 47 comments
Open

ERROR 500 When savin LDAP CONF #273

GamerClassN7 opened this issue Apr 20, 2023 · 47 comments

Comments

@GamerClassN7
Copy link

image

Can anybody help me with this issue ?

@GamerClassN7
Copy link
Author

i tracked it to this line https://github.com/osTicket/osTicket-plugins/blob/develop/lib/pear-pear.php.net/net_ldap2/Net/LDAP2.php#L701 maybe maybe @JediKev can share some light :)

@GamerClassN7
Copy link
Author

Can anyone prowide some idea why is this happeninge ?

@GamerClassN7
Copy link
Author

@protich sorry for mention but we are really despered to get it working, and you already managed to fix one of bad downsides of OST the oauth when basic authentication was droped on ms site.

Would you be able please to take a look on to this issue ?

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 9, 2023

@GamerClassN7

Have you tried using this build of the plugin?

Cheers.

Hi i already, tryed that :( unforchunatelly, in test enviroment when i try LDAP ove standart port and everithhing is correct, but in production with LDAPS each time i try to save the setting i get 500 error

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

Then it sounds like it truly can’t connect. Have you checked your firewall, ports, SSL cert, etc.? Have you tried an LDAPS connection from the webserver to see if it can connect properly?

Cheers.

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 9, 2023

yes i tryed ldaps Conection ower Powershell and native win server app both are working
i even writed simple php test using same library and its also worked

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

Post a screenshot of Admin Panel > Dashboard > Information.

Cheers.

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 9, 2023

@JediKev
image

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

The only thing out of place here is the message about no longer being supported. Looks like you are having some DNS issues for that. However, I don't think that has any effect on this issue.

At this point the best course of action will be to track your connection logs and see at what point it fails. We'd just be guessing without more detailed errors/information.

Cheers.

@GamerClassN7
Copy link
Author

Yes you are right server is deployed in same ENV as My dev server both are high sec enviroments. if you can guid me threw i can get you logs if you want :).

Yes you are right server is deployed in same ENV as My dev server both are high sec. enviroments. if you can guid me threw i can get you logs if you want :).

@GamerClassN7
Copy link
Author

but i guss from waht i see incorect variable is pushed in to the ldap_close() fuction as i posted in initial message, prehaps it si some edge cases when plugin configuration validation fail ? judst guessing since if validation fails nothing can be closed if conection is not established right ?

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

I am not a windows/IIS guy so I'm not going to be too helpful here. I did some quick googling and saw that the Windows Event Viewer can log LDAP/LDAPS connections/authentication attempts. You may need to go in and enable it though.

It basically can't close a connection as the connection is false meaning it didn't connect properly.

Cheers.

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 9, 2023

@JediKev
I checked EVENT LOG already nothing suspicious here.
PHP log and IIS log are also empty. unforchunatelly

I even runned tests over powershell and telnet to server over port 636 and it get threw :(

@GamerClassN7
Copy link
Author

if anyone interested there is simple ps LDAP and LDAPS tester https://evotec.xyz/testing-ldap-and-ldaps-connectivity-with-powershell/

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

I was able to replicate this exact error when enabling TLS in the plugin config when I don't have TLS configured on the LDAP server. It does seem like the LDAPS connection is failing so ldap_close() is failing as a result (as there was no successful connection). You need to figure out why it's not able to connect to LDAPS but can to LDAP. In my case I simply don't have TLS configured.

Also, what port are you using in your plugin config for LDAPS? Also, did you enable the TLS option in the plugin config?

Cheers.

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 9, 2023

@JediKev
I use standard port 636 and tryed it with tls enabled and disabled same outcome, hoewer wierd thing is that from powershell and telnet from same server i am able to use ldaps

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

I believe here is where the _link is being set to false if the TLS connection fails:

This seems to be happening in your case. Let's setup an unpacked plugin so you can add debug statements.

First, simply unpack the plugin:

cd /path/to/osTicket/include/plugins/
php -r '$phar = new Phar("auth-ldap.phar"); $phar->extractTo("./auth-ldap");'

Now you must update the database:

  • Navigate to ost_plugin table
  • Find the record for the LDAP plugin
  • Set isphar to 0
  • Set the install_path to plugins/auth-ldap

Once you do this you may need to restart the webserver. Now, you can edit the raw plugin files and add debug statements.

From here you can edit the /path/to/osticket/include/plugins/auth-ldap/include/Net2/LDAP2.php file, go to line 446, and add var_dump($current_error);die; making the entire statement look like:

            // If we're supposed to use TLS, do so before we try to bind,
            // as some strict servers only allow binding via secure connections
            if ($this->_config["starttls"] === true) {
                if (self::isError($msg = $this->startTLS())) {
                    $current_error           = $msg;
                    var_dump($current_error);die;
                    $this->_link             = false;
                    $this->_down_host_list[] = $host;
                    continue;
                }    
            }

Now when you go to save it should hopefully dump the full PEAR error which should be more detailed.

Cheers.

@GamerClassN7
Copy link
Author

hmm i am getting some wier error
image

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

Windows is horrible for this kind of thing lol Try switching the quotes around (ie. replace single with double and double with single).

Cheers.

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 9, 2023

you were right correct syntax is image

how ever now i get this
image

@JediKev
Copy link
Contributor

JediKev commented May 9, 2023

@GamerClassN7

Continue on to my other steps.

Cheers.

@GamerClassN7
Copy link
Author

i done them already

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 9, 2023

ou stupid my sql client i had changes pending

still getting same error
image
so that mean error happen before the dump

@GamerClassN7
Copy link
Author

oh /path/to/osticket/include/plugins/auth-ldap/include/Net/LDAP2.php is loadet not net2

@GamerClassN7
Copy link
Author

Now i get big chunk of data mostly dump of configuration in DB

@GamerClassN7
Copy link
Author

how ever on start of string there is something interesting indeed
image

@GamerClassN7
Copy link
Author

I think maybe are we abel to check whitch tls wersion is PHPO using we have mandatory 1.2 and up

@GamerClassN7
Copy link
Author

I am done to day if you will have any sugestions let me know :), i will test them tomorow :)

@GamerClassN7
Copy link
Author

GamerClassN7 commented May 10, 2023

Hi, @JediKev i vas just thinking isng bad vesion of library includet in plugin ? shoudent there be version from folder Net2 ?
I verified everything else, and tested ldaps drom server it self and it is working correctly.

So i am guessing bad version of TLS is used

@GamerClassN7
Copy link
Author

Also i noticed that underliing code in plugin is always prefixing url with ldap:// not ldaps:// if you input ldaps conection.

@GamerClassN7
Copy link
Author

Additional test with ldp.exe is also working with same values so i guess somethin bad is with in the Underliing library :(

@GamerClassN7
Copy link
Author

Hi, any idea what cna be done next ?

@GamerClassN7
Copy link
Author

Hello,
Any news ? @JediKev

Thanks for any info

@JediKev
Copy link
Contributor

JediKev commented Jul 18, 2023

@GamerClassN7

Upgrade to v1.17.4 or v1.18, install the latest build of the LDAP plugin (relevant to the osTicket version you will be upgrading to), and retest.

Cheers.

@GamerClassN7
Copy link
Author

GamerClassN7 commented Aug 21, 2023

@GamerClassN7

Upgrade to v1.17.4 or v1.18, install the latest build of the LDAP plugin (relevant to the osTicket version you will be upgrading to), and retest.

Cheers.

Hello @JediKev,
after update to latest version both OST and Plugins i am getting this error instead of 500

image

i tryed addressed both in IP DNS names formats with and without ldaps://
Normal LDAP is working properly

But will be depreciated when i try to test LDAPS strait from server where IIS is hosted with testing utility it works like a charm just not from OST.

Any suggested next steps ?

@JediKev
Copy link
Contributor

JediKev commented Aug 21, 2023

@GamerClassN7

People have reported issues with LDAPS protocol specifically. For now, use normal LDAP and enable TLS.

Cheers.

@GamerClassN7
Copy link
Author

@JediKev as i described previously this is not possible LDAP will be switched of by our Sec. Department on all domain controllers :(

@JediKev
Copy link
Contributor

JediKev commented Aug 21, 2023

@GamerClassN7

You can always review your AD logs to see why LDAPS is failing. We do not have the time to look into this at the moment but the code is open source allowing you to review the code and make any needed changes to get it working.

Cheers.

@GamerClassN7
Copy link
Author

hello @JediKev,
that is the problem LDAPS request from OST never arrive to AD so there is nothin to analyze, And since OST is persistently striping ldaps:// from addres. could cause the issue since, i saw it in some discussion requarding underlining lib...
Newer mind should be mentioned somewhere that AD LDAPS is not supported on Windows AD even that OST supports MS AD scheme. to save someone vesting theirs times :)

@JediKev
Copy link
Contributor

JediKev commented Aug 21, 2023

@GamerClassN7

I think I do see an issue with the regex. It seems it does have potential to strip the prepended ldaps from the hostname. I will add this to the list to look into.

Cheers.

@JediKev
Copy link
Contributor

JediKev commented Sep 18, 2023

@GamerClassN7

I have a pull that fixes the REGEX and should allow ldap:// and ldaps:// to be type-hinted in the hostname string.

Cheers.

@GamerClassN7
Copy link
Author

Thanks any ATA on it ?

@JediKev
Copy link
Contributor

JediKev commented Sep 19, 2023

@GamerClassN7

Like always, there is no set date, however we do plan on making a release relatively soon. So please stay tuned!

Cheers.

@GamerClassN7
Copy link
Author

Related: #276

@GamerClassN7
Copy link
Author

Any estimated ATA ? @JediKev

@JediKev
Copy link
Contributor

JediKev commented Nov 9, 2023

@GamerClassN7

Look at the pull, it has been merged and is included in the latest build of the plugin.

Cheers.

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