messhy 0.9.1 → 0.9.3

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: fd61d3c3a60ea6d3f5decc20c10c17168607ff1e752e688ad0aec6f22c37be79
4
- data.tar.gz: b6552633a9762e716b3bee6380c318eecefd8e3280fb44a100bd921f4c82c816
3
+ metadata.gz: 461686d1f8da9181c5eddeece3d651a0f364fb2be1fe944a174b91bc6bf77d8e
4
+ data.tar.gz: 06aacac73369872bc1c63c0083b200125a97813a0be83ce85857e27d8a0785ee
5
5
  SHA512:
6
- metadata.gz: c2a44398671a4801cab1170cc5889ac55c4da1ffa1005422664d8b783ee30933eca79c30ccdd2b905b36cc7c82b9049ae97fec9ddc61fd11e42611682dd92ac1
7
- data.tar.gz: e159a7b8575b572f348d10867a6ff3797bc765d87552b134eb8ea1d2a910359a24b54b7e66023633bac4725af5adaf846558b1c998429e1c4b7a06546fb63ad0
6
+ metadata.gz: 9a90d59ae7a33d8e741a2917bdd20919fa5bce750b93037ac2b7ea4dbd94f5e17b48449b8533fbb10d820d776f184f2fe80036a65611d5439a94497e5d204741
7
+ data.tar.gz: 4b91ddf4f75e331ffe080c1cdb8b27aa3e311c950b249e5f4fff03e847dcd8f56fdf4be22ca79a958b42b5c71e523c0d265d397e148ec90c042b09b7d8319552
data/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.3] - 2026-10-05
11
+
12
+ ### Fixed
13
+
14
+ - Keep temporary WireGuard configurations private during reconciliation and
15
+ remove them after successful updates or failed updates with rollback.
16
+
17
+ ## [0.9.2] - 2026-10-02
18
+
19
+ ### Changed
20
+
21
+ - Update development dependencies.
22
+ - Link gem source metadata to the matching release tag.
23
+
10
24
  ## [0.9.1] - 2026-09-02
11
25
 
12
26
  ### Fixed
data/README.md CHANGED
@@ -103,6 +103,13 @@ Apply DNS without touching WireGuard:
103
103
  messhy dns --environment=production
