nats-server defaults to binding 0.0.0.0, and the systemd unit didn't
override that - meaning any host that can reach munin's port 4222 could
publish/subscribe to the bot's classifier exchange or JetStream streams
with zero authentication configured. It's only ever used by processes on
the same host (nats_uri=localhost), so restrict it to loopback.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
src: nats-server.service
dest: /etc/systemd/system/nats-server.service
register: nats_unit
+ notify:
+ - restart nats-server
- name: nats - enable and start service
become: true
After=network.target
[Service]
-ExecStart=/usr/local/bin/nats-server -js -sd /var/lib/nats/jetstream
+ExecStart=/usr/local/bin/nats-server -a 127.0.0.1 -js -sd /var/lib/nats/jetstream
User=nats
Group=nats
Restart=always