如何离线使用 LDAP 凭据?
我想使用 LDAP 服务器(可能是 Apache 目录)来管理应用程序的登录和凭据。 有时,应用程序需要在没有连接到 LDAP 服务器的情况下离线工作(在笔记本电脑上)。
在本地复制凭据的最佳方法是什么?
我已经考虑过:
使用Mitosis 在笔记本电脑上复制 LDAP 服务器。
但这将是一个相当“沉重”且复杂的解决方案。 而且有丝分裂似乎还没有完成。
将凭据导出为可存储在笔记本电脑上的 LDIF 文件。
但我需要一种方法来检查 LDIF 文件是否确实来自 LDAP 服务器(该文件应包含一种签名)。 此外,我想拒绝超过一周没有更新的 LDIF 文件。 如果我能够避免自己实施签名和年龄检查,那就太好了。
还有其他可以帮助我的想法或工具吗?
编辑编辑:我查看了 Kerberos,因为 Java-Kerberos-API 的文档似乎说可以在本地缓存中使用缓存的票证,我我认为这对我来说可能是一个解决方案。 此外,Kerberos 可以作为插件添加到 Apache Directory。 但 Kerberos 缓存存储解密的票证(旨在与其他应用程序共享它们)。 我需要票证的加密版本才能在离线会话期间检查用户密码。 结论:Kerberos 没有为我的问题提供简单的解决方案。
I would like to use an LDAP server (probably Apache directory) to manage logins and credentials for an application. From time to time the application needs to work offline (on a laptop) without a connection to the LDAP server.
What is the best way to replicate the credentials localy?
I have already thought about:
Using Mitosis to replicate the LDAP server on the laptop.
But it would be a quite "heavy" and complicated solution. Moreover Mitosis seems not be be finished yet.
Exporting the credentials as LDIF file that could be stored on the laptop.
But I would need a way to check that the LDIF file actually comes from the LDAP server (The file should include a kind of signature). Moreover I would like to reject LDIF files that haven't be updated for more than a week. It would be nice if I could avoid implementing signing and age check myself.
Any other ideas or tools that could help me?
Edited Edit: I had a look at Kerberos because the documentation of the Java-Kerberos-API seems to say that it is possible to use a cached ticket in a local cache and I thought this might be a solution for me. Moreover Kerberos can be added as plugin to Apache Directory.
But the Kerberos cache stores decrypted tickets (aiming at sharing them with other applications). I would need the crypted version of the ticket to be able to check the user password during an offline session. Conclusion: Kerberos doesn't offer a simple solution to my problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
知道如果用户必须在线登录一次才能离线登录,请考虑以下算法:
(用户名 + 密码)
LDAP
进行身份验证(用户名 + 密码)针对 LDAP 进行身份验证
(用户名)
的哈希(密码)
存储或更新为本地安全的(cached_credentials)
存储[[STOP]]
[[STOP]]
(用户名)
的(cached_credentials)
(cached_credentials)
是否存在并且
比(1 周)
更新?(cached_credentials)
与hash(password)
进行比较[[STOP]]
[[STOP]]
(cached_credentials)
不存在或
比(1 周)
晚?[[STOP]]
这是(或曾经是,IIRC),由顺便说一下,Windows NT+ 使用相同的模型对域控制器进行用户身份验证。 登录后,将尝试对域控制器进行身份验证并创建或更新用户配置文件的本地(缓存)版本。 如果域控制器不可用,系统会提示用户根据本地(缓存)配置文件(如果存在)中捕获的凭据继续进行身份验证。
编辑
Knowing that it will be probably ok if the user have to log on once online before being able to log on offline, consider the following algorithm:
(username + password)
LDAP
for authentication(username + password)
hash(password)
as(cached_credentials)
for(username)
into local secure storage[[STOP]]
[[STOP]]
(cached_credentials)
for(username)
from local secure storage(cached_credentials)
existsAND
more recent than(1 week)
?(cached_credentials)
againsthash(password)
[[STOP]]
[[STOP]]
(cached_credentials)
does not existOR
less recent than(1 week)
?[[STOP]]
This is (or was, IIRC), by the way, the same model employed by Windows NT+ for user authentication against domain controllers. Upon login an attempt is made to authenticate against the domain controller and create or update the local (cached) version of the user profile. If the domain controller is not available, the user is prompted to proceed with authentication against the credentials captured in the local (cached) profile (if one exists.)
EDIT
这是我决定使用的解决方案(我已经在对我的问题的编辑中描述了它,但我希望能够接受“关闭”问题的答案):
由于我还没有找到其他解决方案,所以我决定使用 LDIF 导出,在文件开头添加时间戳作为注释,然后对文件进行签名。 为了对文件进行签名,我计算了文件的哈希值 (SHA-1) + 密钥。 签名作为注释添加在文件的开头。 为了检查签名,我删除了签名文件的第一行并重新计算哈希值。
Here is the solution I decided to use (I have already described it in an edit to my question, but I would like to able to accept an answer to "close" the question):
As I have not found another solution, I decided to use an LDIF export, add a timestamp as comment at the beginning of the file and then sign the file. To sign the file I calculate an hash value (SHA-1) of the file + a secret key. The signature is added as comment at the beginning of the file. To check the signature I remove the first line of the signed file and recalculate the hash value.