104
104
  ```
105
105
 
106
+ Use `messhy reconcile --environment=production` to update active peers without
107
+ restarting their WireGuard interfaces. Reconciliation uploads configuration
108
+ inside a private temporary directory and passes a separate owner-only file to
109
+ `wg syncconf`. Both temporary files are removed after a successful update or
110
+ a failed update with rollback. The installed and previous configurations remain
111
+ root-owned with mode `0600`.
112
+
106
113
  ## Secret Management
107
114
 
108
115
  `messhy setup` stores generated WireGuard key pairs inside `.secrets/wireguard/*.yml` with `0600` permissions. Each node gets its own YAML file (`.secrets/wireguard/<node>.yml`) and all peer pre‑shared keys live in `.secrets/wireguard/psks.yml`. The directory is gitignored by default, and the Rails generator ensures the ignore rules are present in your application. After provisioning, copy the YAML files into 1Password (or another vault) and remove them from disk if you do not want long‑lived local copies.
@@ -8,7 +8,7 @@ module Messhy
8
8
  DEFAULT_TIMEOUT = 5
9
9
  DEFAULT_KEY_TYPES = %w[ed25519 ecdsa rsa].freeze
10
10
 
11
- # rubocop:disable Metrics/ParameterLists
11
+ # rubocop:disable-next Metrics/ParameterLists
12
12
  def initialize(config,
13
13
  known_hosts_path: File.expand_path('~/.ssh/known_hosts'),
14
14
  timeout: DEFAULT_TIMEOUT,
@@ -22,7 +22,6 @@ module Messhy
22
22
  @hash_hosts = hash_hosts
23
23
  @replace_existing = replace_existing
24
24
  end
25
- # rubocop:enable Metrics/ParameterLists
26
25
 
27
26
  def trust_all_hosts
28
27
  ensure_ssh_keyscan!
@@ -7,7 +7,7 @@ require 'digest'
7
7
  require 'base64'
8
8
 
9
9
  module Messhy
10
- # rubocop:disable Metrics/ClassLength
10
+ # rubocop:disable-next Metrics/ClassLength
11
11
  class Installer
12
12
  attr_reader :config, :dry_run, :prune, :ssh_executor
13
13
 
@@ -422,5 +422,4 @@ module Messhy
422
422
  base[0, 44]
423
423
  end
424
424
  end
425
- # rubocop:enable Metrics/ClassLength
426
425
  end
@@ -12,7 +12,7 @@ module Messhy
12
12
  @psk_map = psk_map
13
13
  end
14
14
 
15
- # rubocop:disable Metrics/AbcSize
15
+ # rubocop:disable-next Metrics/AbcSize
16
16
  def build_config_for_node(node_name)
17
17
  node_config = config.node_config(node_name)
18
18
  raise Error, "Node not found: #{node_name}" unless node_config
@@ -73,7 +73,6 @@ module Messhy
73
73
  binding_context = binding
74
74
  template.result(binding_context)
75
75
  end
76
- # rubocop:enable Metrics/AbcSize
77
76
 
78
77
  def build_all_configs
79
78
  configs = {}
@@ -127,11 +127,22 @@ module Messhy
127
127
  end
128
128
 
129
129
  def reconcile_config(node_name, config_content)
130
- temp_file = '/tmp/messhy-wg0.conf'
131
- script = reconcile_script(temp_file)
130
+ executor = self
132
131
  execute_on_node(node_name) do
133
- upload! StringIO.new(config_content), temp_file
134
- execute :sudo, :bash, '-lc', Shellwords.escape(script)
132
+ temp_directory = capture(:mktemp, '-d', '/tmp/messhy-reconcile.XXXXXXXXXX').strip
133
+ unless temp_directory.match?(%r{\A/tmp/messhy-reconcile\.[A-Za-z0-9]+\z})
134
+ raise Error, 'Could not create a private WireGuard upload directory'
135
+ end
136
+
137
+ temp_file = File.join(temp_directory, 'wg0.conf')
138
+ begin
139
+ upload! StringIO.new(config_content), temp_file
140
+ script = executor.send(:reconcile_script, temp_file)
141
+ execute :sudo, :bash, '-lc', Shellwords.escape(script)
142
+ ensure
143
+ execute :rm, '-f', temp_file
144
+ execute :rmdir, temp_directory
145
+ end
135
146
  end
136
147
  end
137
148
 
@@ -397,9 +408,11 @@ module Messhy
397
408
  target=/etc/wireguard/wg0.conf
398
409
  candidate=/etc/wireguard/wg0.next.conf
399
410
  previous=/etc/wireguard/wg0.conf.previous
400
- stripped=/tmp/messhy-wg0.stripped
411
+ stripped=$(mktemp /tmp/messhy-wg0.XXXXXXXXXX)
412
+ trap 'rm -f "$stripped"' EXIT
413
+ trap 'exit 1' HUP INT TERM
401
414
 
402
- install -o root -g root -m 600 #{temp_file} "$candidate"
415
+ install -o root -g root -m 600 #{Shellwords.escape(temp_file)} "$candidate"
403
416
  wg-quick strip "$candidate" > "$stripped"
404
417
 
405
418
  if systemctl is-active --quiet wg-quick@wg0; then
@@ -421,7 +434,6 @@ module Messhy
421
434
  fi
422
435
  fi
423
436
 
424
- rm -f "$stripped" #{temp_file}
425
437
  SCRIPT
426
438
  end
427
439
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Messhy
4
- VERSION = '0.9.1'
4
+ VERSION = '0.9.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messhy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - BoringCache
@@ -99,7 +99,7 @@ homepage: https://github.com/boringcache/messhy
99
99
  licenses:
100
100
  - MIT
101
101
  metadata:
102
- source_code_uri: https://github.com/boringcache/messhy
102
+ source_code_uri: https://github.com/boringcache/messhy/tree/v0.9.3
103
103
  documentation_uri: https://github.com/boringcache/messhy/blob/main/README.md
104
104
  changelog_uri: https://github.com/boringcache/messhy/blob/main/CHANGELOG.md
105
105
  bug_tracker_uri: https://github.com/boringcache/messhy/issues