doukanhua0752 2014-06-15 14:03
浏览 49
已采纳

仅限NTLM和PHP的SSO

I try to create a SSO in a Windows Domain using NTLM and no server modules with an Apache2 server on a Linux machine which is not in the Windows domain. Don't know if this is even possible. But I show you now what I've figured out and what I've to know next.

Okay first I turned on the options that my browser (IE and FF) sends the Authorization header with the NTLM data (Message type 1). This works I get a string like:

NTLMSSP²¢1 (±USERS-PCDOMAIN

But what's next? I've to send this string to the server where my AD's running right? So my server is known as SERVER1.DOMAIN and has the IP 192.168.1.14.

With which protocol and in which way can I send now the Message Type 1 to my AD server to get the NTLM challenge message (type 2) back?

I guess I'll have to write something like this:

<?php

$fp = fsockopen("192.168.1.14", 80 /* <--- which port? */, $errno, $errstr, 30);

if (!$fp)
    die("$errstr ($errno)");

fwrite($fp, $headers['Authorization'] . "
");

$ntlmChallengeData = '';

while (!feof($fp)) {
    $ntlmChallengeData .= fgets($fp, 128);
}

fclose($fp);

var_dump($ntlmChallengeData); // The challenge data

But on which port does the Windows Server respond to my NTLM data?

  • 写回答

1条回答 默认 最新

  • dongsi7759 2014-09-12 02:09
    关注

    This is not possible using only PHP. Validating NTLMv2 credentials requires SecureChannel encrypted RPCs with the NETLOGON service of an Active Directory DC. It is an understatement to say that that is a difficult thing to do.

    In a Linux environment your best bet would be to maybe look into the Samba "winbind" package and do the auth at the Apache level. These modules have always been a little clumsy IMO but mod_auth_kerb and mod_auth_winbind are the standard modules for this type of thing last I checked.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?