autosign 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +1 -2
- data/Gemfile.lock +20 -15
- data/LICENSE +201 -0
- data/autosign.gemspec +2 -2
- data/bin/autosign +9 -7
- data/bin/autosign-validator +9 -2
- data/lib/autosign/config.rb +8 -7
- data/lib/autosign/decoder.rb +7 -3
- data/lib/autosign/journal.rb +2 -2
- data/lib/autosign/token.rb +3 -3
- data/lib/autosign/validator.rb +2 -2
- data/lib/autosign/version.rb +1 -1
- data/spec/specs/decoder_spec.rb +8 -0
- metadata +46 -45
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTQxY2ZlNmZlODE4NDBkOWU4OWY3OGYwY2UxZjMxNTA3NzNhMWE1OA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a408db14ff5f1ab3bdf26ff21c3807b88a5ac9bf
|
4
|
+
data.tar.gz: 79dcf642bc0965605a45594397e73872061d2159
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
M2E2NGQ5YjIyODk5NmIzOTRlNDE5YTdlODU5NjAyYjhmMGViM2NlYWVmNmJj
|
11
|
-
ZGNmYTA5YzNiYzY0NGVjZmJmNWQ0NjhkNjUwZmQ0OTdiNWMxNjk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YTFjM2QyNjJkN2RmYzUzZDNkYWI2ZTcyODM2MzkwMTExYzhlMjkyMDc0NGIz
|
14
|
-
Y2JiZmJhNGQyNWNlNTIwODg2YmUyNGMxYmQyMDI2Njc1MWFlYTY0MTkyMjMz
|
15
|
-
YmViNzBjYTVjNmYzY2Y0ODkzZjk1ZWNlN2M3OWMyMTgxY2MzNzg=
|
6
|
+
metadata.gz: '08d0db1656abb18f7036a112c25a5abb25d813aba6edb250cd28e0e40f68566bbc77a2a37c1aabb910e9cc5193198d08cd40e960e6e438e6978b9c18389cccdc'
|
7
|
+
data.tar.gz: 86003a00b10e13440592a0c18fcb446d767a74fdd4827aabf3ead3ed8c5978bbdeefa54f87d9c9f56ae67d48e1f6b3e9ab82702ebd006e139a02ef2f34a7dd6a
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,29 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
autosign (0.1.
|
4
|
+
autosign (0.1.3)
|
5
5
|
deep_merge (~> 1)
|
6
6
|
gli (~> 2)
|
7
7
|
iniparse (~> 1)
|
8
|
-
json (
|
8
|
+
json (>= 1)
|
9
9
|
jwt (~> 1)
|
10
10
|
logging (~> 2)
|
11
11
|
require_all (~> 1)
|
12
|
-
yard (~> 0.
|
12
|
+
yard (~> 0.9.11)
|
13
13
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
17
|
CFPropertyList (2.2.8)
|
18
|
-
aruba (0.
|
18
|
+
aruba (0.10.2)
|
19
19
|
childprocess (~> 0.5.6)
|
20
20
|
contracts (~> 0.9)
|
21
21
|
cucumber (>= 1.3.19)
|
22
|
-
event-bus (~> 0.2)
|
23
22
|
ffi (~> 1.9.10)
|
24
23
|
rspec-expectations (>= 2.99)
|
25
24
|
thor (~> 0.19)
|
26
25
|
builder (3.2.2)
|
27
|
-
childprocess (0.5.
|
26
|
+
childprocess (0.5.9)
|
28
27
|
ffi (~> 1.0, >= 1.0.11)
|
29
28
|
coderay (1.1.0)
|
30
29
|
contracts (0.12.0)
|
@@ -35,36 +34,39 @@ GEM
|
|
35
34
|
term-ansicolor (~> 1.3)
|
36
35
|
thor (~> 0.19.1)
|
37
36
|
tins (~> 1.6.0)
|
38
|
-
cucumber (2.
|
37
|
+
cucumber (2.2.0)
|
39
38
|
builder (>= 2.1.2)
|
40
39
|
cucumber-core (~> 1.3.0)
|
40
|
+
cucumber-wire (~> 0.0.1)
|
41
41
|
diff-lcs (>= 1.1.3)
|
42
|
+
event-bus (~> 0.1.0)
|
42
43
|
gherkin3 (~> 3.1.0)
|
43
44
|
multi_json (>= 1.7.5, < 2.0)
|
44
45
|
multi_test (>= 0.1.2)
|
45
46
|
cucumber-core (1.3.1)
|
46
47
|
gherkin3 (~> 3.1.0)
|
47
|
-
|
48
|
+
cucumber-wire (0.0.1)
|
49
|
+
deep_merge (1.2.1)
|
48
50
|
diff-lcs (1.2.5)
|
49
51
|
docile (1.1.5)
|
50
52
|
domain_name (0.5.25)
|
51
53
|
unf (>= 0.0.5, < 1.0.0)
|
52
|
-
event-bus (0.
|
54
|
+
event-bus (0.1.0)
|
53
55
|
facter (2.4.4)
|
54
56
|
CFPropertyList (~> 2.2.6)
|
55
57
|
ffi (1.9.10)
|
56
58
|
gherkin3 (3.1.2)
|
57
|
-
gli (2.
|
59
|
+
gli (2.17.1)
|
58
60
|
hiera (1.3.4)
|
59
61
|
json_pure
|
60
62
|
http-cookie (1.0.2)
|
61
63
|
domain_name (~> 0.5)
|
62
|
-
iniparse (1.4.
|
64
|
+
iniparse (1.4.4)
|
63
65
|
json (1.8.3)
|
64
66
|
json_pure (1.8.3)
|
65
|
-
jwt (1.5.
|
67
|
+
jwt (1.5.6)
|
66
68
|
little-plugger (1.1.4)
|
67
|
-
logging (2.
|
69
|
+
logging (2.2.2)
|
68
70
|
little-plugger (~> 1.1)
|
69
71
|
multi_json (~> 1.10)
|
70
72
|
method_source (0.8.2)
|
@@ -83,7 +85,7 @@ GEM
|
|
83
85
|
rake (10.4.2)
|
84
86
|
rdoc (4.2.1)
|
85
87
|
json (~> 1.4)
|
86
|
-
require_all (1.
|
88
|
+
require_all (1.5.0)
|
87
89
|
rest-client (1.8.0)
|
88
90
|
http-cookie (>= 1.0.2, < 2.0)
|
89
91
|
mime-types (>= 1.16, < 3.0)
|
@@ -114,7 +116,7 @@ GEM
|
|
114
116
|
unf (0.1.4)
|
115
117
|
unf_ext
|
116
118
|
unf_ext (0.0.7.1)
|
117
|
-
yard (0.
|
119
|
+
yard (0.9.12)
|
118
120
|
|
119
121
|
PLATFORMS
|
120
122
|
ruby
|
@@ -129,3 +131,6 @@ DEPENDENCIES
|
|
129
131
|
rake (~> 10)
|
130
132
|
rdoc (~> 4)
|
131
133
|
rspec (~> 3)
|
134
|
+
|
135
|
+
BUNDLED WITH
|
136
|
+
1.16.1
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/autosign.gemspec
CHANGED
@@ -28,8 +28,8 @@ spec = Gem::Specification.new do |s|
|
|
28
28
|
s.add_runtime_dependency('jwt','~> 1')
|
29
29
|
s.add_runtime_dependency('iniparse','~> 1')
|
30
30
|
s.add_runtime_dependency('logging', '~> 2')
|
31
|
-
s.add_runtime_dependency('json', '
|
31
|
+
s.add_runtime_dependency('json', '>=1')
|
32
32
|
s.add_runtime_dependency('deep_merge', '~> 1')
|
33
33
|
s.add_runtime_dependency('require_all', '~> 1')
|
34
|
-
s.add_runtime_dependency('yard', '~> 0.
|
34
|
+
s.add_runtime_dependency('yard', '~> 0.9.11')
|
35
35
|
end
|
data/bin/autosign
CHANGED
@@ -112,7 +112,7 @@ command :config do |c|
|
|
112
112
|
c.command :setup do |setup|
|
113
113
|
setup.action do |global_options,options,args|
|
114
114
|
@logger.info "setup command ran with #{global_options} #{options} #{args}"
|
115
|
-
result = Autosign::Config.generate_default
|
115
|
+
result = Autosign::Config.generate_default({'config_file' => global_options['config']})
|
116
116
|
STDOUT.puts "generated default config file at #{result}" if result
|
117
117
|
end
|
118
118
|
end
|
@@ -134,17 +134,19 @@ pre do |global,command,options,args|
|
|
134
134
|
# chosen command
|
135
135
|
# Use skips_pre before a command to skip this block
|
136
136
|
# on that command only
|
137
|
-
|
138
|
-
|
137
|
+
config = Autosign::Config.new
|
138
|
+
@logger.level = config.settings.to_hash['general']['loglevel'].to_sym unless config.settings.to_hash['general']['loglevel'].nil?
|
139
139
|
|
140
140
|
@logger.level = :error if global['quiet']
|
141
141
|
@logger.level = :info if global['verbose']
|
142
142
|
@logger.level = :debug if global['debug']
|
143
143
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
144
|
+
stdout_layout = Logging.layouts.pattern(:pattern => "%-5l -- %c : %m\n")
|
145
|
+
@logger.add_appenders Logging.appenders.stdout(:layout => stdout_layout)
|
146
|
+
|
147
|
+
unless global['logfile'].nil?
|
148
|
+
file_layout = Logging.layouts.pattern(:pattern => "%d %-5l -- %c : %m\n", :date_pattern => "%Y-%m-%dT%H:%M:%S.%s")
|
149
|
+
@logger.add_appenders Logging.appenders.file(global['logfile'], :layout => file_layout)
|
148
150
|
end
|
149
151
|
|
150
152
|
true
|
data/bin/autosign-validator
CHANGED
@@ -5,14 +5,21 @@ require 'logging'
|
|
5
5
|
|
6
6
|
### Start logging
|
7
7
|
@logger = Logging.logger['Autosign']
|
8
|
-
@logger.level = :
|
8
|
+
@logger.level = :warn
|
9
9
|
|
10
10
|
# Start logging to stdout first so we get errors while loading the config file
|
11
11
|
@logger.add_appenders Logging.appenders.stdout
|
12
12
|
|
13
13
|
# Load config and then add logfile as a log appender
|
14
14
|
config = Autosign::Config.new
|
15
|
-
|
15
|
+
|
16
|
+
unless config.settings['general']['logfile'].nil?
|
17
|
+
file_layout = Logging.layouts.pattern(:pattern => "%d %-5l -- %c : %m\n", :date_pattern => "%Y-%m-%dT%H:%M:%S.%s")
|
18
|
+
@logger.add_appenders Logging.appenders.file(config.settings['general']['logfile'], :layout => file_layout)
|
19
|
+
end
|
20
|
+
|
21
|
+
@logger.level = config.settings['general']['loglevel'].to_sym unless config.settings['general']['loglevel'].nil?
|
22
|
+
|
16
23
|
### End logging initialization
|
17
24
|
|
18
25
|
### Get Inputs
|
data/lib/autosign/config.rb
CHANGED
@@ -36,13 +36,13 @@ module Autosign
|
|
36
36
|
# @return [Autosign::Config] instance of the Autosign::Config class
|
37
37
|
def initialize(settings_param = {})
|
38
38
|
# set up logging
|
39
|
-
@log = Logging.logger[
|
40
|
-
@log.debug "initializing
|
39
|
+
@log = Logging.logger[self.class]
|
40
|
+
@log.debug "initializing #{self.class.name}"
|
41
41
|
# validate parameter
|
42
42
|
raise 'settings is not a hash' unless settings_param.is_a?(Hash)
|
43
43
|
|
44
44
|
# look in the following places for a config file
|
45
|
-
@config_file_paths = ['/etc/autosign.conf', '/usr/local/etc/autosign.conf']
|
45
|
+
@config_file_paths = ['/etc/puppetlabs/puppetserver/autosign.conf', '/etc/autosign.conf', '/usr/local/etc/autosign.conf']
|
46
46
|
|
47
47
|
# HOME is unset when puppet runs, so we need to only use it if it's set
|
48
48
|
@config_file_paths << File.join(Dir.home, '.autosign.conf') unless ENV['HOME'].nil?
|
@@ -59,7 +59,7 @@ module Autosign
|
|
59
59
|
def settings
|
60
60
|
@log.debug "merging settings"
|
61
61
|
setting_sources = [default_settings, configfile, @settings]
|
62
|
-
merged_settings = setting_sources.inject({}) { |merged, hash| merged.deep_merge(hash) }
|
62
|
+
merged_settings = setting_sources.inject({}) { |merged, hash| merged.deep_merge!(hash) }
|
63
63
|
@log.debug "using merged settings: " + merged_settings.to_s
|
64
64
|
return merged_settings
|
65
65
|
end
|
@@ -132,7 +132,7 @@ module Autosign
|
|
132
132
|
# Generate a default configuration file
|
133
133
|
# As a convenience for the user, we can generate a default config file
|
134
134
|
# This class is currently too tightly coupled with the JWT token validator
|
135
|
-
def self.generate_default()
|
135
|
+
def self.generate_default(settings_param = {})
|
136
136
|
os_defaults = (
|
137
137
|
case RbConfig::CONFIG['host_os']
|
138
138
|
when /darwin|mac os/
|
@@ -189,8 +189,9 @@ module Autosign
|
|
189
189
|
# jwt_token.option(";password", 'another_static_autosign_password')
|
190
190
|
# end
|
191
191
|
# end.to_ini
|
192
|
-
|
193
|
-
|
192
|
+
config_file=settings_param['config_file'] || os_defaults['confpath']
|
193
|
+
raise Autosign::Exceptions::Error, "file #{config_file} already exists, aborting" if File.file?(config_file)
|
194
|
+
return config_file if File.write(config_file, config.to_yaml)
|
194
195
|
end
|
195
196
|
end
|
196
197
|
end
|
data/lib/autosign/decoder.rb
CHANGED
@@ -9,7 +9,7 @@ module Autosign
|
|
9
9
|
# @param csr[String] X509 format CSR
|
10
10
|
# @return [Hash] hash containing :challenge_password and :common_name keys
|
11
11
|
def self.decode_csr(csr)
|
12
|
-
@log = Logging.logger[
|
12
|
+
@log = Logging.logger[self.class]
|
13
13
|
@log.debug "decoding CSR"
|
14
14
|
|
15
15
|
begin
|
@@ -23,8 +23,12 @@ module Autosign
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# extract challenge password
|
26
|
-
|
27
|
-
challenge_password =
|
26
|
+
challenge_attr = csr.attributes.find { |a| a.oid == 'challengePassword' }
|
27
|
+
challenge_password = if challenge_attr
|
28
|
+
challenge_attr.value.value.first.value.to_s
|
29
|
+
else
|
30
|
+
nil
|
31
|
+
end
|
28
32
|
|
29
33
|
# extract common name
|
30
34
|
common_name = /^\/CN=(\S*)$/.match(csr.subject.to_s)[1]
|
data/lib/autosign/journal.rb
CHANGED
@@ -15,8 +15,8 @@ module Autosign
|
|
15
15
|
# @param settings [Hash] config settings for the new journal instance
|
16
16
|
# @return [Autosign::Journal] instance of the Autosign::Journal class
|
17
17
|
def initialize(settings = {})
|
18
|
-
@log = Logging.logger[
|
19
|
-
@log.debug "initializing
|
18
|
+
@log = Logging.logger[self.class]
|
19
|
+
@log.debug "initializing #{self.class.name}"
|
20
20
|
@settings = settings
|
21
21
|
fail unless setup
|
22
22
|
end
|
data/lib/autosign/token.rb
CHANGED
@@ -33,8 +33,8 @@ module Autosign
|
|
33
33
|
# @return [Autosign::Config] instance of the Autosign::Config class
|
34
34
|
def initialize(certname, reusable=false, validfor=7200, requester, secret)
|
35
35
|
# set up logging
|
36
|
-
@log = Logging.logger[
|
37
|
-
@log.debug "initializing"
|
36
|
+
@log = Logging.logger[self.class]
|
37
|
+
@log.debug "initializing #{self.class.name}"
|
38
38
|
|
39
39
|
@validfor = validfor
|
40
40
|
@certname = certname
|
@@ -56,7 +56,7 @@ module Autosign
|
|
56
56
|
# @param hmac_secret [String] Password that the token was (hopefully) originally signed with.
|
57
57
|
# @return [True, False] returns true if the token can be validated, or false if the token cannot be validated.
|
58
58
|
def self.validate(requested_certname, token, hmac_secret)
|
59
|
-
@log = Logging.logger[
|
59
|
+
@log = Logging.logger[self.class]
|
60
60
|
@log.debug "attempting to validate token"
|
61
61
|
@log.info "attempting to validate token for: #{requested_certname.to_s}"
|
62
62
|
errors = []
|
data/lib/autosign/validator.rb
CHANGED
@@ -92,7 +92,7 @@ module Autosign
|
|
92
92
|
# @param raw_csr [String] the encoded X509 certificate signing request, as received by the autosign policy executable
|
93
93
|
# @return [True, False] return true if the certificate should be signed, and false if it cannot be validated
|
94
94
|
def self.any_validator(challenge_password, certname, raw_csr)
|
95
|
-
@log = Logging.logger[self.
|
95
|
+
@log = Logging.logger[self.class]
|
96
96
|
# iterate over all known validators and attempt to validate using them
|
97
97
|
results_by_validator = {}
|
98
98
|
results = self.descendants.map {|c|
|
@@ -120,7 +120,7 @@ module Autosign
|
|
120
120
|
# this is automatically called when the class is initialized; do not
|
121
121
|
# override it in child classes.
|
122
122
|
def start_logging
|
123
|
-
@log = Logging.logger[
|
123
|
+
@log = Logging.logger[self.class]
|
124
124
|
@log.debug "starting autosign validator: " + self.name.to_s
|
125
125
|
end
|
126
126
|
|
data/lib/autosign/version.rb
CHANGED
data/spec/specs/decoder_spec.rb
CHANGED
@@ -3,14 +3,22 @@ require 'spec_helper'
|
|
3
3
|
context Autosign::Decoder do
|
4
4
|
describe '.decode_csr' do
|
5
5
|
let(:csr) { File.read(File.join('fixtures', 'i-7672fe81.pem')) }
|
6
|
+
|
6
7
|
it 'Accepts a CSR as the parameter' do
|
7
8
|
expect { Autosign::Decoder.decode_csr(csr) }.to_not raise_error
|
8
9
|
end
|
10
|
+
|
9
11
|
it 'Extracts the challenge_password and common_name from a CSR' do
|
10
12
|
expect(Autosign::Decoder.decode_csr(csr)).to eq({:challenge_password=>"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJkYXRhIjoie1wiY2VydG5hbWVcIjpcImktNzY3MmZlODFcIixcInJlcXVlc3RlclwiOlwiRGFuaWVscy1NYWNCb29rLVByby0yLmxvY2FsXCIsXCJyZXVzYWJsZVwiOmZhbHNlLFwidmFsaWRmb3JcIjoxNTc2ODAwMDAsXCJ1dWlkXCI6XCJlMzZkMzkyOS05NWVlLTQyNDQtOTIwZS00NmZiN2Y4MTU3ZDVcIn0iLCJleHAiOiIxNTk1MTc3NTc0In0.gfTpUPLGnxwtvfMH5C0ucWsXBqrhBD_HvCiNH_9zvhFafHMij_ng14K8F-MMLgQoDBloOJukjX8qcki5cFmKKg", :common_name=>"i-7672fe81"})
|
11
13
|
end
|
14
|
+
|
12
15
|
it 'Returns nil given an invalid CSR' do
|
13
16
|
expect(Autosign::Decoder.decode_csr("not_a_csr")).to be_nil
|
14
17
|
end
|
18
|
+
|
19
|
+
it 'Does not raise an error decoding a CSR without a challengePassword' do
|
20
|
+
allow_any_instance_of(OpenSSL::X509::Attribute).to receive(:oid).and_return('notTheOidYouAreLookingFor')
|
21
|
+
expect { Autosign::Decoder.decode_csr(csr) }.to_not raise_error
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
metadata
CHANGED
@@ -1,239 +1,239 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autosign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Dreier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: aruba
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: cucumber
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: puppet
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: coveralls
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0.10'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.10'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: gli
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '2'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: jwt
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '1'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: iniparse
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - ~>
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '1'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - ~>
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '1'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: logging
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - ~>
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '2'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - ~>
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '2'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: json
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '1'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '1'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: deep_merge
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- - ~>
|
199
|
+
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '1'
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- - ~>
|
206
|
+
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '1'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: require_all
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- - ~>
|
213
|
+
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '1'
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - ~>
|
220
|
+
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: yard
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- - ~>
|
227
|
+
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
229
|
+
version: 0.9.11
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - ~>
|
234
|
+
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 0.9.11
|
237
237
|
description:
|
238
238
|
email: ddreier@thinkplango.com
|
239
239
|
executables:
|
@@ -242,11 +242,12 @@ executables:
|
|
242
242
|
extensions: []
|
243
243
|
extra_rdoc_files: []
|
244
244
|
files:
|
245
|
-
- .gitignore
|
246
|
-
- .rspec
|
247
|
-
- .travis.yml
|
245
|
+
- ".gitignore"
|
246
|
+
- ".rspec"
|
247
|
+
- ".travis.yml"
|
248
248
|
- Gemfile
|
249
249
|
- Gemfile.lock
|
250
|
+
- LICENSE
|
250
251
|
- README.md
|
251
252
|
- Rakefile
|
252
253
|
- autosign.gemspec
|
@@ -279,27 +280,27 @@ licenses: []
|
|
279
280
|
metadata: {}
|
280
281
|
post_install_message:
|
281
282
|
rdoc_options:
|
282
|
-
- --title
|
283
|
+
- "--title"
|
283
284
|
- autosign
|
284
|
-
- --main
|
285
|
+
- "--main"
|
285
286
|
- README.rdoc
|
286
|
-
- -ri
|
287
|
+
- "-ri"
|
287
288
|
require_paths:
|
288
289
|
- lib
|
289
290
|
- lib
|
290
291
|
required_ruby_version: !ruby/object:Gem::Requirement
|
291
292
|
requirements:
|
292
|
-
- -
|
293
|
+
- - ">="
|
293
294
|
- !ruby/object:Gem::Version
|
294
295
|
version: '0'
|
295
296
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
296
297
|
requirements:
|
297
|
-
- -
|
298
|
+
- - ">="
|
298
299
|
- !ruby/object:Gem::Version
|
299
300
|
version: '0'
|
300
301
|
requirements: []
|
301
302
|
rubyforge_project:
|
302
|
-
rubygems_version: 2.
|
303
|
+
rubygems_version: 2.6.10
|
303
304
|
signing_key:
|
304
305
|
specification_version: 4
|
305
306
|
summary: Tooling to make puppet autosigning easy, secure, and extensible
|