awsqr 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7bfa1f181da8750ca6410247f04ff71661d0cef3
4
+ data.tar.gz: dce0a9f62baac7c28a30ed13a057eb56ec45ec42
5
+ SHA512:
6
+ metadata.gz: 44a57ad18cd6fb21201df3bc369274b4c99588c348ab7b61973595dadc5fc6ac9aa11b18deb9f82f717d2ad203a506566883260177a7f8d48fa75a3a95b67b55
7
+ data.tar.gz: 0c994c098bd12b0314bccb3900475afa9def1faf428e49d5d0fb89452318d43336552ee3a50eec0b1a51133bc51ec39300a5ac0b509a876931f4923957afb2e7
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
4
+ before_install: gem install bundler -v 1.10.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in awsqr.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ # awsqr
2
+
3
+ I have a fair number of AWS accounts. I use it both personally and professionally. I was finding it difficult to add new accounts and keep track of which account / user they were associated in. Most other MFA providers set the issuer field in the QR code which makes life a little easier.
4
+
5
+ This utility is just really to help set the issuer, i suggest you add an account label (--accountlabel) with the name of the account you want.
6
+
7
+ ![Image Showing The Issuer Field Set](/example.png)
8
+
9
+ Personally I think that's a lot clearer! This is only a cli tool, it doesn't display the QRCode in the terminal as I found that ascii art QRCodes didn't work with the google auth app.
10
+
11
+ ## using it
12
+
13
+ ```
14
+ awsqr generate --secret=SECRET --username=USERNAME [--accountlabel=ACCOUNTLABEL --output=OUTPUTIMAGENAME]
15
+ ```
16
+
17
+ output images are png's.
18
+
19
+ ## Contributing
20
+
21
+ Bug reports and pull requests are welcome on GitHub at https://github.com/aughban/awsqr.
22
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'awsqr/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "awsqr"
8
+ spec.version = Awsqr::VERSION
9
+ spec.authors = ["Darius Aliabadi"]
10
+ spec.email = ["darius@dariusaliabadi.com"]
11
+
12
+ spec.summary = "CLI utility to add issuer field to AWS QR Code for IAM MFA"
13
+ spec.description = "CLI utility to add issuer field to AWS QR Code for IAM MFA"
14
+ spec.homepage = "http://github.com/aughban/awsqr"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+
25
+ spec.add_dependency "thor", "~> 0.19"
26
+ spec.add_dependency "rqrcode", "~> 0.7"
27
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "awsqr"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require 'thor'
3
+ require 'rqrcode'
4
+ require 'open-uri'
5
+
6
+ class AWSQRCLI < Thor
7
+ desc "generate", "Generates a QR code with the issuer field filled in"
8
+ option :secret, required: true
9
+ option :username, required: true
10
+ option :accountlabel
11
+ option :output
12
+ def generate()
13
+ if options[:accountlabel].nil? then
14
+ issuer = "Amazon Web Services"
15
+ else
16
+ issuer = "AWS : " + options[:accountlabel]
17
+ end
18
+ issuer = URI::encode(issuer)
19
+
20
+ # https://github.com/google/google-authenticator/wiki/Key-Uri-Format
21
+ qrcode = RQRCode::QRCode.new("otpauth://totp/#{options[:username]}?secret=#{options[:secret]}&issuer=#{issuer}")
22
+
23
+ if options[:output].nil? then
24
+ filename = "output.png"
25
+ else
26
+ filename = options[:output]
27
+ end
28
+
29
+ qrcode.as_png(fill: 'white', color: 'black', size: 420, file: filename)
30
+ end
31
+ end
32
+
33
+ AWSQRCLI.start(ARGV)
Binary file
@@ -0,0 +1,5 @@
1
+ require "awsqr/version"
2
+
3
+ module Awsqr
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module Awsqr
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: awsqr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Darius Aliabadi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.19'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.19'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rqrcode
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.7'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.7'
83
+ description: CLI utility to add issuer field to AWS QR Code for IAM MFA
84
+ email:
85
+ - darius@dariusaliabadi.com
86
+ executables:
87
+ - awsqr
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - README.md
96
+ - Rakefile
97
+ - awsqr.gemspec
98
+ - bin/console
99
+ - bin/setup
100
+ - exe/awsqr
101
+ - image.png
102
+ - lib/awsqr.rb
103
+ - lib/awsqr/version.rb
104
+ homepage: http://github.com/aughban/awsqr
105
+ licenses: []
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.4.5
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: CLI utility to add issuer field to AWS QR Code for IAM MFA
127
+ test_files: []