foreman_maintain 1.9.0 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9209b1f3f4a9910f6a635cd5876edbb3f9fa59e1381e532ae4961e18627fe638
4
- data.tar.gz: 8a7f2e3ba17c629eea5535f86b94bb1be409620d520da3c0d96c61c1aea5009f
3
+ metadata.gz: 353f969fb5c1563fa146f6f5cca6a9a5c0a42e22564aa6e26d0d5d2b58d1b943
4
+ data.tar.gz: b9f71f13a94ffef3cf8b338faf4d43f5aa053c58f84327713581c2f8b8bc6fa8
5
5
  SHA512:
6
- metadata.gz: 97e0f20269bc3b480bc429e91d7d119520ea4592162362f75efd42e9a4bc71200f4d13ff07b7103185200293826a3d887db265f99a2b7c94c385bd94a2eab352
7
- data.tar.gz: de0dce8771c46602be6124a04a58b935529c051b2efb7d7f38fc8b5dd25e7b0d2203580335eb9038f2e6b21b79e0dab87a361e38ba173cb6f936bcfcd7378beb
6
+ metadata.gz: 81316471839fc3ac86ecc96edccecdf4b6475bdd908ab79c1d55eba6d07a8bad0e75aaa83a440449fc8bf357e1c93df87e0d5f45f4211ba602172be9fde31bd4
7
+ data.tar.gz: ae7ae727511fe75f9c517de28a93c66231c5e6e2a362541f769a5d99c364f4b49f9bf80b178b1def23fd6f4d83596fdc0d83e06e89540a17d0751bc838347797
@@ -0,0 +1,49 @@
1
+ class Checks::CheckSha1CertificateAuthority < ForemanMaintain::Check
2
+ metadata do
3
+ label :check_sha1_certificate_authority
4
+ description 'Check if server certificate authority is sha1 signed'
5
+
6
+ confine do
7
+ feature(:katello) || feature(:foreman_proxy)
8
+ end
9
+
10
+ do_not_whitelist
11
+ end
12
+
13
+ def run
14
+ installer_answers = feature(:installer).answers
15
+ server_ca = installer_answers['certs']['server_ca_cert']
16
+
17
+ return unless server_ca
18
+
19
+ begin
20
+ certificates = load_fullchain(server_ca)
21
+ rescue OpenSSL::X509::CertificateError => e
22
+ assert(false, "Error reading server CA certificate #{server_ca}.\n #{e.message}")
23
+ else
24
+ msg = <<~MSG
25
+ Server CA certificate #{server_ca} signed with sha1 which will break on upgrade.
26
+ Update the server CA certificate with one signed with sha256 or
27
+ stronger then proceed with the upgrade.
28
+ MSG
29
+
30
+ assert(
31
+ certificates.all? { |cert| cert.signature_algorithm != 'sha1WithRSAEncryption' },
32
+ msg
33
+ )
34
+ end
35
+ end
36
+
37
+ def load_fullchain(bundle_pem)
38
+ if OpenSSL::X509::Certificate.respond_to?(:load_file)
39
+ OpenSSL::X509::Certificate.load_file(bundle_pem)
40
+ else
41
+ # Can be removed when only Ruby with load_file support is supported
42
+ File.binread(bundle_pem).
43
+ lines.
44
+ slice_after(/^-----END CERTIFICATE-----/).
45
+ filter { |pem| pem.join.include?('-----END CERTIFICATE-----') }.
46
+ map { |pem| OpenSSL::X509::Certificate.new(pem.join) }
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,35 @@
1
+ module Checks
2
+ module Disk
3
+ class PostgresqlMountpoint < ForemanMaintain::Check
4
+ metadata do
5
+ label :postgresql_mountpoint
6
+ description 'Check to make sure PostgreSQL data is not on an own mountpoint'
7
+ confine do
8
+ feature(:instance).postgresql_local? && ForemanMaintain.el?
9
+ end
10
+ end
11
+
12
+ def run
13
+ assert(psql_dir_device == psql_data_dir_device, warning_message)
14
+ end
15
+
16
+ def psql_dir_device
17
+ device = ForemanMaintain::Utils::Disk::Device.new('/var/lib/pgsql')
18
+ device.name
19
+ end
20
+
21
+ def psql_data_dir_device
22
+ device = ForemanMaintain::Utils::Disk::Device.new('/var/lib/pgsql/data')
23
+ device.name
24
+ end
25
+
26
+ def warning_message
27
+ <<~MSG
28
+ PostgreSQL data (/var/lib/pgsql/data) is on a different device than /var/lib/pgsql.
29
+ This is not supported and breaks PostgreSQL upgrades.
30
+ Please ensure PostgreSQL data is on the same mountpoint as the /var/lib/pgsql.
31
+ MSG
32
+ end
33
+ end
34
+ end
35
+ end
@@ -25,7 +25,14 @@ class Features::Pulpcore < ForemanMaintain::Feature
25
25
  end
