通过 SSH 隧道访问 LDAP [英] Accessing LDAP through SSH tunnel

查看:28
本文介绍了通过 SSH 隧道访问 LDAP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 SSH(root 访问)访问了我客户办公室网络内的一台机器.

I got access via SSH (root access) to a Machine that's inside a network at my client's office.

我正在我的计算机上编写一个需要集成到 LDAP 的 PHP 应用程序.LDAP 服务器位于我客户端网络中的另一台服务器中,无法从外部访问,但是我可以通过可以通过 SSH 连接的服务器完美访问它.

I'm programming in my computer a PHP application that needs to integrate to LDAP. The LDAP server is in another server at my client's network and not accesible from outside, however I can perfectly access it via the server I can connect to via SSH.

我的问题是:无论如何,我是否可以在我的计算机中建立隧道并设置一个端口,以使用与网络上其中一台计算机的 SSH 连接将流量转发到 LDAP 服务器?

My question is: IS there anyway I can make a tunnel and setup a port in my computer to get the traffic forwarded to the LDAP server using my SSH connection to one of the computers on the network?

谢谢!!!!

推荐答案

是的,ssh 有一个-L"选项来创建隧道.该选项采用 3 个参数,以冒号 (:) 分隔.本地监听端口、远程主机、远程端口.

Yes, ssh has a "-L" option to create a tunnel. That option takes 3 parameters, separated by colons (:). Local listen port, remote host, remote port.

ssh -L 9999:ldapserver:389 user@otherhost

其中 9999 是将在其上创建隧道的本地端口.ldapserver:389 位告诉它在哪里连接 在另一边.

Where 9999 is the local port that the tunnel will be created on. The ldapserver:389 bit tells it where to connect to on the other side.

然后,告诉您的应用程序连接到 localhost:9999(或您选择的任何端口),它将通过隧道连接.

Then, tell your application to connect to localhost:9999 (or whatever port you choose) and it will be tunneled across.

这篇关于通过 SSH 隧道访问 LDAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