可以在本機連接到我的 OpenLDAP 伺服器,但不能在外部連接

可以在本機連接到我的 OpenLDAP 伺服器,但不能在外部連接

我的 OpenLDAP 伺服器有問題。我無法從客戶端外部連接到它,它只能在本地工作。我的 OpenLDAP 伺服器在 Raspberry Pi 上運行,以 Rasbian 作為作業系統。

當我從客戶端執行 ldapsearch 時:

$ ldapsearch -h ldap://ldap.fast.com -p 389 -D "dc=fast,dc=com" -x -W

我得到:ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

但是當在樹莓派本地進行時一切正常。

我沒有設定 iptables:

Chain INPUT (policy ACCEPT) 
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain L (0 references)
target     prot opt source               destination

Chain fail2ban-ssh (0 references)
target     prot opt source               destination

這是我的/etc/ldap/ldap.conf文件:

# LDAP Defaults


# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE     dc=fast,dc=com
URI ldap://ldap.fast.com ldap://ldap.fast.com:666

#SIZELIMIT  12
#TIMELIMIT  15
#DEREF      never

# TLS certificates (needed for GnuTLS)
TLS_CACERT  /etc/ssl/certs/ca-certificates.crt

TLSCipherSuite HIGH:MEDIUM:+TLSv1:!SSLv2:+SSLv3
TLSCACertificateFile /etc/ssl/certs/ldap-cert.pem
TLSCertificateFile /etc/ssl/certs/ldap-cert.pem
TLSCertificateKeyFile /etc/ldap/ldap-ssl.pem
TLSVerifyClient demand

我的 FQDN 是:ldap.fast.com

我的網域是:快網

伺服器正在偵聽兩個連接埠(389 和 636),輸出來自ss -tuln | grep -E '389|636'

tcp    LISTEN     0      128                    *:636                   *:*

tcp    LISTEN     0      128                    *:389                   *:*

Telnet 到連接埠 389 和 636 會給出以下結果:

Trying 192.168.1.5...
Connected to ldap.fast.com.
Escape character is '^]'.

任何幫助,將不勝感激。謝謝。

答案1

“-h”用於主機名,“-H”用於 URI。嘗試將您的查詢執行為:

ldapsearch -H ldap://ldap.fast.com:389 -D "dc=fast,dc=com" -x -W

(“-p”不與“-H”一起使用,而是根據需要在 URI 中包含連接埠)

相關內容