From bb99bc313d99e7153853886f9108922691e6c10c Mon Sep 17 00:00:00 2001 From: sinavir Date: Sun, 10 Apr 2022 17:56:04 +0200 Subject: [PATCH 1/2] MQTT Brocker --- hosts/hackens-org/mosquitto.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 hosts/hackens-org/mosquitto.nix diff --git a/hosts/hackens-org/mosquitto.nix b/hosts/hackens-org/mosquitto.nix new file mode 100644 index 0000000..c4d8010 --- /dev/null +++ b/hosts/hackens-org/mosquitto.nix @@ -0,0 +1,32 @@ +{ ... }: +let + port = 1883; +in +{ + services.mosquitto = { + enable = true; + logType = [ "all" ]; + listeners = [ + { + address = "0.0.0.0"; + port = port; + acl = [ + "topic read #" + "topic deny $SYS/#" + ]; + settings = { + allow_anonymous = true; + }; + users.admin = { + acl = [ "readwrite #" "readwrite $SYS/#" ]; + hashedPassword = "$7$101$7Jd6gbsa3mSmsw4o$9QytXhPe8b0ISWj6NdEzcdYOnIgWsjwKUOQq8GIgw3e5wLsoIutUr/l+6zNABJpfb0dHipxrDMCNQ2K4mBh2oQ=="; + }; + users.maurice = { + acl = [ "readwrite #" "read $SYS/#" ]; + hashedPassword = "$7$101$l0ZJJnnxGFr1tEQi$drqX1AHzXyqsbhhx87jszJW4IgTIBbr3I57+rrmsgldeWNLzBJikW5BwKGHnj9K5TwEBMrdOf5v0wnlbln/Q0Q=="; + }; + } + ]; + }; + networking.firewall.allowedTCPPorts = [ port ]; +} From dec2dd0ad2852942a5b6f2553bb52a2a906eb0d8 Mon Sep 17 00:00:00 2001 From: hackens server Date: Wed, 13 Apr 2022 17:00:40 +0200 Subject: [PATCH 2/2] Enlever l'authentification --- hosts/hackens-org/mosquitto.nix | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hosts/hackens-org/mosquitto.nix b/hosts/hackens-org/mosquitto.nix index c4d8010..db4ff3c 100644 --- a/hosts/hackens-org/mosquitto.nix +++ b/hosts/hackens-org/mosquitto.nix @@ -10,21 +10,9 @@ in { address = "0.0.0.0"; port = port; - acl = [ - "topic read #" - "topic deny $SYS/#" - ]; settings = { allow_anonymous = true; }; - users.admin = { - acl = [ "readwrite #" "readwrite $SYS/#" ]; - hashedPassword = "$7$101$7Jd6gbsa3mSmsw4o$9QytXhPe8b0ISWj6NdEzcdYOnIgWsjwKUOQq8GIgw3e5wLsoIutUr/l+6zNABJpfb0dHipxrDMCNQ2K4mBh2oQ=="; - }; - users.maurice = { - acl = [ "readwrite #" "read $SYS/#" ]; - hashedPassword = "$7$101$l0ZJJnnxGFr1tEQi$drqX1AHzXyqsbhhx87jszJW4IgTIBbr3I57+rrmsgldeWNLzBJikW5BwKGHnj9K5TwEBMrdOf5v0wnlbln/Q0Q=="; - }; } ]; };