crypt_reboot 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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +169 -0
  5. data/exe/cryptreboot +9 -0
  6. data/lib/basic_loader.rb +60 -0
  7. data/lib/crypt_reboot/boot_config.rb +24 -0
  8. data/lib/crypt_reboot/cli/exiter.rb +25 -0
  9. data/lib/crypt_reboot/cli/happy_exiter.rb +14 -0
  10. data/lib/crypt_reboot/cli/params/definition.rb +125 -0
  11. data/lib/crypt_reboot/cli/params/flattener.rb +24 -0
  12. data/lib/crypt_reboot/cli/params/help_generator.rb +22 -0
  13. data/lib/crypt_reboot/cli/params/parser.rb +29 -0
  14. data/lib/crypt_reboot/cli/params_parsing_executor.rb +73 -0
  15. data/lib/crypt_reboot/cli/sad_exiter.rb +14 -0
  16. data/lib/crypt_reboot/cli.rb +8 -0
  17. data/lib/crypt_reboot/concatenator.rb +24 -0
  18. data/lib/crypt_reboot/config.rb +20 -0
  19. data/lib/crypt_reboot/crypt_tab/deserializer.rb +28 -0
  20. data/lib/crypt_reboot/crypt_tab/entry.rb +39 -0
  21. data/lib/crypt_reboot/crypt_tab/entry_deserializer.rb +51 -0
  22. data/lib/crypt_reboot/crypt_tab/entry_serializer.rb +21 -0
  23. data/lib/crypt_reboot/crypt_tab/keyfile_locator.rb +21 -0
  24. data/lib/crypt_reboot/crypt_tab/luks_to_plain_converter.rb +39 -0
  25. data/lib/crypt_reboot/crypt_tab/serializer.rb +29 -0
  26. data/lib/crypt_reboot/files_generator.rb +44 -0
  27. data/lib/crypt_reboot/files_writer.rb +17 -0
  28. data/lib/crypt_reboot/gziper.rb +22 -0
  29. data/lib/crypt_reboot/initramfs/archiver.rb +35 -0
  30. data/lib/crypt_reboot/initramfs/decompressor/intolerant_decompressor.rb +65 -0
  31. data/lib/crypt_reboot/initramfs/decompressor/tolerant_decompressor.rb +28 -0
  32. data/lib/crypt_reboot/initramfs/decompressor.rb +12 -0
  33. data/lib/crypt_reboot/initramfs/extractor.rb +36 -0
  34. data/lib/crypt_reboot/initramfs/patcher.rb +47 -0
  35. data/lib/crypt_reboot/initramfs_patch_squeezer.rb +28 -0
  36. data/lib/crypt_reboot/instantiable_config.rb +52 -0
  37. data/lib/crypt_reboot/kexec/loader.rb +30 -0
  38. data/lib/crypt_reboot/kexec_patching_loader.rb +28 -0
  39. data/lib/crypt_reboot/lazy_config.rb +22 -0
  40. data/lib/crypt_reboot/luks/checker.rb +27 -0
  41. data/lib/crypt_reboot/luks/data.rb +37 -0
  42. data/lib/crypt_reboot/luks/data_fetcher.rb +30 -0
  43. data/lib/crypt_reboot/luks/dumper/luks_v1_parser.rb +64 -0
  44. data/lib/crypt_reboot/luks/dumper/luks_v2_parser.rb +62 -0
  45. data/lib/crypt_reboot/luks/dumper.rb +30 -0
  46. data/lib/crypt_reboot/luks/key_fetcher.rb +50 -0
  47. data/lib/crypt_reboot/luks/version_detector.rb +32 -0
  48. data/lib/crypt_reboot/passphrase_asker.rb +15 -0
  49. data/lib/crypt_reboot/patched_initramfs_generator.rb +21 -0
  50. data/lib/crypt_reboot/rebooter.rb +20 -0
  51. data/lib/crypt_reboot/runner/binary.rb +12 -0
  52. data/lib/crypt_reboot/runner/boolean.rb +18 -0
  53. data/lib/crypt_reboot/runner/generic.rb +46 -0
  54. data/lib/crypt_reboot/runner/lines.rb +13 -0
  55. data/lib/crypt_reboot/runner/no_result.rb +13 -0
  56. data/lib/crypt_reboot/runner/text.rb +12 -0
  57. data/lib/crypt_reboot/runner.rb +8 -0
  58. data/lib/crypt_reboot/safe_temp/directory.rb +28 -0
  59. data/lib/crypt_reboot/safe_temp/file_name.rb +23 -0
  60. data/lib/crypt_reboot/safe_temp/mounter.rb +33 -0
  61. data/lib/crypt_reboot/single_assign_restricted_map.rb +26 -0
  62. data/lib/crypt_reboot/version.rb +5 -0
  63. data/lib/crypt_reboot.rb +17 -0
  64. metadata +138 -0
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CryptReboot
4
+ # Hash-like class allowing to assign value only once to a list of allowed keys
5
+ class SingleAssignRestrictedMap
6
+ AlreadyAssigned = Class.new StandardError
7
+
8
+ def []=(field, value)
9
+ raise AlreadyAssigned, "Value already assigned for `#{field}` field" if data.key? field
10
+
11
+ data[field] = value
12
+ end
13
+
14
+ def to_h
15
+ data
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :data
21
+
22
+ def initialize
23
+ @data = {}
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CryptReboot
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'basic_loader'
5
+ rescue LoadError => e
6
+ raise if e.path != 'basic_loader'
7
+
8
+ require 'zeitwerk'
9
+ loader = Zeitwerk::Loader.for_gem
10
+ loader.setup
11
+ end
12
+
13
+ # Main module
14
+ module CryptReboot
15
+ end
16
+
17
+ CryptReboot.const_set(:CODE_LOADER, loader)
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crypt_reboot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Paweł Pokrywka
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-07-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tty-command
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.10'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: tty-option
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
41
+ description:
42
+ email:
43
+ - pepawel@users.noreply.github.com
44
+ executables:
45
+ - cryptreboot
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - CHANGELOG.md
50
+ - LICENSE.txt
51
+ - README.md
52
+ - exe/cryptreboot
53
+ - lib/basic_loader.rb
54
+ - lib/crypt_reboot.rb
55
+ - lib/crypt_reboot/boot_config.rb
56
+ - lib/crypt_reboot/cli.rb
57
+ - lib/crypt_reboot/cli/exiter.rb
58
+ - lib/crypt_reboot/cli/happy_exiter.rb
59
+ - lib/crypt_reboot/cli/params/definition.rb
60
+ - lib/crypt_reboot/cli/params/flattener.rb
61
+ - lib/crypt_reboot/cli/params/help_generator.rb
62
+ - lib/crypt_reboot/cli/params/parser.rb
63
+ - lib/crypt_reboot/cli/params_parsing_executor.rb
64
+ - lib/crypt_reboot/cli/sad_exiter.rb
65
+ - lib/crypt_reboot/concatenator.rb
66
+ - lib/crypt_reboot/config.rb
67
+ - lib/crypt_reboot/crypt_tab/deserializer.rb
68
+ - lib/crypt_reboot/crypt_tab/entry.rb
69
+ - lib/crypt_reboot/crypt_tab/entry_deserializer.rb
70
+ - lib/crypt_reboot/crypt_tab/entry_serializer.rb
71
+ - lib/crypt_reboot/crypt_tab/keyfile_locator.rb
72
+ - lib/crypt_reboot/crypt_tab/luks_to_plain_converter.rb
73
+ - lib/crypt_reboot/crypt_tab/serializer.rb
74
+ - lib/crypt_reboot/files_generator.rb
75
+ - lib/crypt_reboot/files_writer.rb
76
+ - lib/crypt_reboot/gziper.rb
77
+ - lib/crypt_reboot/initramfs/archiver.rb
78
+ - lib/crypt_reboot/initramfs/decompressor.rb
79
+ - lib/crypt_reboot/initramfs/decompressor/intolerant_decompressor.rb
80
+ - lib/crypt_reboot/initramfs/decompressor/tolerant_decompressor.rb
81
+ - lib/crypt_reboot/initramfs/extractor.rb
82
+ - lib/crypt_reboot/initramfs/patcher.rb
83
+ - lib/crypt_reboot/initramfs_patch_squeezer.rb
84
+ - lib/crypt_reboot/instantiable_config.rb
85
+ - lib/crypt_reboot/kexec/loader.rb
86
+ - lib/crypt_reboot/kexec_patching_loader.rb
87
+ - lib/crypt_reboot/lazy_config.rb
88
+ - lib/crypt_reboot/luks/checker.rb
89
+ - lib/crypt_reboot/luks/data.rb
90
+ - lib/crypt_reboot/luks/data_fetcher.rb
91
+ - lib/crypt_reboot/luks/dumper.rb
92
+ - lib/crypt_reboot/luks/dumper/luks_v1_parser.rb
93
+ - lib/crypt_reboot/luks/dumper/luks_v2_parser.rb
94
+ - lib/crypt_reboot/luks/key_fetcher.rb
95
+ - lib/crypt_reboot/luks/version_detector.rb
96
+ - lib/crypt_reboot/passphrase_asker.rb
97
+ - lib/crypt_reboot/patched_initramfs_generator.rb
98
+ - lib/crypt_reboot/rebooter.rb
99
+ - lib/crypt_reboot/runner.rb
100
+ - lib/crypt_reboot/runner/binary.rb
101
+ - lib/crypt_reboot/runner/boolean.rb
102
+ - lib/crypt_reboot/runner/generic.rb
103
+ - lib/crypt_reboot/runner/lines.rb
104
+ - lib/crypt_reboot/runner/no_result.rb
105
+ - lib/crypt_reboot/runner/text.rb
106
+ - lib/crypt_reboot/safe_temp/directory.rb
107
+ - lib/crypt_reboot/safe_temp/file_name.rb
108
+ - lib/crypt_reboot/safe_temp/mounter.rb
109
+ - lib/crypt_reboot/single_assign_restricted_map.rb
110
+ - lib/crypt_reboot/version.rb
111
+ homepage: https://phantomno.de/cryptreboot
112
+ licenses:
113
+ - MIT
114
+ metadata:
115
+ homepage_uri: https://phantomno.de/cryptreboot
116
+ source_code_uri: https://github.com/phantom-node/cryptreboot
117
+ changelog_uri: https://github.com/phantom-node/cryptreboot/blob/master/CHANGELOG.md
118
+ rubygems_mfa_required: 'true'
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 2.7.0
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubygems_version: 3.1.6
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Linux utility for automatic and secure unlocking of encrypted disks on reboot
138
+ test_files: []