ironclad 0.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ecee57ce87717872ff69b6609c85a58ad2d3d3adfb37d95762394101c45dfdf
4
- data.tar.gz: 80663a1fb7783808d5af06cf0e4bc2f0629ee07a1d866add8cdb049fe428001e
3
+ metadata.gz: 1e2b08a6c0985159ff7be4790655703218e7eef6428416a68eba9fe8d039d16b
4
+ data.tar.gz: 0d14ea6406e375cad4f6045ab1e1bf0bcfa6a85deb9a3c995b745d786ef5f823
5
5
  SHA512:
6
- metadata.gz: f1d056f791b496b1d8651118ec1a61868ef3be497c5a0adf21cadcc37920ee34901876427a6b0c3c222a5eb557c29b41d372104ef810d409f0f0d7569a591263
7
- data.tar.gz: fb6eade4c53e500b447b7331398e42a8ad7e112ac273af919bb9a55c21f13111c1340063b8dcc845bffc4b551fdbb5f4d4d0e787b815ecc59a7010b1f23d57a1
6
+ metadata.gz: 2c5bee8e2a72bb805d56c58884d951008a02408e3d99ddfeef8ec4723af1a619b130c5a36f0e668de0f5ddad720116cb50ed3319f8994970e7f65fb01de501a5
7
+ data.tar.gz: 3bc45b204cb6f95ebe763000b13d388c5c737602b273f16380bf2e6dc1f1d4260f896e73b5e855465245ca2bd39e9c9dfc221471109d06bd8b5d2de94af3a0ba
@@ -8,6 +8,12 @@ module Ironclad
8
8
  # persists across this user's sessions and clears on reboot, at which point
9
9
  # a miss simply re-seeds from the source.
10
10
  class Keyctl
11
+ def self.available?
12
+ ENV['PATH'].to_s.split(File::PATH_SEPARATOR).any? do |dir|
13
+ File.executable?(File.join(dir, 'keyctl'))
14
+ end
15
+ end
16
+
11
17
  def read(name)
12
18
  id, status = Open3.capture2('keyctl', 'search', '@u', 'user', name)
13
19
  return unless status.success?
@@ -15,14 +15,15 @@ module Ironclad
15
15
  when /darwin/
16
16
  Keychain.new(account)
17
17
  when /linux/
18
- keyctl_available? ? Keyctl.new : Null.new
18
+ return Keyctl.new if Keyctl.available?
19
+
20
+ warn 'ironclad: keyctl not found, so key caching is disabled and keys ' \
21
+ 'are fetched from the source every time. Install keyutils to ' \
22
+ 'enable the kernel keyring cache.'
23
+ Null.new
19
24
  else
20
25
  Null.new
21
26
  end
22
27
  end
23
-
24
- def keyctl_available?
25
- system('command -v keyctl', out: File::NULL, err: File::NULL)
26
- end
27
28
  end
28
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ironclad
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ironclad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrett Lusso