Windows/Apache2.2环境下的Windows登录ID帮助

发布于 2024-07-15 02:44:08 字数 2065 浏览 5 评论 0原文

我确实需要一些帮助来解决这个看似微不足道的问题。 总之,我想知道访问 Windows 环境中 Apache 中运行的 Perl .cgi 的用户的 Window 登录 ID。

这是我的基本 Apache2 conf 添加内容:

---- begin httpd.conf -----

...

LoadModule sspi_auth_module modules/mod_auth_sspi.so
...
<IfModule mod_auth_sspi.c>
    <Location "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
        AuthName "A Protected Place"
        AuthType SSPI
        SSPIAuth On
        SSPIAuthoritative On
        #SSPIBasic On
        SSPIOfferBasic On
        #SSPIDomain On
        #SSPIBasicPreferred
        #SSPIUsernameCase lower
        require valid-user
    </Location>
</IfModule>
...
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
...

---- end httpd.conf -----

此外,我还使用以下优秀说明在我的计算机上启用了 SSL : http://tortoisesvn.net/docs/ release/TortoiseSVN_en/tsvn-serversetup.html#tsvn-serversetup-apache-7

上面的站点要求加载 Apache 模块 mod_auth.so,但我在默认的 Apache2 安装中找不到它。 另外,如您所见,我已手动将 mod_auth_sspi-1.0.4-2.2.2 模块添加到我的 Apache2 环境中。

现在,当我尝试 http://localhost/cgi-bin/test.cgihttps://localhost/cgi-bin/test.cgi< /a>,我在 http/环境变量中没有看到任何与 REMOTE_USER 相关的内容。 我知道 SSL 正在工作,因为 https 调用显示了大量 SSL 变量。 另外,我对 SSL 没有要求,但我只是使用它,因为上面的链接说需要它来获取 Windows 登录信息。

我真的很感激任何见解。 如果有帮助的话,我很乐意完整分享 httpd.conf 文件。 基本上,重申一下,我所寻找的只是一种在 Windows/Apache2.2 托管环境上的 Perl .cgi 中捕获 Windows 登录 ID 的方法。

非常感谢大家的帮助,

Saker Ghani

I really could use some help in solving what appears to be a trivial issue. In summary, I want to know the Window's loginID for the user accessing a Perl .cgi running in Apache on a Windows environment.

Here's my basic Apache2 conf additions:

---- begin httpd.conf -----

...

LoadModule sspi_auth_module modules/mod_auth_sspi.so
...
<IfModule mod_auth_sspi.c>
    <Location "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
        AuthName "A Protected Place"
        AuthType SSPI
        SSPIAuth On
        SSPIAuthoritative On
        #SSPIBasic On
        SSPIOfferBasic On
        #SSPIDomain On
        #SSPIBasicPreferred
        #SSPIUsernameCase lower
        require valid-user
    </Location>
</IfModule>
...
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
...

---- end httpd.conf -----

In addition, I've also enabled SSL on my machine using the excellent instructions at:
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-serversetup.html#tsvn-serversetup-apache-7

The site above calls for loading the Apache module mod_auth.so, but I can't find it in my default Apache2 installation. Also, As you can see, I've manually added the mod_auth_sspi-1.0.4-2.2.2 module to my Apache2 environment.

Now, when I try both http://localhost/cgi-bin/test.cgi AND https://localhost/cgi-bin/test.cgi, I don't see anything in the way of a REMOTE_USER in the http/environment variables. I know the SSL is working because the https call displays a ton of SSL variables. Also, I don't have a requirement for SSL, but am only using it since the link above says it is required to get the Windows login info.

I would really appreciate any insight. I am happy to share the httpd.conf file in full if that is helpful. Basically, to reiterate, all I'm looking for is a way to capture the Windows loginID in my Perl .cgi on a Windows/Apache2.2 hosting environment.

Many many thanks in advance for everyone's help,

Saker Ghani

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生活了然无味 2024-07-22 02:44:08

这可能没有太大帮助,但我不认为您需要做任何特殊的事情来获取这些信息。 我正在使用 mod_auth_sspi 运行 Apache 2.2 安装,并使用 REMOTE_USER 环境变量成功获取您正在查找的信息。 (例如,当我访问其中一个页面时,REMOTE_USER 是“MYDOMAIN\oeuftete”。)

我不使用 SSPIOfferBasic 选项,这是唯一实质性的配置差异,但我认为这并不重要。 我还在指令中指定选项,而不是在单独的指令中指定。

我想我想说的是,根据您所提供的内容,它应该有效。 所以也许还有其他事情发生。


编辑:这是我的 httpd.conf 的基础知识。

LoadModule sspi_auth_module modules/mod_auth_sspi.so

<IfModule mime_module>
    AddHandler cgi-script .pl
</IfModule>

<IfModule alias_module>
    Alias /sotest "C:/Some/path/"
</IfModule>

<Directory "C:/Some/path">
    Options ExecCGI

    Order allow,deny
    Allow from all

    AuthName "Foo"
    AuthType SSPI
    SSPIAuth On
    SSPIAuthoritative On

    require valid-user
</Directory>

该目录中有一个简短的 test.pl 。

#!perl -T
#

use CGI;

my $q = CGI->new;

print $q->header;
print $q->start_html;
print $ENV{'REMOTE_USER'};
print $q->end_html;

这是访问 sotest/test.pl 的结果页面:

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
MYDOMAIN\oeuftete
</body>
</html>

This might not help too much, but I don't believe you need to do anything special to get this information. I'm running an Apache 2.2 installation with mod_auth_sspi and I use the REMOTE_USER environment variable to successfully get the information you're looking for. (For example, when I access one of the pages, REMOTE_USER is "MYDOMAIN\oeuftete".)

I don't use the SSPIOfferBasic option which is the only substantial configuration difference, but I don't think that would matter. I also specify the options in the directive and not in a separate directive.

I guess what I'm saying is, based on what you've given, it should work. So perhaps there's something else going on.


Edit: Here's the basics of my httpd.conf.

LoadModule sspi_auth_module modules/mod_auth_sspi.so

<IfModule mime_module>
    AddHandler cgi-script .pl
</IfModule>

<IfModule alias_module>
    Alias /sotest "C:/Some/path/"
</IfModule>

<Directory "C:/Some/path">
    Options ExecCGI

    Order allow,deny
    Allow from all

    AuthName "Foo"
    AuthType SSPI
    SSPIAuth On
    SSPIAuthoritative On

    require valid-user
</Directory>

And a short test.pl in that directory.

#!perl -T
#

use CGI;

my $q = CGI->new;

print $q->header;
print $q->start_html;
print $ENV{'REMOTE_USER'};
print $q->end_html;

Here's the resulting page from going to sotest/test.pl:

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
MYDOMAIN\oeuftete
</body>
</html>
浮云落日 2024-07-22 02:44:08

不是Windows程序员,所以我不确定loginID是什么,但也许
Win32::LoginName 和 Win32::LookupAccountName 会有帮助吗?

Not a windows programmer, so I'm not sure what a loginID is, but maybe
Win32::LoginName and Win32::LookupAccountName will be of help?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文