travis 1.6.18.travis.611.5 → 1.6.18.travis.612.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWQzMDc4OGMyM2Y2Y2Y3MTE4ZTJhMDQxZDA0NmZiOTFlOGJlNjkzNg==
4
+ ZjMzYTAyOTk0M2Y5M2MxNjg1Mzc1MTJjNTgwNzNjMDc5ODk1NDYyMQ==
5
5
  data.tar.gz: !binary |-
6
- ZTdlODBjZDQ5NjQ5OTAxZTAwZDgxMzhlY2Q1MTE3YzAzNmZkZTQ4Yg==
6
+ Njk0YjYwMzBkNzRmNGMwOTEwZDEyOTk0NTA4NzE4NWE2NWJiNWE2MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjA0NjFkODQ1MzhiYjY0YTBhZTM1MDFkMGQ1MDI2Mzg2NjliOGMzNDRlZDcx
10
- ZDgxZmY3ZjU2ZjhhN2MwY2VhZjQ3ZGI1MGJjODFhOGYzMjUyYmUzYzRiNmQ5
11
- MzdlMWE1NTE5NGEwOWRmZTExMzhlODI1NWI0M2RjMmE3ZTczMmI=
9
+ MWE1Y2EzMmQ1OGIzYmQzNmNlYTA5YTRhOTVhYzI0MGM2MGQ0Y2U2YzA2Zjk5
10
+ ZDAwZjM4NjYxODM3ZTc1NzAxMmRjNWQ3N2M4NzQ4ODY3NDJiNjZhOTI4YjYy
11
+ N2FmZDYyY2QyNjAzZTJmYTY2Y2U5OGRjOTk5MTQ5M2EyNWUwOTY=
12
12
  data.tar.gz: !binary |-
13
- ZDcxMjhmOGM4N2NhYzU1Y2YxYjUwYWNhN2ExODAyNWFkYWU3MzgyZjlkMWUw
14
- NmNlMzg4NTZkYjFhN2IzYTA3ZTk2YjFkZDA2ZWQxYzMwMjgxZjcyNjA1NzFk
15
- ODljMjgwMGI1NzEwOWI5YzY2ZGI1YWQyYzYwOGNkZTRlMGE1MDA=
13
+ ZjAyY2RhZGFhMzg2ZTBiZjcxMzE3ZWYzMmRhYmE1MWRiYWMwOWYwNmUzYzcz
14
+ N2ExZTNlMjhlNjZmYTU4M2M0OGNmZGY0ZjM5YmIzOGFkNGNkYjcwZmYyZTc4
15
+ MjBkMjY4MzMzNzg3NTVmNzE5YjM4MmQyNjA2YTRlZDYzMTAwOTg=
data/README.md CHANGED
@@ -1328,6 +1328,7 @@ Config: rvm: 1.9.3
1328
1328
  -s, --stdin upload key read from stdin
1329
1329
  -c, --check set exit code depending on key existing
1330
1330
  -g, --generate generate SSH key and set up for given GitHub user
1331
+ -p, --passphrase PASSPHRASE pass phrase to decrypt with when using --upload
1331
1332
 
1332
1333
  *This feature is for [Pro and Enterprise](#pro-and-enterprise) only.*
1333
1334
 
@@ -2063,6 +2064,8 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
2063
2064
  * Add `--fingerprint` to `pubkey` command.
2064
2065
  * Add `fingerprint` to `Repository#public_key`.
2065
2066
  * Display better error messages for user errors (user data validation failing, etc).
2067
+ * Have `travis sshkey --upload` check that the content is a private key.
2068
+ * Make `travis sshkey --upload` prompt for and remove the pass phrase if the key is encrypted.
2066
2069
 
2067
2070
  **1.6.17** (July 25, 2014)
2068
2071
 
@@ -12,6 +12,7 @@ module Travis
12
12
  on '-s', '--stdin', 'upload key read from stdin'
13
13
  on '-c', '--check', 'set exit code depending on key existing'
14
14
  on '-g', '--generate', 'generate SSH key and set up for given GitHub user'
15
+ on '-p', '--passphrase PASSPHRASE', 'pass phrase to decrypt with when using --upload'
15
16
 
16
17
  def_delegators :repository, :ssh_key
17
18
 
@@ -33,14 +34,17 @@ module Travis
33
34
  end
34
35
 
35
36
  def update_key(value, file)
36
- self.description ||= ask("Key description: ") { |q| q.default = file } if interactive?
37
- say "updating ssh key for #{color slug, :info} with key from #{color file, :info}"
37
+ error "#{file} does not look like a private key" unless value.lines.first =~ /PRIVATE KEY/
38
+ value = remove_passphrase(value)
39
+ self.description ||= ask("Key description: ") { |q| q.default = "Custom Key" } if interactive?
40
+ say "Updating ssh key for #{color slug, :info} with key from #{color file, :info}"
41
+ empty_line
38
42
  ssh_key.update(:value => value, :description => description || file)
39
43
  end
40
44
 
41
45
  def delete_key
42
46
  return if interactive? and not danger_zone? "Remove SSH key for #{color slug, :info}?"
43
- say "removing ssh key for #{color slug, :info}"
47
+ say "Removing ssh key for #{color slug, :info}"
44
48
  ssh_key.delete
45
49
  rescue Travis::Client::NotFound
46
50
  warn "no key found to remove"
@@ -70,6 +74,16 @@ module Travis
70
74
  end
71
75
  end
72
76
 
77
+ def remove_passphrase(value)
78
+ return unless Tools::SSLKey.has_passphrase? value
79
+ return Tools::SSLKey.remove_passphrase(value, passphrase) || error("wrong pass phrase") if passphrase
80
+ error "Key is encrypted, but missing --passphrase option" unless interactive?
81
+ say "The private key is protected by a pass phrase."
82
+ result = Tools::SSLKey.remove_passphrase(value, ask("Enter pass phrase: ") { |q| q.echo = "*" }) until result
83
+ empty_line
84
+ result
85
+ end
86
+
73
87
  def check_access(gh)
74
88
  gh["repos/#{slug}"]
75
89
  rescue GH::Error
@@ -17,6 +17,19 @@ module Travis
17
17
  @to_rsa = OpenSSL::PKey::RSA.new(public_key)
18
18
  end
19
19
 
20
+ def has_passphrase?(key)
21
+ OpenSSL::PKey::RSA.new(key, key)
22
+ false
23
+ rescue OpenSSL::PKey::RSAError
24
+ true
25
+ end
26
+
27
+ def remove_passphrase(key, passphrase)
28
+ OpenSSL::PKey::RSA.new(key, passphrase).to_s
29
+ rescue OpenSSL::PKey::RSAError
30
+ false
31
+ end
32
+
20
33
  def rsa_ssh(key)
21
34
  ['ssh-rsa ', "\0\0\0\assh-rsa#{sized_bytes(key.e)}#{sized_bytes(key.n)}"].pack('a*m').gsub("\n", '')
22
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.18.travis.611.5
4
+ version: 1.6.18.travis.612.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase