From adf8ab5c90fbb5579d231b81a20fe87b33c36f0a Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 29 Dec 2012 17:42:38 +0100 Subject: improve README, get rid off obsolete --pwd-from-stdin --- README.md | 13 +++++++++++-- bin/trocla | 11 ++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7d44bcd..97a81c7 100644 --- a/README.md +++ b/README.md @@ -78,15 +78,24 @@ far. This will ask you for a password and set it under the appropriate key/format. - trocla set --pwd-from-stdin user4 plain mysupersecretpassword + trocla set --password mysupersecretpassword user4 plain This will take the password from the cli without asking you. - trocla set --pwd-from-stdin user5 mysql *ABC.... + trocla set user5 mysql -p *ABC.... This will store a mysql sha1 hash for the key user5, without storing any kind of plain text password. +You can also pipe in a password: + + echo -n foo | trocla set user6 plain -p + +or a file + + cat some_file | trocla set user6 plain -p + trocla set user6 plain -p < some_file + ### reset trocla reset user1 md5crypt diff --git a/bin/trocla b/bin/trocla index ccceb51..ac7389f 100755 --- a/bin/trocla +++ b/bin/trocla @@ -31,16 +31,11 @@ OptionParser.new do |opts| options['length'] = v.to_i end - opts.on("--password PASSWORD", "-p", "Provide password at command line") do |pass| + opts.on("--password [PASSWORD]", "-p", "Provide password at command line") do |pass| options[:ask_password] = false options[:password] = pass end - opts.on("--pwd-from-stdin") do - options[:ask_password] = false - end - - end.parse! def create(options) @@ -70,9 +65,7 @@ def set(options) exit 1 end else - # FIXME: I don't know if we have to delete other options here. - password = options.delete(:password) - password = STDIN.read if not password + password = options.delete(:password) || STDIN.read.chomp end Trocla.new(options.delete(:config_file)).set_password( options.delete(:trocla_key), -- cgit v1.2.3