ssbx 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea618a7fa764a94771030e3738b78dc913159a5290a6f480f47e4f69d3e77904
4
- data.tar.gz: 99bfc5e3cb999ecbd1e7cf56a730170cdf51c3cfb4ecb951f571184852ef7fc7
3
+ metadata.gz: e8cac41924cd31245f471e60522d958da2b6a1d3b88161930aff945440f0b451
4
+ data.tar.gz: 420bc230bfc9f2df406617d32317cf6b8febc385bbfed6929c0862a59f794312
5
5
  SHA512:
6
- metadata.gz: c207b0d8f212142e9082658a81c076cc3ca1e5086d955da8a4b928ac7d71863de423fea7b66deadae570a919310f50ee49b3052d80f3291f4c8051ba31bedb9c
7
- data.tar.gz: 809cd8a3024455d9ec92a17218d1566478fd13afe1219374dbe252c57ea72537b9403a6a994be43c9766da724cff3ac19885f8a33ebde7adad497eefb0e2a9c4
6
+ metadata.gz: 34009a357a04ffcb61df3c112e228fb18d6152d01e25f54b2e561f1b661e4fe9e4e74478d5828cb3eb108bd2f0f9be02a4ee8a9bce822f0363707993c671b2db
7
+ data.tar.gz: 976b293b5faa6dcf9ef2ec49e49b971cf77bd3c59b0ee09277d1f0f323b4257e20160103f6d9b8f0d16d5a030f0331e534a7fe1edbcebf5c7b29fae0cd95b81b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ssbx (0.1.3)
4
+ ssbx (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -29,10 +29,13 @@ editor: vi
29
29
 
30
30
  Then use `ssbx` to view or edit a file.
31
31
 
32
+ If you set the password to `prompt` then you will be prompted for your password. This is highly preferred.
33
+
32
34
  ## Simple Recipes
33
35
 
34
36
  # Add a user with a simple password.
35
- sbx -f f1.enc -a user1:userpass
37
+ ssbx -f f1.enc -a user1:userpass
38
+ ssbx -f a -u user1 --passwd
36
39
 
37
40
  # ... or
38
41
  cat f1.enc | ssbx -f - -a user1:userpass > f2.enc
@@ -47,9 +50,8 @@ Then use `ssbx` to view or edit a file.
47
50
  ssbx -f f1.enc -e
48
51
 
49
52
  # Rotate passwords.
50
- cp ~/.ssbx.yaml tmpconfig
51
- # Edit ~/.ssbx.yaml to contain a new password.
52
- ssbx -f f1.enc --config tmpconfig -o - | ssbx -f f2.enc -i -
53
+ # - Edit ~/.ssbx.yaml to store the new password.
54
+ ssbx -f a -u user1 --passwd
53
55
 
54
56
 
55
57
  ## Development
data/exe/ssbx CHANGED
@@ -34,6 +34,10 @@ OptionParser.new do |opts|
34
34
  CONFIG['edit'] = true
35
35
  end
36
36
 
37
+ opts.on('--passwd', "Prompt for the old and new password and change them on the file for the specified user.") do
38
+ CONFIG['change_password'] = true
39
+ end
40
+
37
41
  opts.on('--init-config', "Configure ~/.ssbx.yaml.") do
38
42
  CONFIG['config'] = true
39
43
  end
@@ -104,6 +108,48 @@ if CONFIG['verbose']
104
108
  pp CONFIG
105
109
  end
106
110
 
111
+ if CONFIG['pass'] == 'prompt'
112
+ require 'io/console'
113
+ print "Enter your password: "
114
+ STDIN.echo = false
115
+ begin
116
+ CONFIG['pass'] = STDIN.readline.chomp
117
+ puts ''
118
+ ensure
119
+ STDIN.echo = true
120
+ end
121
+
122
+ end
123
+
124
+ if CONFIG['change_password']
125
+ require 'io/console'
126
+ STDIN.echo = false
127
+ begin
128
+ print("Old password: ")
129
+ old_pw = STDIN.readline.chomp
130
+ print("\nNew password: ")
131
+ new_pw1 = STDIN.readline.chomp
132
+ print("\nRetype new password: ")
133
+ new_pw2 = STDIN.readline.chomp
134
+ puts ''
135
+
136
+ if new_pw1 != new_pw2
137
+ puts "Old and new passwords do not match. Taking no action."
138
+ else
139
+ f = Ssbx::File.new
140
+ bx = Ssbx::Box.new(f)
141
+
142
+ # Decrypt with the old key.
143
+ data = Ssbx::Util.read(CONFIG['file']) { |io| bx.read(io, CONFIG['user'], old_pw) }
144
+
145
+ Ssbx::Util.write(CONFIG['file']) { |io| bx.write(io, CONFIG['user'], new_pw1, data) }
146
+
147
+ end
148
+ ensure
149
+ STDIN.echo = true
150
+ end
151
+ end
152
+
107
153
  CONFIG['delete_users'].each do |u|
108
154
  f = Ssbx::Util.read(CONFIG['file']) { |io| Ssbx::File.new(io) }
109
155
  bx = Ssbx::Box.new(f)
data/lib/ssbx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ssbx
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssbx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam