duostack 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/duostack +43 -5
- data/vendor/duostack-startcom.pem +44 -0
- metadata +5 -4
data/bin/duostack
CHANGED
@@ -28,8 +28,8 @@ $client = File.basename(__FILE__)
|
|
28
28
|
module Duostack
|
29
29
|
class Client
|
30
30
|
|
31
|
-
VERSION = '0.2.
|
32
|
-
DEPENDENCIES_LAST_MODIFIED =
|
31
|
+
VERSION = '0.2.1'
|
32
|
+
DEPENDENCIES_LAST_MODIFIED = 1298683372
|
33
33
|
USER_AGENT = "duostack-#{VERSION}"
|
34
34
|
|
35
35
|
DEFAULTS = {
|
@@ -184,6 +184,15 @@ module Duostack
|
|
184
184
|
exit_with "missing dependency, please install curl (http://curl.haxx.se/download.html)"
|
185
185
|
end
|
186
186
|
|
187
|
+
# curl with --cacert flag (version >= 7.5)
|
188
|
+
version = `curl -V`.split.select { |s| s =~ /^(\d+\.)?(\d+\.)?(\d+\.)?(\*|\d+)$/ }.first # http://stackoverflow.com/questions/82064/a-regex-for-version-number-parsing
|
189
|
+
major, minor, patch = version.split('.').collect { |s| s.to_i } # split on dots and convert to ints
|
190
|
+
major, minor, patch = [major, minor, patch].collect { |v| v ||= 0 } # default each to 0
|
191
|
+
if major < 7 || (major == 7 && minor < 5)
|
192
|
+
exit_with "missing dependency, curl 7.5 or later is required (you have #{version})"
|
193
|
+
end
|
194
|
+
|
195
|
+
|
187
196
|
# curl SSL
|
188
197
|
# handled inside api_host method
|
189
198
|
|
@@ -236,7 +245,8 @@ module Duostack
|
|
236
245
|
end
|
237
246
|
|
238
247
|
def require_ssh_key
|
239
|
-
|
248
|
+
keyfile = ssh_key_location
|
249
|
+
@ssh_key ||= `cat #{keyfile}`.chomp if keyfile
|
240
250
|
unless @ssh_key
|
241
251
|
exit_with "an SSH key is required to run this command, please generate an SSH key and try again (http://docs.duostack.com/command-line-client#setup)"
|
242
252
|
end
|
@@ -305,6 +315,11 @@ module Duostack
|
|
305
315
|
|
306
316
|
# clean up argument
|
307
317
|
argument = CGI::escape(argument)
|
318
|
+
else
|
319
|
+
# ensure we *don't* have any further arguments for list/clear which don't allow them
|
320
|
+
unless @args.empty?
|
321
|
+
exit_with("unrecognized argument: '#{@args.first}', run '#{@client} help #{@command}' for usage")
|
322
|
+
end
|
308
323
|
end
|
309
324
|
|
310
325
|
# finally, process action
|
@@ -366,6 +381,26 @@ module Duostack
|
|
366
381
|
end
|
367
382
|
end
|
368
383
|
|
384
|
+
def ca_cert_location
|
385
|
+
return @ca_cert_location if @ca_cert_location # easy memoization
|
386
|
+
|
387
|
+
candidates = [
|
388
|
+
File.join($dir, '..', 'vendor', 'duostack-startcom.pem'), # gem packages
|
389
|
+
File.join($dir, '.duostack-startcom.pem') # npm, tgz packages
|
390
|
+
]
|
391
|
+
|
392
|
+
candidates.each do |filename|
|
393
|
+
if File.exist?(filename)
|
394
|
+
@ca_cert_location = filename
|
395
|
+
return filename
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
# if we get to this point, the cert wasn't found
|
400
|
+
warn_with "custom certificate authority file not present, using system CA bundle"
|
401
|
+
return nil
|
402
|
+
end
|
403
|
+
|
369
404
|
def api_host
|
370
405
|
@api_host ||= begin
|
371
406
|
host = "https://duostack.duostack.net"
|
@@ -393,11 +428,14 @@ module Duostack
|
|
393
428
|
end
|
394
429
|
|
395
430
|
def curl_get(url, timeout=nil)
|
396
|
-
command = "curl -s
|
431
|
+
command = "curl -s -A '#{USER_AGENT}' -w '\n%{http_code}'" # use w flag to append http status code, set user-agent header
|
432
|
+
command += " --cacert #{ca_cert_location}" if ca_cert_location # use our own certificate if present
|
397
433
|
command += " -m #{timeout}" if timeout
|
398
|
-
|
434
|
+
command += " -v" if ENV['DSDEBUG']
|
435
|
+
command += " '#{url}'" # finally, the actual URL to curl
|
399
436
|
|
400
437
|
debug command
|
438
|
+
raw = `#{command}`
|
401
439
|
debug raw
|
402
440
|
|
403
441
|
# break apart the raw result and extract the HTTP status code, reassemble
|
@@ -0,0 +1,44 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW
|
3
|
+
MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg
|
4
|
+
Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh
|
5
|
+
dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9
|
6
|
+
MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi
|
7
|
+
U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh
|
8
|
+
cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA
|
9
|
+
A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk
|
10
|
+
pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf
|
11
|
+
OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C
|
12
|
+
Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT
|
13
|
+
Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi
|
14
|
+
HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM
|
15
|
+
Av+Z6+hsTXBbKW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@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duostack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Todd Eichel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-28 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- bin/.duostack-console-expect
|
34
34
|
- bin/bash/.duostack-console-expect
|
35
35
|
- bin/duostack
|
36
|
+
- vendor/duostack-startcom.pem
|
36
37
|
has_rdoc: true
|
37
38
|
homepage: http://www.duostack.com/
|
38
39
|
licenses: []
|