gpt4 book ai didi

ssh - SSH + Radius + LDAP

转载 作者:行者123 更新时间:2023-12-02 14:23:33 25 4
gpt4 key购买 nike

我已经对ssh(openssh)和radius进行了大量研究。

我想做的事:

SSH登录到具有存储在Radius服务器或ldap存储中的凭证(用户名和密码)的设备。我一直在网上阅读,有人指出在您的Radius服务器的后台运行ldap服务器。这将起作用,但是仅当在本地计算机中找到用户时才起作用。

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

我已经能够通过Radius进行连接,但只能在本地帐户上进行连接,但是例如,如果我尝试使用本地不存在的帐户进行连接(客户端方式),则会收到“不正确”的提示

这是半径输出:
码:

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.html

http://fhf.org/archives/713

tl:dr:
我需要在没有本地用户/密码的机器上使用ssh,并且该组合将远程存储,例如Radius服务器或ldap。

请指教

附言

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

谢谢,

凯文

最佳答案

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

我已经在Debian Systems上设置了它:
https://wiki.debian.org/LDAP/PAM
https://wiki.debian.org/LDAP/NSS

您需要同时拥有PAM和NSS才能使SSH正常工作。您还需要在SSH配置中启用PAM。在Debian(或Ubuntu)系统上安装libnss-ldapd libpam-ldapd和nslcd软件包。

关于ssh - SSH + Radius + LDAP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18432664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com