Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux squid basic_ldap_auth从用户名中剥离nt域_Linux_Authentication_Active Directory_Ldap_Squid - Fatal编程技术网

Linux squid basic_ldap_auth从用户名中剥离nt域

Linux squid basic_ldap_auth从用户名中剥离nt域,linux,authentication,active-directory,ldap,squid,Linux,Authentication,Active Directory,Ldap,Squid,我需要从基于windows的代理迁移到linux代理。 在旧服务器中,Squid使用mswin_auth.exe根据Active Directory域对用户进行身份验证。因此,我的用户现在在浏览器弹出窗口中输入ntdomain\username进行代理身份验证 在linux Centos服务器中,Squid将使用basic_ldap_auth,在这种情况下,用户不得输入ntdomain。对我的用户来说,改变旧习惯会很烦人。有没有办法从输入的用户名中自动删除ntdomain 在squid.conf

我需要从基于windows的代理迁移到linux代理。 在旧服务器中,Squid使用mswin_auth.exe根据Active Directory域对用户进行身份验证。因此,我的用户现在在浏览器弹出窗口中输入ntdomain\username进行代理身份验证

在linux Centos服务器中,Squid将使用basic_ldap_auth,在这种情况下,用户不得输入ntdomain。对我的用户来说,改变旧习惯会很烦人。有没有办法从输入的用户名中自动删除ntdomain

在squid.conf中,我有

    auth_param basic program /usr/lib64/squid/basic_ldap_auth -R -b "dc=ntdomain,dc=parentd,dc=it" -D "CN=squid,OU=Squid,OU=Sede,DC=ntdomain,DC=parentd,DC=it" -W /etc/squid/squid.adpwd -f sAMAccountName=%s -h vfdc1.ntdomain.parentd.it
        ...
    external_acl_type ldap_group %LOGIN /usr/lib64/squid/ext_ldap_group_acl -R -b "dc=ntdomain,dc=parentd,dc=it" -D "CN=squid,OU=Squid,OU=Sede,DC=ntdomain,DC=parentd,DC=it" -W /etc/squid/squid.adpwd -f "(&(objectclass=person) (sAMAccountname=%u)(memberof:1.2.840.113556.1.4.1941:=cn=%g,OU=Squid,OU=Sede,DC=ntdomain,DC=parentd,DC=it))" -h vfdc1.ntdomain.parentd.it -S

提前感谢

这是我的解决方案:我创建了一个基于sed的小型bash脚本来剥离域,并使用它squid.conf,如中所示

auth_param basic program /usr/local/bin/squid_auth
其中文件/usr/local/bin/squid\u auth是

#!/bin/bash
/usr/bin/sed -u "s/^ve[\\]//i"|/usr/bin/sed -u "s/^ve%5c//i"|/usr/lib64/squid/basic_ldap_auth  -R -b "dc=ve,dc=dipvvf,dc=it" -D "CN=squid,OU=Squid,OU=Sede,DC=ve,DC=dipvvf,DC=it" -W /etc/squid/squid.adpwd -f sAMAccountName=%s -h vfdc1.ve.dipvvf.it

域名是ve

在您的请求中使用-K选项可以从用户名中删除Kerberos领域: external_acl_type ldap_group %LOGIN /usr/lib64/squid/ext_ldap_group_acl -R -K -b "dc=ntdomain,dc=parentd,dc=it" -D "CN=squid,OU=Squid,OU=Sede,DC=ntdomain,DC=parentd,DC=it" -W /etc/squid/squid.adpwd -f "(&(objectclass=person) (sAMAccountname=%u)(memberof:1.2.840.113556.1.4.1941:=cn=%g,OU=Squid,OU=Sede,DC=ntdomain,DC=parentd,DC=it))" -h vfdc1.ntdomain.parentd.it 一切都会好的