如何安全地存储 Windows 应用程序的数据库凭据?

发布于 2024-09-17 17:42:29 字数 808 浏览 1 评论 0原文

我有一个 python 应用程序,设计为在 Linux 上作为服务运行,我被要求将其安装在没有 Linux 机器的办公室的 Windows XP 机器上(对我来说,这使它成为一个奇怪且令人困惑的地方,因为我几乎没有 Windows 开发经验)。

在 Linux 上,应用程序有自己的用户,应用程序和数据库凭证文件驻留在只能由该用户访问的加密文件夹中。 (我想声明,我不是密码学家,如果此设置中已经存在明显的安全错误,我很高兴有人向我指出它们!)

我怎样才能达到同等的安全级别在 Windows XP 机器上通过类似或不同的方式?也就是说,如何防止有权访问计算机或磁盘的人更改程序或读取凭据?

一点背景知识:主机 windows box 是具有非管理权限的用户每天使用的工作站。安全资产是个人数据,大致与学校报告等敏感数据一样。该应用程序旨在由大约 10 个人使用,他们使用个人密码(经过加盐和散列处理存储在数据库中)对应用程序进行身份验证。

有一个非常相似的问题得到了答案:

在 Windows 上,您可以将凭据存储在注册表中受 ACL 保护的位置

但是,它并没有涉及保护程序文件的方面,而且它似乎假设了比我目前享受的更高级别的 Windows 体验:) 我不知道如何保护注册表项使用 ACL,也不知道如何从我的程序访问受保护的密钥。对于处于陌生环境中的开发人员来说,如果能获得简单的说明,我们将不胜感激!

I have a python application designed to run as a service on Linux, and I've been asked to install it on a Windows XP box in an office where there are no Linux machines (for me, this makes it a bizarre and confusing place as I have virtually no experience developing for Windows).

On Linux the application has its own user, and the application and database credential file reside in an encrypted folder accessible only by that user. (I'd like to state that I am not a cryptologist, and that if there are already glaring security errors in this set up I'm very happy to have them pointed out to me!)

How can I achieve an equivalent level of security by similar or different means on a Windows XP machine? That is to say, how can I prevent those who have access to the computer or the disk altering the program or reading the credentials?

A little background: the host windows box is a workstation used every day by users with non-administrative privileges. The secure assets are personal data roughly as sensitive as, for example, a school report. The application is intended to be used by about 10 people who authenticate to the application with individual passwords (stored salted and hashed in the database).

There is a very similar question that received the answer:

on Windows you would store the credentials in the registry in a location protected by an ACL

However, it doesn't touch on the aspect of protecting the program files, and further it seems to assume a higher level of Windows experience than I currently enjoy :) I have no idea how to protect registry items with an ACL, nor how I would then be able to access the protected keys from my program. Simple instructions for a developer in an unfamiliar environment would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月下凄凉 2024-09-24 17:42:29

您的问题不清楚您的应用程序的用途以及您的安全要求是什么。我将做出一些假设,并根据它们提供答案。如果这些假设不正确,请在评论中澄清,我会更新。

我假设您有一个应用程序:

  • 将敏感数据存储在数据库中 存储在工作站上安装的 DBMS 中
  • 安装在共享工作站上
  • 每个用户都有自己的登录名(非管理员)
  • 允许不同的用户登录并与之交互他们的数据
  • 用户运行连接到服务的应用程序 服务
  • 与数据库连接,将数据传递给用户
  • 服务在其自己的用户帐户下运行

如果这是正确的,那么您应该不会有太多问题。

该服务可以在任何帐户下运行,但在其中一种标准(本地计算机或网络服务)下运行很容易。配置数据库,以便只有该帐户可以访问它。在 Sql Server 中,我只授予该用户帐户(以及机器上的管理员)登录和访问数据库的权限。

如果用户不是管理员,这是您需要的唯一安全性。现在,当前端连接到服务时,用户可以提供用户名/密码,并且服务可以根据数据库中存储的加盐和散列密码进行身份验证。所有这些都是安全的,只要 1) 每个用户都有自己的登录名 2) 通信是安全的(使用命名管道或 SSL)并且 3) 没有 virii 或键盘记录程序在管理员的凭据下运行。


您可以通过运行 services.msc(或右键单击“我的电脑”并选择“管理”或单击“控制面板”中“管理工具”菜单下的“服务”或可能采用多种不同方式)来配置您的服务在哪个帐户下运行。

打开服务列表,右键单击您的应用程序,然后点击“属性”。从那里开始,让它看起来像这样:
替代文字

Your question is unclear about what your application does and what your security requirements are. I'm going to make some assumptions, and provide an answer based on them. If these assumptions are incorrect, please clarify in a comment and I'll update.

I'm assuming you have an application that:

  • stores sensitive data in a database stored in a DBMS installed on the workstation
  • is installed on a shared workstation
  • each user has their own login (non-admin)
  • allows different users to log on and interract with their data
  • user runs applicaiton which connects to a service
  • service connects with database, delivers data to users
  • service runs under its own user account

If this is correct, then you shouldn't have much issue.

The service can run under any account, but it would be easy enough to have it run under one of the standards (Local Machine or Network Service). Configure the database so that only this account can access it. In Sql Server, I'd only grant that user account (and admins on the box) login and access rights to the database.

This is the only security you need, if the users aren't admins. Now, when the frontend connects to the service, the user can provide the username/password and the service can authenticate against salted and hashed passwords stored in the database. All this is secure as long as 1) each user has their own login 2) communications are secure (using named pipes or SSL) and 3) no virii or keyloggers are running under an admin's credentials.


You can configure your service as to what account it runs under by running services.msc (or right-clicking on MyComputer and selecting Manage or clicking on Services under the Admin tools menu in Control Panel or probably in a number of different ways).

Bring up the list of services, right click on your app and hit Properties. From there, make it look like this:
alt text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文