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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -4
- data/exe/ssbx +46 -0
- data/lib/ssbx/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8cac41924cd31245f471e60522d958da2b6a1d3b88161930aff945440f0b451
|
4
|
+
data.tar.gz: 420bc230bfc9f2df406617d32317cf6b8febc385bbfed6929c0862a59f794312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34009a357a04ffcb61df3c112e228fb18d6152d01e25f54b2e561f1b661e4fe9e4e74478d5828cb3eb108bd2f0f9be02a4ee8a9bce822f0363707993c671b2db
|
7
|
+
data.tar.gz: 976b293b5faa6dcf9ef2ec49e49b971cf77bd3c59b0ee09277d1f0f323b4257e20160103f6d9b8f0d16d5a030f0331e534a7fe1edbcebf5c7b29fae0cd95b81b
|
data/Gemfile.lock
CHANGED
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
|
-
|
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
|
-
|
51
|
-
|
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