Thank you for the reply,
Again some questions please.
Regarding three fields present in mosquitto-go-auth.conf:
auth_opt_pg_dbname appserver
auth_opt_pg_user appserver
auth_opt_pg_password appserver
I must replace it with my lora-app-server postgre database configuration ==> dbname, user & password?
Then I configured a mosquitto user loraroot, it could be considered as superuser?
Under /etc/mosquitto/conf.d
I kept my previous local.conf file:
allow_anonymous false
password_file /etc/mosquitto/pwd
#cafile /etc/mosquitto/certs/ca.crt
#certfile /etc/mosquitto/certs/hostname.crt
#keyfile /etc/mosquitto/certs/hostname.key
I must remove it, if yes what about allow_anonymous field ??? ==> Dumb I must add allow_anonymous to false in mosquitto-go-auth.conf
To be sure auth-plugin must be replace in mosquitto.conf or add in mosquitto-go-auth.conf or both?
In other words “General option” must be implemented in mosquitto.conf or mosquitto-go-auth.conf or both?
And last question, I have to replace the mosquitto password set in each .toml with the PBKDF2 passwords or it’s not necessary? ==> double dumb I must create hash password with my current password of each mqtt user?
./pw -p my_current_mqtt_user_plaint-text_password
NB: I havn’t .toml config file for the lora-gateway-bridge service because this is directly hosted in my mutlitech gateway.
Here several logs.
At the launch of the service mosquitto:
root@Debian02:~# mosquitto -c /etc/mosquitto/mosquitto.conf &
[1] 920
root@Debian02:~# 1531082169: mosquitto version 1.4.10 (build date 2018-05-05 22:35:52+0100) starting
1531082169: Config loaded from /etc/mosquitto/mosquitto.conf.
INFO[2018-07-08T21:36:10+01:00] Got 3 users from passwords file.
INFO[2018-07-08T21:36:10+01:00] created aclrecord {gateway/+/stats 2} for user loragw
INFO[2018-07-08T21:36:10+01:00] created aclrecord {gateway/+/rx 2} for user loragw
INFO[2018-07-08T21:36:10+01:00] created aclrecord {gateway/+/tx 1} for user loragw
INFO[2018-07-08T21:36:10+01:00] created aclrecord {gateway/+/stats 1} for user loraserver
INFO[2018-07-08T21:36:10+01:00] created aclrecord {gateway/+/tx 2} for user loraserver
INFO[2018-07-08T21:36:10+01:00] created aclrecord {gateway/+/rx 1} for user loraserver
INFO[2018-07-08T21:36:10+01:00] created aclrecord {application/+/node/+/rx 2} for user loraappserver
INFO[2018-07-08T21:36:10+01:00] created aclrecord {application/+/node/+/join 2} for user loraappserver
INFO[2018-07-08T21:36:10+01:00] created aclrecord {application/+/node/+/ack 2} for user loraappserver
INFO[2018-07-08T21:36:10+01:00] created aclrecord {application/+/node/+/error 2} for user loraappserver
INFO[2018-07-08T21:36:10+01:00] created aclrecord {application/+/node/+/tx 1} for user loraappserver
INFO[2018-07-08T21:36:10+01:00] Got 11 lines from acl file.
INFO[2018-07-08T21:36:10+01:00] Backend registered: Files
DEBU[2018-07-08T21:36:10+01:00] Initializing postgres backend with options:
DEBU[2018-07-08T21:36:10+01:00] pg_host: localhost
DEBU[2018-07-08T21:36:10+01:00] pg_password: ##########
DEBU[2018-07-08T21:36:10+01:00] pg_sslmode: disable
DEBU[2018-07-08T21:36:10+01:00] pg_aclquery: select distinct 'application/' || a.id || '/#' from "user" u inner join organization_user ou on ou.user_id = u.id inner join organization o on o.id = ou.organization_id inner join application a on a.organization_id =$
DEBU[2018-07-08T21:36:10+01:00] pg_user: loraappserver
DEBU[2018-07-08T21:36:10+01:00] pg_superquery: select count(*) from "user" where username = $1 and is_admin = true
DEBU[2018-07-08T21:36:10+01:00] pg_port: 5432
DEBU[2018-07-08T21:36:10+01:00] pg_dbname: loraappserver
DEBU[2018-07-08T21:36:10+01:00] pg_userquery: select password_hash from "user" where username = $1 and is_active = true limit 1
DEBU[2018-07-08T21:36:10+01:00] Postgres user query is: select password_hash from "user" where username = $1 and is_active = true limit 1
DEBU[2018-07-08T21:36:10+01:00] Postgres superuser query is: select count(*) from "user" where username = $1 and is_admin = true
DEBU[2018-07-08T21:36:10+01:00] Postgres acl query is: select distinct 'application/' || a.id || '/#' from "user" u inner join organization_user ou on ou.user_id = u.id inner join organization o on o.id = ou.organization_id inner join application a on a.organization_id =$
INFO[2018-07-08T21:36:10+01:00] Backend registered: Postgres
DEBU[2018-07-08T21:36:10+01:00] Initializing postgres backend with options:
DEBU[2018-07-08T21:36:10+01:00] pg_aclquery: select distinct 'application/' || a.id || '/#' from "user" u inner join organization_user ou on ou.user_id = u.id inner join organization o on o.id = ou.organization_id inner join application a on a.organization_id =$
DEBU[2018-07-08T21:36:10+01:00] pg_port: 5432
DEBU[2018-07-08T21:36:10+01:00] pg_user: loraappserver
DEBU[2018-07-08T21:36:10+01:00] pg_superquery: select count(*) from "user" where username = $1 and is_admin = true
DEBU[2018-07-08T21:36:10+01:00] pg_dbname: loraappserver
DEBU[2018-07-08T21:36:10+01:00] pg_userquery: select password_hash from "user" where username = $1 and is_active = true limit 1
DEBU[2018-07-08T21:36:10+01:00] pg_sslmode: disable
DEBU[2018-07-08T21:36:10+01:00] pg_host: localhost
DEBU[2018-07-08T21:36:10+01:00] pg_password: ############
DEBU[2018-07-08T21:36:10+01:00] Postgres user query is: select password_hash from "user" where username = $1 and is_active = true limit 1
DEBU[2018-07-08T21:36:10+01:00] Postgres superuser query is: select count(*) from "user" where username = $1 and is_admin = true
DEBU[2018-07-08T21:36:10+01:00] Postgres acl query is: select distinct 'application/' || a.id || '/#' from "user" u inner join organization_user ou on ou.user_id = u.id inner join organization o on o.id = ou.organization_id inner join application a on a.organization_id =$
INFO[2018-07-08T21:36:10+01:00] Backend registered: JWT
INFO[2018-07-08T21:36:10+01:00] Cache activated
ERRO[2018-07-08T21:36:10+01:00] couldn't start Redis, defaulting to no cache. error: ERR Client sent AUTH, but no password is set
INFO[2018-07-08T21:36:10+01:00] Prefixes enabled for backends with prefixes filesprefix, pgprefix, jwtprefix.
1531082170: Opening websockets listen socket on port 9001.
1531082170: Opening ipv4 listen socket on port 1883.
1531082170: Opening ipv6 listen socket on port 1883.
1531082171: New connection from ::1 on port 1883.
1531082171: New connection from ::1 on port 1883.
DEBU[2018-07-08T21:36:11+01:00] checking user loraserver with backend Files
DEBU[2018-07-08T21:36:12+01:00] user loraserver authenticated with backend Files
1531082172: New client connected from ::1 as 359a901f-5f3f-487e-bf50-d400a284f695 (c1, k30, u'loraserver').
DEBU[2018-07-08T21:36:12+01:00] checking user loraappserver with backend Files
DEBU[2018-07-08T21:36:13+01:00] user loraappserver authenticated with backend Files
1531082173: New client connected from ::1 as 527ae1a1-2979-4ac2-8d98-31dd4cfe5f5c (c1, k30, u'loraappserver').
From the regular log file I only changed db_user,db_name and db_password.
So you can see an error:
ERRO[2018-07-08T21:36:10+01:00] couldn't start Redis, defaulting to no cache. error: ERR Client sent AUTH, but no password is set
???
Then if I use my client paho MQTT which is localhost listener (port:9001) I retrieved this error:
1531082288: Socket error on client <unknown>, disconnecting.
1531082288: Socket error on client <unknown>, disconnecting.
1531082288: Socket error on client <unknown>, disconnecting.
I have to store this client under mosquitto-go-auth?
To finish after starting the service after a few minutes I get back this kind of log:
1531082587: New connection from 192.168.0.26 on port 1883.
DEBU[2018-07-08T21:43:07+01:00] checking user loragw with backend Files
DEBU[2018-07-08T21:43:08+01:00] user loragw authenticated with backend Files
1531082588: New client connected from 192.168.0.26 as febfd1b0-dccb-4b51-b908-45db9761c21b (c1, k30, u'loragw').
auth-plugin.c: starting acl check at auth-plugin.c
clientid: febfd1b0-dccb-4b51-b908-45db9761c21b
username: loragw
topic: gateway/008000000000ace0/stats
access: 2
DEBU[2018-07-08T21:43:19+01:00] Superuser check with backend Files
DEBU[2018-07-08T21:43:19+01:00] Superuser check with backend Postgres
DEBU[2018-07-08T21:43:19+01:00] Checking Postgres for superuser with username loragw
DEBU[2018-07-08T21:43:19+01:00] sql query to be executed query="select count(*) from \"user\" where username = $1 and is_admin = true" username=loragw
DEBU[2018-07-08T21:43:19+01:00] Superuser check with backend JWT
DEBU[2018-07-08T21:43:19+01:00] jwt parse error: token contains an invalid number of segments
DEBU[2018-07-08T21:43:19+01:00] jwt get superuser error: token contains an invalid number of segments
DEBU[2018-07-08T21:43:19+01:00] Acl check with backend Files
INFO[2018-07-08T21:43:19+01:00] Files acl check with user loragw, topic: gateway/008000000000ace0/stats, clientid: febfd1b0-dccb-4b51-b908-45db9761c21b and acc: 2
INFO[2018-07-08T21:43:19+01:00] Files acl check passed.
DEBU[2018-07-08T21:43:19+01:00] user loragw acl authenticated with backend Files
DEBU[2018-07-08T21:43:19+01:00] Acl is %!s(bool=true) for user loragw
auth-plugin.c: starting acl check at auth-plugin.c
clientid: 359a901f-5f3f-487e-bf50-d400a284f695
username: loraserver
topic: gateway/008000000000ace0/stats
access: 1
DEBU[2018-07-08T21:43:19+01:00] Superuser check with backend Files
DEBU[2018-07-08T21:43:19+01:00] Superuser check with backend Postgres
DEBU[2018-07-08T21:43:19+01:00] Checking Postgres for superuser with username loraserver
DEBU[2018-07-08T21:43:19+01:00] sql query to be executed query="select count(*) from \"user\" where username = $1 and is_admin = true" username=loraserver
DEBU[2018-07-08T21:43:19+01:00] Superuser check with backend JWT
DEBU[2018-07-08T21:43:19+01:00] jwt parse error: token contains an invalid number of segments
DEBU[2018-07-08T21:43:19+01:00] jwt get superuser error: token contains an invalid number of segments
DEBU[2018-07-08T21:43:19+01:00] Acl check with backend Files
INFO[2018-07-08T21:43:19+01:00] Files acl check with user loraserver, topic: gateway/008000000000ace0/stats, clientid: 359a901f-5f3f-487e-bf50-d400a284f695 and acc: 1
INFO[2018-07-08T21:43:19+01:00] Files acl check passed.
DEBU[2018-07-08T21:43:19+01:00] user loraserver acl authenticated with backend Files
DEBU[2018-07-08T21:43:19+01:00] Acl is %!s(bool=true) for user loraserver
thanks for your help