2013-08-25 38 views
1

我一直在做很多关于ssh(openssh)和radius的研究。SSH + Radius + LDAP

我想要做什么:

SSH到设备与存储在任何一个RADIUS服务器或LDAP存储的凭据(用户名和密码)。我一直在网上阅读,有些人指出在你的radius服务器的后台运行ldap服务器。这将会起作用,但只有在本地机器中找到用户时才会起作用。

问题: 有没有办法让我ssh(或telnet)通过包含凭据的radius服务器登录到我的设备?如果没有,客户端(我试图连接的计算机)的方式是获取更新的凭证列表,并将其从中央位置本地存储(无论是半径服务器还是sql数据库等)。

我已经能够通过半径,但只能在本地帐户连接,但例如,如果我尝试与本地不存在的帐户连接(客户端明智)我得到“不正确”

下面是半径输出: 代码:

rad_recv: Access-Request packet from host 192.168.4.1 port 5058, id=219, length=85 User-Name = "klopez" 
    User-Password = "\010\n\r\177INCORRECT" 
    NAS-Identifier = "sshd" 
    NAS-Port = 4033 
    NAS-Port-Type = Virtual 
    Service-Type = Authenticate-Only 
    Calling-Station-Id = "192.168.4.200" 

代码:

[ldap] performing user authorization for klopez[ldap] WARNING: Deprecated conditional expansion ":-". See "man unlang" for details 
[ldap]  ... expanding second conditional 
[ldap]  expand: %{User-Name} -> klopez 
[ldap]  expand: (uid=%{Stripped-User-Name:-%{User-Name}}) -> (uid=klopez) 
[ldap]  expand: dc=lab,dc=local -> dc=lab,dc=local 
    [ldap] ldap_get_conn: Checking Id: 0 
    [ldap] ldap_get_conn: Got Id: 0 
    [ldap] performing search in dc=lab,dc=local, with filter (uid=klopez) 
[ldap] No default NMAS login sequence 
[ldap] looking for check items in directory... 
    [ldap] userPassword -> Cleartext-Password == "somepass" 
    [ldap] userPassword -> Password-With-Header == "somepass" 
[ldap] looking for reply items in directory... 
[ldap] user klopez authorized to use remote access 
    [ldap] ldap_release_conn: Release Id: 0 
++[ldap] returns ok 
++[expiration] returns noop 
++[logintime] returns noop 
[pap] Config already contains "known good" password. Ignoring Password-With-Header 
++[pap] returns updated 
Found Auth-Type = PAP 
# Executing group from file /etc/freeradius/sites-enabled/default 
+- entering group PAP {...} 
[pap] login attempt with password "? INCORRECT" 
[pap] Using clear text password "somepass" 
[pap] Passwords don't match 
++[pap] returns reject 
Failed to authenticate the user. 
    WARNING: Unprintable characters in the password. Double-check the shared secret on the server and the NAS! 
Using Post-Auth-Type Reject 
# Executing group from file /etc/freeradius/sites-enabled/default 
+- entering group REJECT {...} 
[attr_filter.access_reject]  expand: %{User-Name} -> klopez 
attr_filter: Matched entry DEFAULT at line 11 
++[attr_filter.access_reject] returns updated 
Delaying reject of request 3 for 1 seconds 

我也有安装pam_radius,其工作(可在登录本地存在的帐户)。虽然我读了这一点,不知道这是不是100%准确:

http://freeradius.1045715.n5.nabble.com/SSH-authendication-with-radius-server-fails-if-the-user-does-not-exist-in-radius-client-td2784316.htmlhttp://fhf.org/archives/713

TL:DR: 我需要ssh到一台机器,没有一个用户/本地通和该组合将被远程存储,例如radius服务器或ldap。

请告知

P.S.

该解决方案最好使用radius服务器或ldap,但不是必需的。如果有替代品,请告知。

感谢,

凯文

回答

2

您可以配置SSH直接反对使用PAM LDAP LDAP服务器进行身份验证。

我已经设定,自己在Debian系统: https://wiki.debian.org/LDAP/PAM https://wiki.debian.org/LDAP/NSS

你需要有PAM和NSS得到SSH工作。您还需要在SSH配置中启用PAM。在Debian(或Ubuntu)系统上安装libnss-ldapd libpam-ldapd和nslcd软件包。