Distinguish users according to IP address they connect from

I have installed Openfire on Windows Server 2016, all users are using Spark, everybody sees all the other users in a common group by default. I have set the forwarding and reverse NAT on the network gateway so that everybody can connect either from LAN or the internet.
Our previous chat utility was simple LAN server-less system, thus not working from outside the network, but it had the advantage, that you could see, who is present in the building at the time.
I would like to achieve this somehow with Openfire - I was thinking maybe auto assigning user to a group, dependig on IP address he is connecting from (LAN range one group, every other second group). Is this possible somehow?
If it’s not viable for groups, status would be good enough (like people on LAN are Free to chat, people outside LAN are just online on connection, with the option to manually change it later).
Thanks in advance for any help or direction

If I were doing this, I’d write a standalone plugin. It would register a org.jivesoftware.openfire.event.SessionEventListener, and when someone joins (sessionCreated) could examine their address - session.getHostAddress() - and assign them to an appropriate group.

Greg

Thanks for your reply.
Well, I thought it will come to this and hoped to avoid it, as time is short…
Any hint for complete beginner in writing plugins for openfire, like where to start looking for info for this?
Also, I forgot to mention, users are taken from LDAP, so I don’t know if there is easy way to change their group, asi this is read from LDAP as read only. So maybe a plugin that sets their status to extended away on every status change AND if they are outside LAN?

Regarding plugins, I’d start with the MotDPlugin (it sends an email when a user logs in) - copy it, rename it, make sure you can get it working, then modify it.

As to your exact solution - your suggestion seems like it would work on a technical level, but only you can answer if it meets your needs!

Greg

1 Like