emqx_auth_pgsql.conf 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ##--------------------------------------------------------------------
  2. ## PostgreSQL Auth/ACL Plugin
  3. ##--------------------------------------------------------------------
  4. ## PostgreSQL server address.
  5. ##
  6. ## Value: Port | IP:Port
  7. ##
  8. ## Examples: 5432, 127.0.0.1:5432, localhost:5432
  9. auth.pgsql.server = 127.0.0.1:5432
  10. ## PostgreSQL pool size.
  11. ##
  12. ## Value: Number
  13. auth.pgsql.pool = 8
  14. ## PostgreSQL username.
  15. ##
  16. ## Value: String
  17. auth.pgsql.username = root
  18. ## PostgreSQL password.
  19. ##
  20. ## Value: String
  21. ## auth.pgsql.password =
  22. ## PostgreSQL database.
  23. ##
  24. ## Value: String
  25. auth.pgsql.database = mqtt
  26. ## PostgreSQL database encoding.
  27. ##
  28. ## Value: String
  29. auth.pgsql.encoding = utf8
  30. ## Whether to enable SSL connection.
  31. ##
  32. ## Value: true | false
  33. auth.pgsql.ssl = false
  34. ## SSL keyfile.
  35. ##
  36. ## Value: File
  37. ## auth.pgsql.ssl_opts.keyfile =
  38. ## SSL certfile.
  39. ##
  40. ## Value: File
  41. ## auth.pgsql.ssl_opts.certfile =
  42. ## SSL cacertfile.
  43. ##
  44. ## Value: File
  45. ## auth.pgsql.ssl_opts.cacertfile =
  46. ## Authentication query.
  47. ##
  48. ## Value: SQL
  49. ##
  50. ## Variables:
  51. ## - %u: username
  52. ## - %c: clientid
  53. ## - %C: common name of client TLS cert
  54. ## - %d: subject of client TLS cert
  55. ##
  56. auth.pgsql.auth_query = select password from mqtt_user where username = '%u' limit 1
  57. ## Password hash.
  58. ##
  59. ## Value: plain | md5 | sha | sha256 | bcrypt
  60. auth.pgsql.password_hash = sha256
  61. ## sha256 with salt prefix
  62. ## auth.pgsql.password_hash = salt,sha256
  63. ## sha256 with salt suffix
  64. ## auth.pgsql.password_hash = sha256,salt
  65. ## bcrypt with salt prefix
  66. ## auth.pgsql.password_hash = salt,bcrypt
  67. ## pbkdf2 with macfun iterations dklen
  68. ## macfun: md4, md5, ripemd160, sha, sha224, sha256, sha384, sha512
  69. ## auth.pgsql.password_hash = pbkdf2,sha256,1000,20
  70. ## Superuser query.
  71. ##
  72. ## Value: SQL
  73. ##
  74. ## Variables:
  75. ## - %u: username
  76. ## - %c: clientid
  77. ## - %C: common name of client TLS cert
  78. ## - %d: subject of client TLS cert
  79. ##
  80. auth.pgsql.super_query = select is_superuser from mqtt_user where username = '%u' limit 1
  81. ## ACL query. Comment this query, the ACL will be disabled.
  82. ##
  83. ## Value: SQL
  84. ##
  85. ## Variables:
  86. ## - %a: ipaddress
  87. ## - %u: username
  88. ## - %c: clientid
  89. ##
  90. ## Note: You can add the 'ORDER BY' statement to control the rules match order
  91. auth.pgsql.acl_query = select allow, ipaddr, username, clientid, access, topic from mqtt_acl where ipaddr = '%a' or username = '%u' or username = '$all' or clientid = '%c'