messhy 0.9.2 → 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: fbcab708f43ed1ee21e30b2162ce6ec7aa4e762dfebeea5874d4f0f7d55a46d1
4
- data.tar.gz: 5085a9ad4d3f8429e22544d32ca60275eda1079934f4dd63c5a80dd54c0944ec
3
+ metadata.gz: 461686d1f8da9181c5eddeece3d651a0f364fb2be1fe944a174b91bc6bf77d8e
4
+ data.tar.gz: 06aacac73369872bc1c63c0083b200125a97813a0be83ce85857e27d8a0785ee
5
5
  SHA512:
6
- metadata.gz: 490c2acab762f4f14b39731a1c33408b0e9131316dff4f52ec2b1083d0b03273e475709d47a435cf7566f524013bff90ae7fb4cdb70cfbf5d2b4fc15fe62def8
7
- data.tar.gz: 2f29f271a42b84f6f9b205233c175f203fa0a69efe5fc65b119e570a2029cafc2a8e6b4f4cc725aa7da6ac07eabf8216e7c745cf53d66ada9e53e88a89ae649a
6
+ metadata.gz: 9a90d59ae7a33d8e741a2917bdd20919fa5bce750b93037ac2b7ea4dbd94f5e17b48449b8533fbb10d820d776f184f2fe80036a65611d5439a94497e5d204741
7
+ data.tar.gz: 4b91ddf4f75e331ffe080c1cdb8b27aa3e311c950b249e5f4fff03e847dcd8f56fdf4be22ca79a958b42b5c71e523c0d265d397e148ec90c042b09b7d8319552
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ 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
+
10
17
  ## [0.9.2] - 2026-10-02
11
18
 
12
19
  ### Changed
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.
@@ -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.2'
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.2
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/tree/v0.9.2
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