From 3f3ba27ac9df5a45e4d3021ea43e9546b71e2cbd Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Tue, 21 Sep 2021 16:26:51 +0200 Subject: [PATCH 1/5] Added Mosquitto Config --- config/bffh.dhall | 48 --------------------------------------------- config/pass.toml | 1 - config/roles.toml | 19 ------------------ config/users.toml | 11 ----------- docker-compose.yaml | 7 ++++++- 5 files changed, 6 insertions(+), 80 deletions(-) delete mode 100644 config/bffh.dhall delete mode 100644 config/pass.toml delete mode 100644 config/roles.toml delete mode 100644 config/users.toml diff --git a/config/bffh.dhall b/config/bffh.dhall deleted file mode 100644 index c1cc0a3..0000000 --- a/config/bffh.dhall +++ /dev/null @@ -1,48 +0,0 @@ --- { actor_connections = [] : List { _1 : Text, _2 : Text } -{ actor_connections = [{ _1 = "Testmachine", _2 = "Actor" }] -, actors = - { Actor = { module = "Shelly", params = {=} } - } - , init_connections = [] : List { _1 : Text, _2 : Text } ---, init_connections = [{ _1 = "Initiator", _2 = "Testmachine" }] -, initiators = - { Initiator = { module = "Dummy", params = {=} } - } -, listens = - [ { address = "::", port = Some 59661 } - ] -, machines = - { Testmachine = - { description = Some "A test machine" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Testmachine" - , read = "lab.test.read" - , write = "lab.test.write" - }, - Another = - { description = Some "Another test machine" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Another" - , read = "lab.test.read" - , write = "lab.test.write" - }, - Yetmore = - { description = Some "Yet more test machines" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Yetmore" - , read = "lab.test.read" - , write = "lab.test.write" - } - } -, mqtt_url = "tcp://mqtt:1883" -, db_path = "/tmp/bffh" -, roles = - { Testrole = - { parents = [] : List Text - , permissions = [] : List Text - } - } -} diff --git a/config/pass.toml b/config/pass.toml deleted file mode 100644 index 6d4855d..0000000 --- a/config/pass.toml +++ /dev/null @@ -1 +0,0 @@ -Testuser = "secret" diff --git a/config/roles.toml b/config/roles.toml deleted file mode 100644 index 2c91a30..0000000 --- a/config/roles.toml +++ /dev/null @@ -1,19 +0,0 @@ -[anotherrole] - -[testrole] -permissions = [ - "lab.test.*" -] - -[somerole] -parents = ["testparent/lmdb"] -permissions = [ - "lab.some.admin" -] - -[testparent] -permissions = [ - "lab.some.write", - "lab.some.read", - "lab.some.disclose", -] diff --git a/config/users.toml b/config/users.toml deleted file mode 100644 index 2d5ef75..0000000 --- a/config/users.toml +++ /dev/null @@ -1,11 +0,0 @@ -[Testuser] -# Define them in roles.toml as well -roles = ["somerole/lmdb", "testrole/lmdb"] - -# If two or more users want to use the same machine at once the higher prio -# wins -priority = 0 - -# You can add whatever random data you want. -# It will get stored in the `kv` field in UserData. -noot = "noot!" diff --git a/docker-compose.yaml b/docker-compose.yaml index 0b8de33..a814cf8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,8 +8,13 @@ services: - "59661:59661" volumes: # generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section. - - "./config:/etc/bffh" + - "./config/bffh:/etc/bffh" links: - mqtt mqtt: image: eclipse-mosquitto:1.6.13 + restart: always + ports: + - "1883:1883" + volumes: + - "./config/mosquitto:/mosquitto/config" From fb03ba6e5bbe31ff6607ab991bee394d122cdaca Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Tue, 21 Sep 2021 16:35:21 +0200 Subject: [PATCH 2/5] Added: Config Folder --- config/bffh/bffh.dhall | 48 +++++++++++++++++++++++++++++++ config/bffh/pass.toml | 1 + config/bffh/roles.toml | 19 ++++++++++++ config/bffh/users.toml | 11 +++++++ config/mosquitto/mosquitto.config | 3 ++ docker-compose.yaml | 2 +- 6 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 config/bffh/bffh.dhall create mode 100644 config/bffh/pass.toml create mode 100644 config/bffh/roles.toml create mode 100644 config/bffh/users.toml create mode 100644 config/mosquitto/mosquitto.config diff --git a/config/bffh/bffh.dhall b/config/bffh/bffh.dhall new file mode 100644 index 0000000..c1cc0a3 --- /dev/null +++ b/config/bffh/bffh.dhall @@ -0,0 +1,48 @@ +-- { actor_connections = [] : List { _1 : Text, _2 : Text } +{ actor_connections = [{ _1 = "Testmachine", _2 = "Actor" }] +, actors = + { Actor = { module = "Shelly", params = {=} } + } + , init_connections = [] : List { _1 : Text, _2 : Text } +--, init_connections = [{ _1 = "Initiator", _2 = "Testmachine" }] +, initiators = + { Initiator = { module = "Dummy", params = {=} } + } +, listens = + [ { address = "::", port = Some 59661 } + ] +, machines = + { Testmachine = + { description = Some "A test machine" + , disclose = "lab.test.read" + , manage = "lab.test.admin" + , name = "Testmachine" + , read = "lab.test.read" + , write = "lab.test.write" + }, + Another = + { description = Some "Another test machine" + , disclose = "lab.test.read" + , manage = "lab.test.admin" + , name = "Another" + , read = "lab.test.read" + , write = "lab.test.write" + }, + Yetmore = + { description = Some "Yet more test machines" + , disclose = "lab.test.read" + , manage = "lab.test.admin" + , name = "Yetmore" + , read = "lab.test.read" + , write = "lab.test.write" + } + } +, mqtt_url = "tcp://mqtt:1883" +, db_path = "/tmp/bffh" +, roles = + { Testrole = + { parents = [] : List Text + , permissions = [] : List Text + } + } +} diff --git a/config/bffh/pass.toml b/config/bffh/pass.toml new file mode 100644 index 0000000..6d4855d --- /dev/null +++ b/config/bffh/pass.toml @@ -0,0 +1 @@ +Testuser = "secret" diff --git a/config/bffh/roles.toml b/config/bffh/roles.toml new file mode 100644 index 0000000..2c91a30 --- /dev/null +++ b/config/bffh/roles.toml @@ -0,0 +1,19 @@ +[anotherrole] + +[testrole] +permissions = [ + "lab.test.*" +] + +[somerole] +parents = ["testparent/lmdb"] +permissions = [ + "lab.some.admin" +] + +[testparent] +permissions = [ + "lab.some.write", + "lab.some.read", + "lab.some.disclose", +] diff --git a/config/bffh/users.toml b/config/bffh/users.toml new file mode 100644 index 0000000..2d5ef75 --- /dev/null +++ b/config/bffh/users.toml @@ -0,0 +1,11 @@ +[Testuser] +# Define them in roles.toml as well +roles = ["somerole/lmdb", "testrole/lmdb"] + +# If two or more users want to use the same machine at once the higher prio +# wins +priority = 0 + +# You can add whatever random data you want. +# It will get stored in the `kv` field in UserData. +noot = "noot!" diff --git a/config/mosquitto/mosquitto.config b/config/mosquitto/mosquitto.config new file mode 100644 index 0000000..d33a1a7 --- /dev/null +++ b/config/mosquitto/mosquitto.config @@ -0,0 +1,3 @@ +persistence true +persistence_location /mosquitto/data/ +log_dest file /mosquitto/log/mosquitto.log \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index a814cf8..dfc4e62 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -17,4 +17,4 @@ services: ports: - "1883:1883" volumes: - - "./config/mosquitto:/mosquitto/config" + - "./config/mosquitto:/mosquitto/config/" From b34c23ab5afcb1cf6baf6d4a7aa2e56daf7bf6a1 Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Tue, 21 Sep 2021 16:45:17 +0200 Subject: [PATCH 3/5] Renamed Mosquitto Config File --- config/mosquitto/{mosquitto.config => mosquitto.conf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config/mosquitto/{mosquitto.config => mosquitto.conf} (100%) diff --git a/config/mosquitto/mosquitto.config b/config/mosquitto/mosquitto.conf similarity index 100% rename from config/mosquitto/mosquitto.config rename to config/mosquitto/mosquitto.conf From dfa924b2af7a394740646770e2d90f2b7934eb83 Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Tue, 21 Sep 2021 16:50:54 +0200 Subject: [PATCH 4/5] Added z --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index dfc4e62..c58daaa 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,7 @@ services: - "59661:59661" volumes: # generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section. - - "./config/bffh:/etc/bffh" + - "./config/bffh:/etc/bffh:z" links: - mqtt mqtt: @@ -17,4 +17,4 @@ services: ports: - "1883:1883" volumes: - - "./config/mosquitto:/mosquitto/config/" + - "./config/mosquitto/mosquitto.config:/mosquitto/config/:z" From 56b30dc1d3bd675009e35287812f833c409e8de6 Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Tue, 21 Sep 2021 16:55:06 +0200 Subject: [PATCH 5/5] Fixed Mosquitto Config Path --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index c58daaa..49db0b2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,7 @@ services: - "59661:59661" volumes: # generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section. - - "./config/bffh:/etc/bffh:z" + - "./config/bffh:/etc/bffh" links: - mqtt mqtt: @@ -17,4 +17,4 @@ services: ports: - "1883:1883" volumes: - - "./config/mosquitto/mosquitto.config:/mosquitto/config/:z" + - "./config/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf"