Freely inspired by:
- Domain Controller support only (not LDAP);
- authenticate user credentials (not other checks);
- AD groups not supported.
$ git clone https://github.com/davelip/php-ntlm-proxy.git
# clone the repository$ cd php-ntlm-proxy
# enter directory$ composer install
# install dependendancies$ cp .env.example .env
# copy configuration file$ vim .env
# and insert your own configuration$ php server
# run the server
You can test the server connection in two ways (replace 8445 with the port you set in your configuration file):
$ sudo netstat -plunt | grep 8445
If you see a row in the output your server is running
$ telnet localhost 8445
If you enter in interactive mode your server is running and you are communicating with him. Try to write something like type1 123 AAAAA
and press Enter. You should get something like Generic errorConnection closed by foreign host.
For a production environment I suggest to install a tool like supervisord or to run php-ntlm-proxy like a system service (see next paragraphs).
Install it and configure your server.
[program:php-ntlm-proxy]
command=/usr/bin/php server
directory=/path/to/php-ntlm-proxy
stderr_logfile=/var/log/supervisor/php-ntlm-proxy-stderr.log
stdout_logfile=/var/log/supervisor/php-ntlm-proxy-stdout.log
https://maslosoft.com/blog/2019/07/10/running-php-script-as-a-system-service-in-ubuntu/
When the server is correctly configured and up and running you can communicate with him throught socket to validate NTLM credentials.
See the php example in example/auth.php
.
Contact me if you are interested.