[Mosquitto-users] Bridging issues

2012-07-31 Thread Frisch, Michael
I'm trying to configure bridging in a master-slave type configuration where the 
slaves connection to the masters and subscribe to the topics in the IN 
direction only.  I was having issues with 0.15 but seeing as the release of 1.0 
is soon I decided to check out the branch and build it.  I seem to be having 
two different issues at the moment.

First issue is if I use a username/password for the bridge.  I see that the 
slave connects, connects to the three topics that I want it listening to, and 
then a socket error.
Slave output:
1343748661: Connecting bridge mosquitto_master
1343748661: Bridge test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master 
sending CONNECT
1343748661: Received CONNACK on connection 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master.
1343748661: Bridge test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master 
sending SUBSCRIBE (Mid: 154, Topic: a/#, QoS: 0)
1343748661: Bridge test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master 
sending SUBSCRIBE (Mid: 155, Topic: b/#, QoS: 0)
1343748661: Bridge test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master 
sending SUBSCRIBE (Mid: 156, Topic: d/#, QoS: 0)
1343748661: Received PUBREC from 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 11)
1343748661: Socket read error on client 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master, disconnecting.
Master output:
1343748692: New connection from 127.0.0.1.
1343748692: New client connected from 127.0.0.1 as 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master.
1343748692: Sending CONNACK to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (0)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 11)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 12)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 13)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 14)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 15)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 16)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 17)
1343748692: Sending PUBREC to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 18)
1343748692: Received PUBLISH from 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (d0, q1, r1, m157, 
'$SYS/broker/connection/test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master/state',
 ... (2 bytes))
1343748692: Sending PUBACK to 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 157)
1343748692: Socket error on client 
test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master, disconnecting.

The second issue presents itself if I don't have a username/password set for 
the bridge, I have an ACL still set, but anonymous users can read from the 
topics I wish to subscribe to.  I can successfully bridge the slave to the 
master and messages that are published to the master are in turn published to 
the slave but the slave does not publish those messages to other clients 
listening to those messages.  If I publish directly to the slave the clients do 
get the messages that they are subscribed to.

I'm using CentOS 6.2 on both slave and master.
-- 
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Bridging issues

2012-07-31 Thread Roger Light
Hi Michael,

> First issue is if I use a username/password for the bridge.  I see that the
> slave connects, connects to the three topics that I want it listening to,
> and then a socket error.
>
> Slave output:

...

> 1343748661: Received PUBREC from
> test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 11)

I'm a bit concerned as to where this is coming from and the same on
the master side. I wonder if the problem is related to undelivered
messages stored on the master. Could you try putting your mosquitto.db
to one side on the master and the slave and restarting them?

If this works it only fixes the symptom not the problem, but it's
useful to know what's going on.

> The second issue presents itself if I don’t have a username/password set for
> the bridge, I have an ACL still set, but anonymous users can read from the
> topics I wish to subscribe to.  I can successfully bridge the slave to the
> master and messages that are published to the master are in turn published
> to the slave but the slave does not publish those messages to other clients
> listening to those messages.  If I publish directly to the slave the clients
> do get the messages that they are subscribed to.

This is down to ACLs being applied to local bridges but having no
mechanism to set a local username/password as well as a remote
username/password. I did fix it so that local bridges aren't
constrained by local ACLs but it looks like that change has gone
astray in some code rearrangement. I've put the fix back in if you
want to give it a try.

Cheers,

Roger

-- 
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Bridging issues

2012-07-31 Thread Frisch, Michael
Roger,

That worked.

Maybe send a patch file that I could apply locally and test.  If nothing else 
it'll point me at where in the code base to try making a general fix.

Thanks,
Michael

From: mosquitto-users-bounces+michael.frisch=nuance@lists.launchpad.net 
[mosquitto-users-bounces+michael.frisch=nuance@lists.launchpad.net] on 
behalf of Roger Light [ro...@atchoo.org]
Sent: Tuesday, July 31, 2012 6:56 PM
To: mosquitto-users@lists.launchpad.net
Subject: Re: [Mosquitto-users] Bridging issues

Hi Michael,

> First issue is if I use a username/password for the bridge.  I see that the
> slave connects, connects to the three topics that I want it listening to,
> and then a socket error.
>
> Slave output:

...

> 1343748661: Received PUBREC from
> test-us-east-mqtt-40e9eb38.swypeconnect.com.mosquitto_master (Mid: 11)

I'm a bit concerned as to where this is coming from and the same on
the master side. I wonder if the problem is related to undelivered
messages stored on the master. Could you try putting your mosquitto.db
to one side on the master and the slave and restarting them?

If this works it only fixes the symptom not the problem, but it's
useful to know what's going on.

> The second issue presents itself if I don’t have a username/password set for
> the bridge, I have an ACL still set, but anonymous users can read from the
> topics I wish to subscribe to.  I can successfully bridge the slave to the
> master and messages that are published to the master are in turn published
> to the slave but the slave does not publish those messages to other clients
> listening to those messages.  If I publish directly to the slave the clients
> do get the messages that they are subscribed to.

This is down to ACLs being applied to local bridges but having no
mechanism to set a local username/password as well as a remote
username/password. I did fix it so that local bridges aren't
constrained by local ACLs but it looks like that change has gone
astray in some code rearrangement. I've put the fix back in if you
want to give it a try.

Cheers,

Roger

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp
-- 
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp