用于Linux的命令行密码管理器
密码管理应该很简单。
这些命令行密码管理器将我们的凭据,标题,Web URL,Notes和其他详细信息存储在加密的文件中。
我们可以使用这些工具轻松管理我们的凭据。
我们甚至可以管理个体密码文件,这些文件非常容易识别和排序。
这些工具提供了编辑,添加,生成和检索密码的选项。
它包含一个非常简单而简单的shell脚本,可临时将密码暂时放在剪贴板上并跟踪密码更改。
在本文中,我将解释两个命令行密码管理器工具。
Passmgr.
它是简单且便携的密码管理器工具。
它安全地存储密码,并通过命令行检索它们。
在其默认模式下,PISSMGR允许选择存储的密码,然后将其复制到剪贴板,以获得有限的时间,以便将其粘贴到密码字段中。
此后,剪贴板被删除。
所有凭据都存储在一个文件中加密的AES256-GCM,默认情况下位于用户主目录中。
此文件的加密密钥源自使用Scrypt的主密码。
准备工作
- 安装Go.
- 要安装的XCLIP或者XSEL命令
在安装Passmgr之前,我们需要满足这些准备工作。
安装Go.
根据我们的服务器架构,我们可以下载所需的包并提取到安装。
#yum update # wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz # tar -xzvf go1.6.2.linux-amd64.tar.gz -C /usr/local/
我下载了64位架构的包。
我们可以按照以前宽地创建工作文件夹设置环境变量。
# cd /root # mkdir go # cat /etc/profile.d/goenv.sh export GOROOT=/usr/local/go export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin # source /etc/profile.d/goenv.sh # go version go version go1.6.2 linux/amd64
安装XClip或者XSEL
要在CentOS 7服务器中启用这些命令,我们需要安装这些依赖性包,然后安装包安装。
请按照以下步骤启用此命令。
# yum install libX11.x86_64 # yum install libX11-devel.x86_64 # yum install libXmu.x86_64 # yum install libXmu-devel.x86_64 # wget ftp://mirror.switch.ch/pool/4/mirror/epel/7/x86_64/x/xclip-0.12-5.el7.x86_64.rpm # wget http://dl.fedoraproject.org/pub/epel/7/x86_64/x/xsel-1.2.0-15.el7.x86_64.rpm # rpm -Uvh xsel-1.2.0-15.el7.x86_64.rpm warning: xsel-1.2.0-15.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY Preparing... ################################# [100%] Updating/installing... 1:xsel-1.2.0-15.el7 ################################# [100%] # rpm -Uvh xclip-0.12-5.el7.x86_64.rpm warning: xclip-0.12-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY Preparing... ################################# [100%] Updating/installing... 1:xclip-0.12-5.el7 ################################# [100%]
安装passmgr.
完成上述安装后,我们可以在一步一步中启用此PassmgR工具:
# go get github.com/urld/passmgr/cmd/passmgr
现在我们可以运行"passmgr""来为我们的密码管理器工具设置主密码,并使我们的主要条目进行我们的工具。
# passmgr [passmgr] new master passphrase for /root/.passmgr_store: [passmgr] retype master passphrase for /root/.passmgr_store: -- store is empty - Choose a command [(S)elect/(f)ilter/(a)dd/(d)elete/(q)uit] a Enter the values for the new entry User: Saheetha URL: theitroad.com Passphrase: n) User URL 1) Saheetha theitroad.com
passmgr users.
此工具提供了管理密码的各种选项。
我们可以使用这些选项添加,删除,使用特定字符串进行搜索。
我们可以使用此工具运行Help命令以列出所有可能的选项。
# passmgr --help Usage of passmgr: -add store new credentials -appTTL int time in seconds after which the application quits if there is no user interaction (default 120) -clipboardTTL int time in seconds after which the clipboard is reset (default 15) -del delete stored credentials -file string specify the passmgr store (default "/root/.passmgr_store")
例子:
我们可以使用以下选项将新条目添加到我们的密码管理器工具:
# passmgr -add [passmgr] master passphrase for /root/.passmgr_store: docker n) User URL 1) Saheetha theitroad.com Enter the values for the new entry User: [email protected] URL: work.example.com Passphrase: n) User URL 1) Saheetha theitroad.com 2) [email protected] work.example.com
我们可以使用选项 - 文件将凭据存储/读取文件到文件。
默认情况下,所有密码都将存储在"/root/.passmgr_store"文件中。
我们可以使用此命令读取特定条目的密码文件,如下所示:
# passmgr -file /root/.passmgr_store [passmgr] master passphrase for /root/.passmgr_store: n) User URL 1) Saheetha theitroad.com 2) [email protected] work.example.com 3) testuser website.com Choose a command [(S)elect/(f)ilter/(a)dd/(d)elete/(q)uit] 1 Choose a command [(S)elect/(f)ilter/(a)dd/(d)elete/(q)uit] S Select: 1 Passphrase copied to clipboard! Clipboard will be erased in 15 seconds.
我们可以使用过滤器选项将搜索限制为特定字符串,如下所示:
# passmgr [passmgr] master passphrase for /root/.passmgr_store: n) User URL 1) Saheetha theitroad.com 2) [email protected] work.example.com 3) testuser website.com 4) test test.com Choose a command [(S)elect/(f)ilter/(a)dd/(d)elete/(q)uit] f Filter: test n) User URL 3) testuser website.com 4) test test.com
可以通过将其留空来重置过滤器。
要从密码管理器工具中删除条目,我们可以使用选项d或者删除。
请参阅下面的示例:
# passmgr [passmgr] master passphrase for /root/.passmgr_store: n) User URL 1) Saheetha theitroad.com 2) [email protected] work.example.com 3) testuser website.com 4) test test.com Choose a command [(S)elect/(f)ilter/(a)dd/(d)elete/(q)uit] d Delete: 3 Delete all secrets for 'testuser | website.com? [Y/n] y n) User URL 1) Saheetha theitroad.com 2) [email protected] work.example.com 3) test test.com Choose a command [(S)elect/(f)ilter/(a)dd/(d)elete/(q)uit] q
在此示例中,我已从密码管理器中删除了"TestUser"的表项。
2.泰坦
Titan是另一个命令行密码管理器工具,可用于任何UNIX类型的操作系统。
它使用openssl库执行加密。
AES加密与256位键一起使用。
在Titan密码数据库中,还可以使用键控哈希消息认证码(HMAC)免受篡改。
唯一的,加密期间使用加密随机初始化向量。
每次加密密码数据库时都会生成新的初始化向量。
泰坦使用SQLite来存储密码。
数据库架构简单且简单。
我遵循这些步骤为我们的CentOS7服务器安装Titan。
# yum install sqlite-devel.x86_64 sqlite-tcl.x86_64 # yum install openssl-devel # git clone https://github.com/nrosvall/titan.git # cd titan/ # make # make install
泰坦用法
泰坦还提供了一些可通过命令行管理密码的选项。
让我们来看看以下几个:
首先,我们需要创建一个存储密码的数据库。
只需运行此命令,我们就可以创建新数据库。
# titan --init /home/passwords/passwd.db
我们可以在创建时提供密码来保护此数据库。
现在,我们可以使用以下的"--ADD"或者"just -a"选项添加到此数据库的所有必需条目:
# titan --add Title: Work Username: sshameer Url: theitroad.com Notes: Admin notes Password (empty to generate new):
应该解密我们的数据库以添加条目。
要解密它,我们可以使用titan --decrypt [数据库路径]选项。
在这里我们可以使用:
# titan --decrypt /home/passwords/passwd.db
要查看添加的条目,我们可以使用选项`"--list-全部"."
# titan --list-all ===================================================================== ID: 1 Title: Work User: sshameer Url: theitroad.com Password: ** Notes: Admin notes Modified: 2016-07-08 15:11:56 =====================================================================
添加所有可能的条目后,我们应该加密我们的密码数据库以获取安全性。
我们可以运行此命令来加密它。
#titan --encrypt /home/passwords/passwd.db
有关更多信息,请参阅"Man Titan"或者"Titan --Help""
我最近找到了另一个命令行密码管理器"passhole",它使用KeePass数据库。