centos ntlm centos7哪个版本好
saslauthd验证是否正常工作
认安装CentOS,sasl2所需要的包和sendmail包;2.关闭selinux,否则会影响saslauthd使用shadow认证;vi/etc/selinux/config将SELINUX=enforce改成SELINUX=disabled,需要重新启动计算机生效;
3.修改saslauthd的配置文件,选择使用shadow方式认证;vi/etc/sysconfig/saslauthd将MECH=pam改成
MECH=shadow;
4.启动saslauthd并验证是否正常工作;servicesaslauthdstart#启动saslauthdchkconfigsaslauthdon#设置saslauthd开机自动启动
testsaslauthd-uusername-ppassword如果显示0:OK“Success.”则表明saslauthd工作正常;
5.设置postfix支持smtp认证在main.cf文件中更改如下:
smtpd_sasl_auth_enable= yes
smtpd_sasl_local_domain=''
smtpd_recipient_restrictions=
permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
broken_sasl_auth_clients=yes
smtpd_client_restrictions= permit_sasl_authenticated
smtpd_sasl_security_options= noanonymous
6.编辑/usr/lib/sasl2/smtpd.conf文件,确认其为:
pwcheck_method: saslauthd测试smtp认证telnet127.0.0.125输入:
ehlo 163.com如果在返回的列表中有:
250-AUTH GSSAPI NTLM LOGIN PLAIN
250-AUTH=GSSAPI NTLM LOGIN PLAIN两行,则表明postfix已经启用smtp认证了
PHP Curl出现403错误怎么办
使用curl抓网页下来处理,为了穿墙方便,使用Privoxy作为代理,便于选择哪些网站使用proxy、哪些不用。但今天却遇到了奇怪的问题,访问googlebaidu这些网站居然都返回403错误,而访问其他的一些网站没事,如果设置为不使用proxy则都能正常访问。
难道googlebaidu就不让用proxy连接么?显然不可能,所以打开curl的信息输出(curl_setopt($this->mSh,CURLOPT_VERBOSE,1);)看看,得到以下结果:
.代码如下:
*Trying127.0.0.1...*connected
*Connectedto127.0.0.1(127.0.0.1)port8118(#0)
*EstablishHTTPproxytunneltowww.baidu.com:80
>CONNECTwww.baidu.com:80HTTP/1.0
Host:www.baidu.com:80
User-Agent:Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;SV1)
Proxy-Connection:Keep-Alive
<HTTP/1.0403Connectionnotallowable
<X-Hint:Ifyoureadthismessageinteractively,thenyouknowwhythishappens,-)
<
*TherequestedURLreturnederror:403
*ReceivedHTTPcode403fromproxyafterCONNECT
*Closingconnection#0
...Failed.
可以看到proxy服务器工作正常,的确是baidu返回了403错误,但原因肯定还在我这边。终于,从网上(1of2,2of2)得到了点启发──我使用的是proxytunnel而非proxy。
在代码中,有这么一句:
.代码如下:
curl_setopt($this->mSh,CURLOPT_HTTPPROXYTUNNEL,true);
curl_setopt($this->mSh,CURLOPT_PROXY,$phost);
php文档中没有详细说明,不过mancurl中有详细解释,两者都是代理,proxytunnel(-p参数)允许其他协议通过http代理传输,而proxy(-x参数)则只能走http协议。所以我猜测,googlebaidu的服务器和curl的proxytunnel不和,所以返回403。
禁用掉上面2行代码的第一句后,curl访问恢复正常。
比较奇怪的是,几种操作系统下还不一样,一台MACOSX就要显式的禁用proxytunnel才可以,curl版本:
.代码如下:
$curl--version
curl7.16.3(powerpc-apple-darwin9.0)libcurl/7.16.3OpenSSL/0.9.7lzlib/1.2.3
Protocols:tftpftptelnetdictldaphttpfilehttpsftps
Features:GSS-NegotiateIPv6LargefileNTLMSSLlibz
而另外一台ubuntu则完全不受影响,怎么都能用,curl版本:
.代码如下:
$curl--version
curl7.18.2(i486-pc-linux-gnu)libcurl/7.18.2OpenSSL/0.9.8gzlib/1.2.3.3libidn/1.10
Protocols:tftpftptelnetdictldapldapshttpfilehttpsftps
Features:GSS-NegotiateIDNIPv6LargefileNTLMSSLlibz
MT主机上的centos也没事,curl版本:
.代码如下:
$curl--version
curl7.15.5(i686-redhat-linux-gnu)libcurl/7.15.5OpenSSL/0.9.8bzlib/1.2.3libidn/0.6.5
Protocols:tftpftptelnetdictldaphttpfilehttpsftps
Features:GSS-NegotiateIDNIPv6LargefileNTLMSSLlibz
看来不完全是curl版本问题,MACOSX的确与众不同啊。
还有一个原因也会导致curl返回403错误,如果设置了:
.代码如下:
curl_setopt($ch,CURLOPT_NOBODY,true);
则需要紧跟着设置:
.代码如下:
curl_setopt($ch,CURLOPT_CUSTOMREQUEST,'GET');
不然会因为http服务器不允许HEAD命令而返回403错误。参考:TroublewithacURLrequestinPHP(forums.devshed.com/php-development-5/trouble-with-a-curl-request-in-php-445222.html)。MACOSX上curl之所以特殊,也不排除是这种原因