【问题标题】:Using Ubuntu, encrypt passwords in bash使用 Ubuntu,在 bash 中加密密码
【发布时间】:2022-12-18 02:24:55
【问题描述】:

我有两个文件:一个用于存储密码,另一个用于读取密码并建立数据库连接。

我怎样才能加密我的密码,以便我可以从另一个文件读取它来访问数据库?

1)密码文件

USER="User_Name"

PASS="Pass" # How do I encrypt this password?

2)读取文件

. Password.txt 

sqlplus.exe -S ${USER}/${PASS}@DBLINK #How can I decrypt the password and use it here?

【问题讨论】:

  • this 是否回答了您的问题?
  • 不太可能。保护文件Password.txt 免受非授权阅读。当然,您可以对其进行加密,但是可以访问您系统的黑客将能够对其进行解密。您只需将 Oracle 密码替换为另一个密码即可。只要这个其他密码以明文形式存储在某个地方,它就不会保护您的凭据。
  • @WernfriedDomscheit 感谢您的评论。没错,我已经多次更改密码,但仍然有人试图入侵我的计算机并访问 Oracle 系统。您介意建议另一种方法吗?
  • 如果有人使用您的用户帐户(甚至具有 root 权限)访问您的机器,那么您就迷路了。保护您的计算机或存储敏感信息的文件夹免受未经授权的访问,这是主要目标。
  • 如果您希望数据库任务在您不在那里输入密码时运行,您可以查看 Oracle 的 dbms_scheduler 以从数据库本身运行它。还有其他身份验证机制(证书、操作系统授权、防火墙),但您需要更详细地了解您的环境以及您要防御的威胁。

标签: bash oracle ubuntu password-encryption


【解决方案1】:

这不是安全论坛......而是......解决由韦恩弗里德·多姆沙伊特,你应该考虑修改文件....../etc/security/access.conf... 以适应您的独特情况。以下是我自己的文件供公众使用的修改版本。

### Permit root login from local            ### Look at /etc/hosts for host IP aliases
+:root:LOCAL localhost myHost
#
###     Permit designated users to access from local
+:username:LOCAL localhost myHost
#
###     Permit all local services/users to access from local
#+:ALL:LOCAL localhost myHost
+:ALL:LOCAL ALL
#
### Deny access to all from any remote (must be last)
-:ALL:ALL

同样对于... /etc/ssh/ssh_config ...

###     Group 1 - Restrictive
    PermitRootLogin no                          ## myHost
    ForwardAgent no                             ## myHost
    ForwardX11 no                               ## myHost
    ForwardX11Trusted no                        ## myHost
    DenyUsers root                              ## myHost
    DenyGroups root                             ## myHost

###     Group 2 - Permissive
    AllowUsers nonexistent                      ## myHost
    AllowGroups nonexistent                     ## myHost

###     Deploy any modifications using:  systemctl restart sshd

这些为您提供了控制从外部访问的最低限度。如果尝试从内部访问,则会遇到完全不同的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-28
    • 2014-12-08
    • 2016-10-03
    • 2012-07-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-08
    相关资源
    最近更新 更多