ekeygen 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,18 @@
1
+ = ekeygen
2
+
3
+ Generate encrypted environmentkeys. So lets assume you have you got GITHUB account and GITHUB secret and want to store
4
+ them in a secured way on the development machine. Insted of
5
+ GITHUB_ACCOUNT="x,y,z"
6
+ GITHUB_SECRET="b,e,f"
7
+
8
+ You now have a mutch ncer line
9
+ STUFF="aTY..0K"
10
+
11
+ Example
12
+
13
+ $ ekeygen create -a="GITHUB_ACCOUNT='test';GITHUB_SECRET='sasdasdas'" -p="urksannskfdhgkasdkghsdg"
14
+ export STUFF="aTY0R1QwbG54SUlkbE9oVEtEN2ZYd3Q4emdpNVJ0UTlPdzc2L3pQVjlLWG53VXpsRzJTTkV0Ynd2Wk1DCjV3RGtuckVrM2J6Qm16SUNOU1VDckhzUnh3PT0K"
15
+
16
+
17
+ :include:ekeygen.rdoc
18
+
data/bin/ekeygen ADDED
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'symmetric-encryption'
4
+ require 'base64'
5
+
6
+
7
+ begin # XXX: Remove this begin/rescue before distributing your app
8
+ require 'ekeygen'
9
+ rescue LoadError
10
+ STDERR.puts "In development, you need to use `bundle exec bin/todo` to run your app"
11
+ STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
12
+ STDERR.puts "Feel free to remove this message from bin/ekeygen now"
13
+ exit 64
14
+ end
15
+
16
+ include GLI::App
17
+
18
+ program_desc 'Make simple to use encrypted environment keys'
19
+
20
+ version Ekeygen::VERSION
21
+
22
+ desc 'Directory for password file'
23
+ arg_name 'ekeys directory'
24
+ flag [:d, :ekey_directory], :default_value => File.join(ENV['HOME'], '.ekeys')
25
+
26
+ desc 'Create a new combined encrypted environment key'
27
+ command :create do |c|
28
+
29
+ c.desc 'Data to be encrypted'
30
+ c.arg_name 'argument to be encrypted'
31
+ c.flag [:a, :argument], :required => true
32
+
33
+ c.desc 'Encryption password'
34
+ c.arg_name 'Password used to encrypt the value'
35
+ c.flag [:p, :password], :required => true
36
+
37
+ c.desc 'Envirnment variable name'
38
+ c.arg_name 'Name of environment variable to assign key to'
39
+ c.flag [:e, :env_var_name], :default_value => 'STUFF'
40
+
41
+
42
+ c.action do |global_options, options, args|
43
+ SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(
44
+ :key => options[:p],
45
+ :iv => 'dSomeRandomHashStuff!',
46
+ :cipher => 'aes-128-cbc'
47
+ )
48
+
49
+ puts "export #{options[:e].upcase}=\"#{Base64.urlsafe_encode64(SymmetricEncryption.encrypt(options[:a]))}\""
50
+
51
+ end
52
+ end
53
+
54
+ desc 'Encode a environment key'
55
+ command :enc do |c|
56
+
57
+ c.desc 'Data to be encrypted'
58
+ c.arg_name 'argument to be encrypted'
59
+ c.flag [:a, :argument], :required => true
60
+
61
+ c.desc 'Envirnment variable name'
62
+ c.arg_name 'Name of environment variable to assign key to'
63
+ c.flag [:e, :env_var_name], :default_value => 'STUFF'
64
+
65
+ c.action do |global_options, options, args|
66
+ puts "export #{options[:e].upcase}=\"#{Base64.urlsafe_encode64(options[:a])}\""
67
+ puts "import into ruby : #{options[:e]}=Base64.urlsafe_decode64(ENV[\"#{options[:e].upcase}\"])} "
68
+
69
+ end
70
+ end
71
+
72
+
73
+
74
+
75
+
76
+ pre do |global, command, options, args|
77
+ # Pre logic here
78
+ # Return true to proceed; false to abourt and not call the
79
+ # chosen command
80
+ # Use skips_pre before a command to skip this block
81
+ # on that command only
82
+ true
83
+ end
84
+
85
+
86
+ post do |global, command, options, args|
87
+ # Post logic here
88
+ # Use skips_post before a command to skip this
89
+ # block on that command only
90
+ end
91
+
92
+ on_error do |exception|
93
+ # Error logic here
94
+ # return false to skip default error handling
95
+ true
96
+ end
97
+
98
+ exit run(ARGV)
data/ekeygen.rdoc ADDED
@@ -0,0 +1,5 @@
1
+ = ekeygen
2
+
3
+ Generate this with
4
+ ekeygen rdoc
5
+ After you have described your command line interface
data/lib/ekeygen.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'ekeygen/version.rb'
2
+
3
+ # Add requires for other files you add to your project here, so
4
+ # you just need to require this one file in your bin file
@@ -0,0 +1,3 @@
1
+ module Ekeygen
2
+ VERSION = '0.0.6'
3
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ekeygen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Leffen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rdoc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: aruba
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: gli
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
69
+ version: 2.5.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.5.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: symmetric-encryption
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - '='
84
+ - !ruby/object:Gem::Version
85
+ version: 0.9.1
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.9.1
94
+ description:
95
+ email: leffen@gmail.com
96
+ executables:
97
+ - ekeygen
98
+ extensions: []
99
+ extra_rdoc_files:
100
+ - README.rdoc
101
+ - ekeygen.rdoc
102
+ files:
103
+ - bin/ekeygen
104
+ - lib/ekeygen/version.rb
105
+ - lib/ekeygen.rb
106
+ - README.rdoc
107
+ - ekeygen.rdoc
108
+ homepage: http://leffen.com
109
+ licenses: []
110
+ post_install_message:
111
+ rdoc_options:
112
+ - --title
113
+ - ekeygen
114
+ - --main
115
+ - README.rdoc
116
+ - -ri
117
+ require_paths:
118
+ - lib
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 1.8.25
135
+ signing_key:
136
+ specification_version: 3
137
+ summary: Simple tool for generating encrypted environment variables
138
+ test_files: []