thales-pse 0.2.2 → 0.3.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.
- checksums.yaml +4 -4
- data/.release_history.yml +2 -0
- data/Gemfile.lock +3 -2
- data/docker/Dockerfile +15 -0
- data/docker/build.sh +3 -0
- data/docker/container.sh +3 -0
- data/lib/thales/pse/cli.rb +22 -4
- data/lib/thales/pse/token.rb +16 -15
- data/lib/thales/pse/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb679e7365c1decbdd2d5f67b3730ac74227b0eae1721807fd576043e91a1188
|
4
|
+
data.tar.gz: 8d0a0f1a0da459a696989c85a2682afbd4ba9617811497d32023390a7e26e22b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b12c2861bacc7bb18714ae1d2422577747ed30008bb09c2bf1395fdf4c5dc57808727b57b08e13e157cec3a4b00297e0788524879e4b6451054fa020524fe3f3
|
7
|
+
data.tar.gz: 968de2560c771ac44ee12951c41fa484bab289c797cb1fad89b093fa0875e727a9a73c4aa7badc3abf73674a03a6801f7a52c43e655b611c94ad8a375948e819
|
data/.release_history.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
thales-pse (0.
|
4
|
+
thales-pse (0.2.2)
|
5
5
|
tlogger
|
6
6
|
toolrack
|
7
7
|
|
@@ -63,6 +63,7 @@ GEM
|
|
63
63
|
PLATFORMS
|
64
64
|
java
|
65
65
|
universal-java-1.8
|
66
|
+
universal-java-11
|
66
67
|
x86_64-linux
|
67
68
|
|
68
69
|
DEPENDENCIES
|
@@ -72,4 +73,4 @@ DEPENDENCIES
|
|
72
73
|
thales-pse!
|
73
74
|
|
74
75
|
BUNDLED WITH
|
75
|
-
2.2.
|
76
|
+
2.2.29
|
data/docker/Dockerfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
FROM rvm-dev
|
3
|
+
|
4
|
+
WORKDIR /opt
|
5
|
+
COPY PTKcpsdk-5.9.0-RC5.x86_64.rpm .
|
6
|
+
|
7
|
+
#RUN apt-get update && apt-get install -y alien && alien -i *.rpm
|
8
|
+
RUN apt-get install -y alien && cd /opt && alien --scripts -i *.rpm
|
9
|
+
RUN ln -s /opt/safenet/protecttoolkit5/cpsdk/lib/linux-x86_64/libctsw.so /usr/lib/libcryptoki.so
|
10
|
+
RUN ln -s /opt/safenet/protecttoolkit5/cpsdk/lib/linux-x86_64/libethsm.so /usr/lib/libethsm.so
|
11
|
+
|
12
|
+
ENV PATH="/opt/safenet/protecttoolkit5/cpsdk/bin:/opt/safenet/protecttoolkit5/cpsdk/bin/linux-x86_64:$PATH"
|
13
|
+
|
14
|
+
ENTRYPOINT [ "/bin/bash", "--login" ]
|
15
|
+
|
data/docker/build.sh
ADDED
data/docker/container.sh
ADDED
data/lib/thales/pse/cli.rb
CHANGED
@@ -28,29 +28,47 @@ module Thales
|
|
28
28
|
|
29
29
|
PTY.spawn(exePath, *params) do |read, write, pid|
|
30
30
|
|
31
|
+
cont = ""
|
32
|
+
timeoutAfter = 1
|
31
33
|
begin
|
32
34
|
|
35
|
+
logger.tdebug :cmd, "expect list : #{expect_list}"
|
33
36
|
if not is_empty?(expect_list)
|
34
37
|
expect_list.each do |ex|
|
38
|
+
timeoutAfter = ex[:timeout_after] || 5
|
39
|
+
logger.tdebug :cmd, "expect list element : #{ex}"
|
35
40
|
to = ex[:timeout] || 1
|
41
|
+
logger.tdebug :cmd, "Expecting : #{ex[:matcher]}"
|
36
42
|
cont = read.expect(/#{ex[:matcher]}/, to)
|
37
|
-
output.puts cont
|
38
|
-
|
43
|
+
output.puts cont.first if not_empty?(cont)
|
44
|
+
v = block.call(ex[:block_key],cont)
|
45
|
+
#logger.tdebug :cmd, "Calling block_key '#{ex[:block_key]}' got #{v}"
|
46
|
+
if not_empty?(v)
|
47
|
+
write.puts v
|
48
|
+
else
|
49
|
+
write.puts ""
|
50
|
+
end
|
51
|
+
#write.puts block.call(ex[:block_key], cont)
|
39
52
|
end
|
40
53
|
end
|
41
54
|
|
42
|
-
Timeout.timeout(
|
55
|
+
Timeout.timeout(timeoutAfter) do
|
43
56
|
read.each do |l|
|
44
57
|
output.puts l if not_empty?(l)
|
45
58
|
end
|
46
59
|
end
|
47
60
|
|
61
|
+
output.puts "[Done2] #{cmd}"
|
62
|
+
|
48
63
|
rescue Timeout::Error => e
|
49
64
|
read.close
|
50
65
|
write.close
|
51
66
|
Process.kill('TERM',pid)
|
52
67
|
output.puts "Process #{cmd} ('#{pid}') killed due to timeout"
|
53
|
-
rescue Errno::EIO
|
68
|
+
rescue Errno::EIO => e
|
69
|
+
#output.puts e.message
|
70
|
+
#output.puts e.backtrace.join("\n")
|
71
|
+
#output.puts "Read : #{cont}"
|
54
72
|
output.puts "[Done] #{cmd}"
|
55
73
|
end
|
56
74
|
end
|
data/lib/thales/pse/token.rb
CHANGED
@@ -23,9 +23,9 @@ module Thales
|
|
23
23
|
raise TokenError, "Slot is not available!" if is_empty?(@slot)
|
24
24
|
|
25
25
|
expect = [
|
26
|
-
{ matcher: "new token label:", block_key: :token_label, timeout:
|
27
|
-
{ matcher: "enter Security Officer\'s pin:", block_key: :token_so_pin, timeout:
|
28
|
-
{ matcher: "confirm Security Officer\'s pin:", block_key: :token_so_pin_confirm, timeout:
|
26
|
+
{ matcher: "new token label:", block_key: :token_label, timeout: 5 },
|
27
|
+
{ matcher: "enter Security Officer\'s pin:", block_key: :token_so_pin, timeout: 5 },
|
28
|
+
{ matcher: "confirm Security Officer\'s pin:", block_key: :token_so_pin_confirm, timeout: 5 }
|
29
29
|
]
|
30
30
|
|
31
31
|
#slot = block.call(:slot) || 0
|
@@ -57,9 +57,9 @@ module Thales
|
|
57
57
|
|
58
58
|
expect = [
|
59
59
|
# this key is handled locally not passed to external
|
60
|
-
{ matcher: "Security Officer PIN.+:|current user PIN.+:", block_key: :auth_pin, timeout:
|
61
|
-
{ matcher: "enter the new user PIN.+:", block_key: :token_user_pin, timeout:
|
62
|
-
{ matcher: "confirm the new user PIN.+:", block_key: :token_user_pin_confirm, timeout:
|
60
|
+
{ matcher: "Security Officer PIN.+:|current user PIN.+:", block_key: :auth_pin, timeout: 5 },
|
61
|
+
{ matcher: "enter the new user PIN.+:", block_key: :token_user_pin, timeout: 5 },
|
62
|
+
{ matcher: "confirm the new user PIN.+:", block_key: :token_user_pin_confirm, timeout: 5 }
|
63
63
|
]
|
64
64
|
|
65
65
|
#slot = block.call(:slot) || 0
|
@@ -98,7 +98,7 @@ module Thales
|
|
98
98
|
raise TokenError, "Slot is not available!" if is_empty?(@slot)
|
99
99
|
|
100
100
|
expect = [
|
101
|
-
{ matcher: "Enter user PIN.+:", block_key: :token_user_pin, timeout: 1 }
|
101
|
+
{ matcher: "Enter user PIN.+:", block_key: :token_user_pin, timeout: 1, timeout_after: 60*5 }
|
102
102
|
]
|
103
103
|
|
104
104
|
type = args.first
|
@@ -183,7 +183,7 @@ module Thales
|
|
183
183
|
raise TokenError, "Slot is not available!" if is_empty?(@slot)
|
184
184
|
|
185
185
|
expect = [
|
186
|
-
{ matcher: "Enter user PIN.+:", block_key: :token_user_pin, timeout:
|
186
|
+
{ matcher: "Enter user PIN.+:", block_key: :token_user_pin, timeout: 60 }
|
187
187
|
]
|
188
188
|
|
189
189
|
keylabel = block.call(:keylabel)
|
@@ -208,19 +208,19 @@ module Thales
|
|
208
208
|
|
209
209
|
cn = block.call(:common_name)
|
210
210
|
raise Error, "Common name is mandatory" if is_empty?(cn)
|
211
|
-
expect << { matcher: "Common Name:", block_key: :cn, timeout:
|
211
|
+
expect << { matcher: "Common Name:", block_key: :cn, timeout: 5 }
|
212
212
|
org = block.call(:org)
|
213
|
-
expect << { matcher: "Organization:", block_key: :org, timeout:
|
213
|
+
expect << { matcher: "Organization:", block_key: :org, timeout: 5 }
|
214
214
|
ou = block.call(:ou)
|
215
|
-
expect << { matcher: "Organizational Unit:", block_key: :ou, timeout:
|
215
|
+
expect << { matcher: "Organizational Unit:", block_key: :ou, timeout: 5 }
|
216
216
|
loc = block.call(:locality)
|
217
|
-
expect << { matcher: "Locality:", block_key: :loc, timeout:
|
217
|
+
expect << { matcher: "Locality:", block_key: :loc, timeout: 5 }
|
218
218
|
st = block.call(:state)
|
219
|
-
expect << { matcher: "State:", block_key: :st, timeout:
|
219
|
+
expect << { matcher: "State:", block_key: :st, timeout: 5 }
|
220
220
|
ctry = block.call(:country)
|
221
|
-
expect << { matcher: "Country:", block_key: :ctry, timeout:
|
221
|
+
expect << { matcher: "Country:", block_key: :ctry, timeout: 5 }
|
222
222
|
sn = block.call(:serial_no) || SecureRandom.uuid.gsub("-","")
|
223
|
-
expect << { matcher: "certificate\'s serial number.+:", block_key: :sn, timeout:
|
223
|
+
expect << { matcher: "certificate\'s serial number.+:", block_key: :sn, timeout: 5 }
|
224
224
|
|
225
225
|
params = ["c","-l#{keylabel}", "-s#{slot}"]
|
226
226
|
if not_empty?(validFrom)
|
@@ -240,6 +240,7 @@ module Thales
|
|
240
240
|
when :params
|
241
241
|
params
|
242
242
|
when :expect_list
|
243
|
+
#[expect[0]]
|
243
244
|
expect
|
244
245
|
when :cn
|
245
246
|
cn
|
data/lib/thales/pse/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thales-pse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian
|
@@ -68,6 +68,9 @@ files:
|
|
68
68
|
- Rakefile
|
69
69
|
- bin/console
|
70
70
|
- bin/setup
|
71
|
+
- docker/Dockerfile
|
72
|
+
- docker/build.sh
|
73
|
+
- docker/container.sh
|
71
74
|
- lib/thales/pse.rb
|
72
75
|
- lib/thales/pse/cli.rb
|
73
76
|
- lib/thales/pse/config.rb
|