zenoh 支持基本的用户密码认证,client以及peer 支持与router 以及peer 进行认证

配置说明

  • 参考配置 client
{
  /// The node's mode (router, peer or client)
  mode: "client",
  transport: {
    auth: {
      /// The configuration of authentication.
      /// A password implies a username is required.
      usrpwd: {
        user: "clientusername",
        password: "clientpassword",
      },
    },
  },
}

router 配置,同时支持基于目录的配置

{
  /// The node's mode (router, peer or client)
  mode: "router",
  transport: {
    auth: {
      /// The configuration of authentication.
      usrpwd: {
        user: "routerusername",
        password: "routerpassword",
        /// The path to a file containing the user password dictionary
        dictionary_file: "credentials.txt",
      },
    },
  },
}

用户密码格式

上边说了可以基于文件的格式,支持基于明文的,以及基于sha256的

明文格式

clientusername:clientpassword

sha256 格式

clientusername:92df0d4f39c218607e3200bf93ccac87a80cb910e811d84b286bebe0a8860724

说明

如果为了安全简单的基于用户密码的就可以了,同时zenoh还支持访问控制,推荐结合起来,可以确保系统的安全

参考资料

https://zenoh.io/docs/manual/user-password/