26
26
 
27
27
  def running_tasks
28
- cli('task list --state-in running --state-in canceling')
28
+ tasks = cli('task list --state-in running --state-in canceling')
29
+ # cli() uses parse_json() which swallows JSON::ParserError and returns nil
30
+ # but running_tasks should return an Array
31
+ if tasks.nil?
32
+ []
33
+ else
34
+ tasks
35
+ end
29
36
  rescue ForemanMaintain::Error::ExecutionError
30
37
  []
31
38
  end
@@ -39,6 +39,7 @@ module Scenarios::Foreman
39
39
  Checks::Disk::AvailableSpace,
40
40
  Checks::Disk::AvailableSpaceCandlepin, # if candlepin
41
41
  Checks::Disk::AvailableSpacePostgresql13,
42
+ Checks::Disk::PostgresqlMountpoint,
42
43
  Checks::Foreman::ValidateExternalDbVersion, # if external database
43
44
  Checks::Foreman::CheckExternalDbEvrPermissions, # if external database
44
45
  Checks::Foreman::CheckCorruptedRoles,
@@ -54,6 +55,7 @@ module Scenarios::Foreman
54
55
  Checks::PackageManager::Dnf::ValidateDnfConfig,
55
56
  Checks::Repositories::CheckNonRhRepository,
56
57
  Checks::CheckOrganizationContentAccessMode,
58
+ Checks::CheckSha1CertificateAuthority,
57
59
  Checks::Repositories::Validate
58
60
  )
59
61
  end
@@ -38,6 +38,7 @@ module Scenarios::Satellite
38
38
  Checks::CheckUpstreamRepository,
39
39
  Checks::Disk::AvailableSpace,
40
40
  Checks::Disk::AvailableSpaceCandlepin, # if candlepin
41
+ Checks::Disk::PostgresqlMountpoint,
41
42
  Checks::Foreman::ValidateExternalDbVersion, # if external database
42
43
  Checks::Foreman::CheckExternalDbEvrPermissions, # if external database
43
44
  Checks::Foreman::CheckCorruptedRoles,
@@ -55,6 +56,7 @@ module Scenarios::Satellite
55
56
  Checks::CheckIpv6Disable,
56
57
  Checks::Disk::AvailableSpacePostgresql13,
57
58
  Checks::CheckOrganizationContentAccessMode,
59
+ Checks::CheckSha1CertificateAuthority,
58
60
  Checks::Repositories::Validate.new(:version => target_version),
59
61
  )
60
62
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.9.0'.freeze
2
+ VERSION = '1.9.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-25 00:00:00.000000000 Z
11
+ date: 2025-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -161,11 +161,13 @@ files:
161
161
  - definitions/checks/candlepin/db_up.rb
162
162
  - definitions/checks/check_hotfix_installed.rb
163
163
  - definitions/checks/check_ipv6_disable.rb
164
+ - definitions/checks/check_sha1_certificate_authority.rb
164
165
  - definitions/checks/check_tmout.rb
165
166
  - definitions/checks/disk/available_space.rb
166
167
  - definitions/checks/disk/available_space_candlepin.rb
167
168
  - definitions/checks/disk/available_space_postgresql13.rb
168
169
  - definitions/checks/disk/performance.rb
170
+ - definitions/checks/disk/postgresql_mountpoint.rb
169
171
  - definitions/checks/env_proxy.rb
170
172
  - definitions/checks/foreman/check_corrupted_roles.rb
171
173
  - definitions/checks/foreman/check_duplicate_permission.rb
@@ -410,7 +412,7 @@ homepage: https://github.com/theforeman/foreman_maintain
410
412
  licenses:
411
413
  - GPL-3.0
412
414
  metadata: {}
413
- post_install_message:
415
+ post_install_message:
414
416
  rdoc_options: []
415
417
  require_paths:
416
418
  - lib
@@ -429,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
431
  version: '0'
430
432
  requirements: []
431
433
  rubygems_version: 3.3.27
432
- signing_key:
434
+ signing_key:
433
435
  specification_version: 4
434
436
  summary: Foreman maintenance tool belt
435
437
  test_files: []