delano-rye 0.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,13 @@ TODO
5
5
  * Fingerprints: ssh-keygen -l -f id_rsa_repos.pub
6
6
 
7
7
 
8
+ #### 0.4.1 (2009-04-06) #############################
9
+
10
+ * FIXED: Rye::Box.authorize_keys was not disabling safe mode properly
11
+ * ADDED: "rye authorize" now specifically enforces the auth method order
12
+ * FIXED: Disabled debug mode.
13
+
14
+
8
15
  #### 0.4.0 (2009-04-06) #############################
9
16
 
10
17
  * ADDED: to_s and inspect methods for cleaner debugging output
data/bin/rye CHANGED
@@ -41,15 +41,16 @@ command :authorize do |obj|
41
41
 
42
42
  highline = HighLine.new # Used for password prompt
43
43
 
44
- opts = { :debug => nil }
44
+ opts = { :debug => nil, :auth_methods => %w(publickey hostbased) }
45
45
  opts[:user] = obj.option.user if obj.option.user
46
46
 
47
47
  obj.argv.each do |hostname|
48
- puts "Authorizing #{hostname}"
48
+
49
49
 
50
50
  retried = 0
51
51
  begin
52
52
  rbox = Rye::Box.new(hostname, opts).connect
53
+ puts "Authorizing #{rbox.opts[:user]}@#{hostname}" if retried == 0
53
54
 
54
55
  # We know we're already authorized b/c we didn't have to give a password
55
56
  if retried == 0
@@ -61,12 +62,16 @@ command :authorize do |obj|
61
62
  # An authentication failure means either the requested user doesn't
62
63
  # exist on the remote machine or we need to supply a password.
63
64
  rescue Net::SSH::AuthenticationFailed => ex
65
+ STDERR.puts
64
66
  retried += 1
65
- opts[:password] = highline.ask("Password: ") { |q| q.echo = '' }
66
- retry unless retried > 3
67
- rescue Net::SSH::AuthenticationFailed
68
- STDERR.puts "Authentication failed."
69
- exit 1
67
+ if retried <= 3
68
+ #opts[:password] = highline.ask("Password: ") { |q| q.echo = '' }
69
+ opts[:auth_methods] = %w(password keyboard-interactive)
70
+ retry
71
+ else
72
+ STDERR.puts "Authentication failed."
73
+ exit 1
74
+ end
70
75
  end
71
76
 
72
77
  puts "Added public keys for: ", rbox.authorize_keys
@@ -117,7 +122,7 @@ command_alias :pubkeys, :pubkey
117
122
 
118
123
 
119
124
  default :keys
120
- debug :on
125
+ debug :off
121
126
 
122
127
  # We can Drydock specifically otherwise it will run at_exit. Rye also
123
128
  # uses at_exit for shutting down the ssh-agent. Ruby executes at_exit
@@ -197,18 +197,18 @@ module Rye
197
197
  #
198
198
  def authorize_keys
199
199
  added_keys = []
200
- opts[:safe] = false
200
+ @safe= false
201
201
  Rye.keys.each do |key|
202
202
  path = key[2]
203
203
  debug "# Public key for #{path}"
204
204
  k = Rye::Key.from_file(path).public_key.to_ssh2
205
- self.mkdir('-p', '~/.ssh') # Silently create dir if it doesn't exist
206
- self.echo("'#{k}' >> ~/.ssh/authorized_keys")
207
- self.echo("'#{k}' >> ~/.ssh/authorized_keys2")
208
- self.chmod('-R', '0600', '.ssh')
205
+ self.mkdir('-p', '$HOME/.ssh') # Silently create dir if it doesn't exist
206
+ self.echo("'#{k}' >> $HOME/.ssh/authorized_keys")
207
+ self.echo("'#{k}' >> $HOME/.ssh/authorized_keys2")
208
+ self.chmod('-R', '0600', '$HOME/.ssh/authorized_keys*')
209
209
  added_keys << path
210
210
  end
211
- opts[:safe] = true
211
+ @safe = true
212
212
  added_keys
213
213
  end
214
214
 
@@ -50,7 +50,7 @@ module Rye;
50
50
  def mkdir(*args); cmd('mkdir', args); end
51
51
  def touch(*args); cmd('touch', args); end
52
52
  def uname(*args); cmd('uname', args); end
53
- def chmod(*args); cmd('uname', args); end
53
+ def chmod(*args); cmd('chmod', args); end
54
54
 
55
55
  def uptime; cmd("uptime"); end
56
56
  def python(*args); cmd('python', args); end
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "rye"
3
3
  s.rubyforge_project = "rye"
4
- s.version = "0.4"
4
+ s.version = "0.4.1"
5
5
  s.summary = "Rye: Run system commands via SSH locally and remotely in a Ruby way."
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delano-rye
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.4"
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum