simp-beaker-helpers 3.0.0 → 3.1.1
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/CHANGELOG.md +19 -0
- data/lib/simp/beaker_helpers/version.rb +1 -1
- data/lib/simp/beaker_helpers.rb +69 -0
- data/spec/lib/simp/beaker_helpers_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f747ed7e2c82094df9bdfee076de2354e8e40c51b5671d5003dd939a3c97dca
|
|
4
|
+
data.tar.gz: 11ce7874aa49de3e2f389efdb1abdfd3d96c356a40097ed371f09b810db49c6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87afefb2d6a5936c8b2e4f598549079de3a8e158b9f05a2e1d01005be47d4481b8b94af4dc8083a6dfb36a2a4e0eccc8e9df100ae84cd66461f65792a158619f
|
|
7
|
+
data.tar.gz: c5897a3b95fe0978543ba98476a77f77e01aaeba0cec1984b8d0ef7203f3b3fefdad2811d42ade13caa6a5391eb7515984c93a35791c302726f884cc50780baf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
### 3.1.1 / 2026-07-03
|
|
2
|
+
* Fixed:
|
|
3
|
+
* `run_fake_pki_ca_on` now runs `ensure_beaker_ip_on` before collecting
|
|
4
|
+
the IP addresses embedded in certificate subjectAltNames, so certs match
|
|
5
|
+
the corrected (Beaker-recorded) addresses on SUTs where the static
|
|
6
|
+
private-network IP was never applied (e.g. EL10 under Vagrant). Without
|
|
7
|
+
this, IKE peer IDs no longer match the cert SANs after remediation and
|
|
8
|
+
strict validators (libreswan 5) reject authentication.
|
|
9
|
+
|
|
10
|
+
### 3.1.0 / 2026-07-02
|
|
11
|
+
* Added:
|
|
12
|
+
* `ensure_beaker_ip_on`: detect SUTs whose recorded `host[:ip]` was never
|
|
13
|
+
actually applied (e.g. EL10 under Vagrant, where the legacy ifcfg files
|
|
14
|
+
Vagrant writes for static private-network IPs are no longer supported and
|
|
15
|
+
the interface silently falls back to DHCP) and (re-)apply the expected
|
|
16
|
+
address via NetworkManager (reboot-safe), falling back to `ip addr add`.
|
|
17
|
+
Runs automatically alongside `activate_interfaces` in the global
|
|
18
|
+
`before(:all)` hook; disable with `BEAKER_no_fix_interfaces`.
|
|
19
|
+
|
|
1
20
|
### 3.0.0 / 2026-06-24
|
|
2
21
|
* Changed (**Breaking**):
|
|
3
22
|
* Dropped support for Puppet 7 / Ruby 2.7. CI now tests Puppet/OpenVox 8 only,
|
data/lib/simp/beaker_helpers.rb
CHANGED
|
@@ -976,6 +976,13 @@ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
|
|
|
976
976
|
# Ensure that all interfaces are active prior to collecting data
|
|
977
977
|
activate_interfaces(host)
|
|
978
978
|
|
|
979
|
+
# Ensure the Beaker-recorded IP is actually applied before it is
|
|
980
|
+
# embedded in certificate subjectAltNames (on EL10 under Vagrant the
|
|
981
|
+
# static private-network IP is silently never applied and the
|
|
982
|
+
# interface falls back to DHCP; certs cut from the DHCP address no
|
|
983
|
+
# longer match the peer IDs once the address is corrected)
|
|
984
|
+
ensure_beaker_ip_on(host)
|
|
985
|
+
|
|
979
986
|
networking_fact = pfact_on(host, 'networking')
|
|
980
987
|
if networking_fact && networking_fact['interfaces']
|
|
981
988
|
networking_fact['interfaces'].each_value do |data|
|
|
@@ -1138,6 +1145,64 @@ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
|
|
|
1138
1145
|
end
|
|
1139
1146
|
end
|
|
1140
1147
|
|
|
1148
|
+
# Ensure that the IP address that Beaker has recorded for each SUT is
|
|
1149
|
+
# actually present on the system and (re-)apply it if it is not.
|
|
1150
|
+
#
|
|
1151
|
+
# Some OS/hypervisor combinations silently fail to configure the static IP
|
|
1152
|
+
# for secondary (private) networks. In particular, Vagrant configures
|
|
1153
|
+
# static IPs on RedHat-family guests by writing legacy ifcfg files, which
|
|
1154
|
+
# EL10 no longer supports at all. The interface falls back to NetworkManager
|
|
1155
|
+
# DHCP and receives an arbitrary address, so everything that targets the
|
|
1156
|
+
# recorded `host[:ip]` (cross-SUT traffic, direct Net::SSH logins, etc.)
|
|
1157
|
+
# fails with 'No route to host'.
|
|
1158
|
+
#
|
|
1159
|
+
# This detects the mismatch and applies the expected address to the
|
|
1160
|
+
# interface that is attached to the same network, using NetworkManager so
|
|
1161
|
+
# that the address survives reboots, and falling back to a runtime-only
|
|
1162
|
+
# `ip addr add` when NetworkManager is not in use.
|
|
1163
|
+
def ensure_beaker_ip_on(hosts)
|
|
1164
|
+
return if ENV['BEAKER_no_fix_interfaces']
|
|
1165
|
+
|
|
1166
|
+
block_on(hosts, run_in_parallel: @run_in_parallel) do |host|
|
|
1167
|
+
expected_ip = host[:ip]
|
|
1168
|
+
next unless expected_ip
|
|
1169
|
+
next if host[:platform].include?('windows')
|
|
1170
|
+
|
|
1171
|
+
# All currently assigned IPv4 addresses ('<iface> <address>/<prefix>')
|
|
1172
|
+
addrs = on(host, %(ip -o -4 addr show), accept_all_exit_codes: true).stdout.lines.map { |line|
|
|
1173
|
+
next unless line =~ %r{^\d+:\s+(\S+)\s+inet\s+(\S+)/(\d+)}
|
|
1174
|
+
{ iface: Regexp.last_match(1), ip: Regexp.last_match(2), prefix: Regexp.last_match(3) }
|
|
1175
|
+
}.compact
|
|
1176
|
+
|
|
1177
|
+
next if addrs.any? { |a| a[:ip] == expected_ip }
|
|
1178
|
+
|
|
1179
|
+
require 'ipaddr'
|
|
1180
|
+
target = addrs.find do |a|
|
|
1181
|
+
IPAddr.new("#{a[:ip]}/#{a[:prefix]}").include?(expected_ip)
|
|
1182
|
+
rescue IPAddr::Error
|
|
1183
|
+
false
|
|
1184
|
+
end
|
|
1185
|
+
|
|
1186
|
+
unless target
|
|
1187
|
+
puts " -- WARNING: #{host} does not have expected IP #{expected_ip} and no interface on that network could be found"
|
|
1188
|
+
next
|
|
1189
|
+
end
|
|
1190
|
+
|
|
1191
|
+
puts " -- FIXING: #{host} expected IP #{expected_ip} but '#{target[:iface]}' has #{target[:ip]}"
|
|
1192
|
+
|
|
1193
|
+
nm_connection = on(host, %(nmcli -g GENERAL.CONNECTION device show #{target[:iface]}), accept_all_exit_codes: true).stdout.strip
|
|
1194
|
+
if nm_connection.empty?
|
|
1195
|
+
# Not NetworkManager-managed => runtime-only fallback
|
|
1196
|
+
on(host, %(ip addr add #{expected_ip}/#{target[:prefix]} dev #{target[:iface]}), accept_all_exit_codes: true)
|
|
1197
|
+
else
|
|
1198
|
+
# Match Vagrant's static network behavior: fixed address, no gateway,
|
|
1199
|
+
# and never a default route on the private interface
|
|
1200
|
+
on(host, %(nmcli connection modify "#{nm_connection}" ipv4.method manual ipv4.addresses "#{expected_ip}/#{target[:prefix]}" ipv4.gateway "" ipv4.never-default yes))
|
|
1201
|
+
on(host, %(nmcli connection up "#{nm_connection}"))
|
|
1202
|
+
end
|
|
1203
|
+
end
|
|
1204
|
+
end
|
|
1205
|
+
|
|
1141
1206
|
## Inline Hiera Helpers ##
|
|
1142
1207
|
## These will be integrated into core Beaker at some point ##
|
|
1143
1208
|
|
|
@@ -1152,6 +1217,10 @@ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
|
|
|
1152
1217
|
|
|
1153
1218
|
# We can't guarantee that the upstream vendor isn't disabling interfaces
|
|
1154
1219
|
activate_interfaces(hosts)
|
|
1220
|
+
|
|
1221
|
+
# Some OS/hypervisor combinations (e.g. EL10 under Vagrant) fail to
|
|
1222
|
+
# apply the static IP that Beaker expects for private networks
|
|
1223
|
+
ensure_beaker_ip_on(hosts)
|
|
1155
1224
|
end
|
|
1156
1225
|
|
|
1157
1226
|
c.after(:all) do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simp-beaker-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Tessmer
|
|
8
8
|
- Trevor Vaughan
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: beaker
|