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.

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

报告相同问题?

悬赏问题

  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解