What's the best way to use username/password auth in a Ruby script in OS X?

ぃ、小莉子 提交于 2020-01-06 04:50:06

问题


I am working on an automated backup script. This script needs to download an HTTP resource using a username and password. At the moment, the auth credentials are in cleartext, which is obviously not ideal from a security point of view. I recently discovered the security utility on OS X after reading this blog post. security gives you keychain access from the command line. The OS X Keychain allows you to specify applications that are allowed access to a specific password, but it turns out that you can't give myscript access if it in turns calls security, you have to put security, which basically gives access to anyone on the machine.

Aside from creating a user (e.g. "backups") purely for running this script, and giving the script 700 permissions, are there any better ways to solve this problem in OS X 10.5?


回答1:


Basically, anything you store in a way accessible to your program with no user input can be accessed by a determined user. If I were you, I'd just store the credentials in a 0700-permissions file to ensure that only the right people can see it.

If you're wondering why not to obfuscate the passwords, you might want to take a look at Pidgin's policy on the matter:Plain Text Passwords.



来源:https://stackoverflow.com/questions/724195/whats-the-best-way-to-use-username-password-auth-in-a-ruby-script-in-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!