zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

commit 4e8240dbd809a3d04f26cdae2554c3c9325bad17
parent 91bfe221397d7c4f018dd8024eb64479e175c34c
Author: srfsh <dev@srf.sh>
Date:   Tue, 16 Aug 2022 13:21:54 +0300

zenroom: use salt instead of pass

Needed to change names form "salt" to "pass" because how it is
changed in the .zen file as well.

Diffstat:
Mconf/.env.templ | 2+-
Mconf/runtime.exs | 2+-
Mdevop/.docker-compose.templ | 2+-
Mdocs/configuration-guide.md | 5+++--
Mmann | 8++++----
Msrc/zenflows/restroom.ex | 10+++++-----
6 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/conf/.env.templ b/conf/.env.templ @@ -29,7 +29,7 @@ ## restroom #export ROOM_HOST= #export ROOM_PORT= -export ROOM_PASS=$ROOM_PASS +export ROOM_SALT=$ROOM_SALT ## admin export ADMIN_KEY=$ADMIN_KEY diff --git a/conf/runtime.exs b/conf/runtime.exs @@ -71,7 +71,7 @@ config :zenflows, Zenflows.DB.Repo, db_conf config :zenflows, Zenflows.Restroom, room_host: fetch_env!("ROOM_HOST"), room_port: fetch_env!("ROOM_PORT"), - room_pass: fetch_env!("ROOM_PASS") + room_salt: fetch_env!("ROOM_SALT") # # admin diff --git a/devop/.docker-compose.templ b/devop/.docker-compose.templ @@ -38,7 +38,7 @@ services: ROOM_HOST: zvmlet ROOM_PORT: &room_port 3000 - ROOM_PASS: $ROOM_PASS + ROOM_SALT: $ROOM_SALT depends_on: - zvmlet - db diff --git a/docs/configuration-guide.md b/docs/configuration-guide.md @@ -39,7 +39,8 @@ also see the [Required Options](#required-options). * `ROOM_HOST`: The hostname or IP address of the Restroom instance. * `ROOM_PORT`: The port number of the Restroom instance. It must be an integer between `0` and `65535`, inclusive. -* `ROOM_PASS`: The passphrase to be used with Restroom's keypairoomServer call. +* `ROOM_SALT`: The base64-encoded salt to be used with Restroom's + keypairoomServer call. * `ADMIN_KEY`: A 64-octect long, lowercase-base16-encoded string used for the authenticating calls from the administrators. Can be generated with @@ -52,7 +53,7 @@ also see the [Required Options](#required-options). Some of the options on how to connect to the database and the Restroom intance are required, along with `ADMIN_KEY` that is used authenticating admin calls. -For the Restroom instance, you need the `ROOM_HOST`, `ROOM_PORT`, and `ROOM_PASS` +For the Restroom instance, you need the `ROOM_HOST`, `ROOM_PORT`, and `ROOM_SALT` options. About the database, there are only 2 things you need to setup: how to connect to diff --git a/mann b/mann @@ -180,8 +180,8 @@ cmd_env_setup() { warn "the file 'conf/env.sh' already exists; skipping" else key=$(openssl rand -hex 64) - pass=$(openssl rand -hex 64) - sed 's,$ADMIN_KEY,'"$key"', ; s,$ROOM_PASS,'"$pass"',' conf/.env.templ >conf/env.sh + salt=$(openssl rand -hex 64) + sed 's,$ADMIN_KEY,'"$key"', ; s,$ROOM_SALT,'"$salt"',' conf/.env.templ >conf/env.sh warn "the 'conf/env.sh' file is generated, please edit it to suit your needs" fi } @@ -268,10 +268,10 @@ cmd_devop_setup() { else admin_key=$(openssl rand -hex 64) db_pass=$(openssl rand -hex 16) - room_pass=$(openssl rand -hex 64) + room_salt=$(openssl rand -base64 64 | tr \d \\n) sed 's,$ADMIN_KEY,'"$admin_key"', ; s,$DB_PASS,'"$db_pass"', ; - s,$ROOM_PASS,'"$room_pass"',' devop/.docker-compose.templ >devop/docker-compose.yml + s,$ROOM_SALT,'"$room_salt"',' devop/.docker-compose.templ >devop/docker-compose.yml warn "the 'devop/docker-compose.yml' file is generated, please edit it to suit your needs" fi } diff --git a/src/zenflows/restroom.ex b/src/zenflows/restroom.ex @@ -56,7 +56,7 @@ See https://github.com/dyne/keypairoom for details. def keypairoom_server(data) do data = %{ "userData" => data, - "theBackendPassword" => pass(), + "serverSideSalt" => salt(), } case exec("keypairoomServer-6-7", data) do {:ok, %{"seedServerSideShard.HMAC" => hmac}} -> {:ok, hmac} @@ -100,11 +100,11 @@ defp host() do "#{conf[:room_host]}:#{conf[:room_port]}" end -# Return the passphrase from the configs. -@spec pass() :: String.t() -defp pass() do +# Return the salt from the configs. +@spec salt() :: String.t() +defp salt() do conf = conf() - conf[:room_pass] + conf[:room_salt] end # Return the application configurations of this module.