The other day there was a task - to provide transparent authorization of domain users in CRM, Microsoft itself had long ago developed the Negotiate HTTP authentication method for this purpose, it all works fine on IIS and Windows Server, and we have Samba4 as Primary Domain Controller and proxy web server nginx. How to be?apt-get install nginx -V wget http://nginx.org/download/nginx-1.11.2.tar.gz tar xvzf nginx-1.11.2.tar.gz cd nginx-1.11.2 git clone https://github.com/stnoonan/spnego-http-auth-nginx-module root@dc1:~# nginx -V nginx version: nginx/1.11.1 built by gcc 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) built with OpenSSL 1.0.2g-fips 1 Mar 2016 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-debug --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed' --add-module=spnego-http-auth-nginx-module ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --add-module=spnego-http-auth-nginx-module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-debug --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed' make make install samba-tool user add HTTP samba-tool user setexpiry HTTP --noexpiry samba-tool spn add HTTP/test.intranet.com HTTP samba-tool spn add host/test.intranet.com HTTP samba-tool domain exportkeytab /etc/http.keytab --principal=HTTP/test.intranet.com samba-tool domain exportkeytab /etc/http.keytab --principal=host/test.intranet.com klist -ke /etc/http.keytab Keytab name: FILE:/etc/http.keytab KVNO Principal ---- -------------------------------------------------------------------------- 1 host/test.intranet.com@INTRANET.COM (des-cbc-crc) 1 host/test.intranet.com@INTRANET.COM (des-cbc-md5) 1 host/test.intranet.com@INTRANET.COM (arcfour-hmac) 1 HTTP/test.intranet.com@INTRANET.COM (des-cbc-crc) 1 HTTP/test.intranet.com@INTRANET.COM (des-cbc-md5) 1 HTTP/test.intranet.com@INTRANET.COM (arcfour-hmac) kinit administrator Password for administrator@INTRANET.COM: Warning: Your password will expire in 39 days on 30 2016 11:23:11 kinit -V -k -t /etc/http.keytab HTTP/test.intranet.com@INTRANET.COM Using default cache: /tmp/krb5cc_0 Using principal: HTTP/test.intranet.com@INTRANET.COM Using keytab: /etc/http.keytab Authenticated to Kerberos v5 kinit: Client not found in Kerberos database while getting initial credentials
I rummaged through the Internet, in the end there was a solution, it turned out that samba-tool does not work out the way Microsoft intended it, unexpectedly, right? server { listen *:443 ssl; server_name test.intranet.com; # error_log /var/log/nginx/debug.log debug; ssl_certificate /etc/nginx/ssl/nginx.crt; ssl_certificate_key /etc/nginx/ssl/nginx.key; location / { proxy_pass http://********/$request_uri; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; auth_gss on; auth_gss_realm INTRANET.COM; auth_gss_keytab /etc/http.keytab; auth_gss_service_name HTTP/test.intranet.com; # auth_gss_allow_basic_fallback off; } } [PHP_AUTH_USER] => Administrator [PHP_AUTH_PW] => bogus_auth_gss_passwdIt remains to finish the web application for transparent authentication a little, but that’s already a web programmer’s ...
"http://test.intranet.com" The "network.negotiate-auth.using-native-gsslib" parameter must be true. google-chrome --auth-server-whitelist="http://test.intranet.com" --auth-negotiate-delegate-whitelist="http://test.intranet.com" Source: https://habr.com/ru/post/305098/
All Articles