processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6k stars 1.5k forks source link

How to get the client IP for authentication purposes in an external auth script? #4217

Open joe-average-user opened 1 month ago

joe-average-user commented 1 month ago

Hello all,

for lack of a better way of communication I try this one :-) I'd like to make an external authentication script like those published on the website. But reading the ones already there I see no option to get the client ip in such a script. Can anyone capable please elaborate on how to do that? Thank you!

Regards

weiss commented 1 month ago

for lack of a better way of communication I try this one :-)

There's the ejabberd@conference.process-one.net room, for example.

I'd like to make an external authentication script like those published on the website. But reading the ones already there I see no option to get the client ip in such a script. Can anyone capable please elaborate on how to do that?

This would require an ejabberd patch for passing the IP address to the authentication script. I need that myself and could give you my local commit if you happen to build ejabberd from source.

joe-average-user commented 1 month ago

Hello,

thank you for your immediate reaction. It would be great to have your commit! And please add a short info on what version to apply best, as I am doing this on a productive platform. I am building it on arch linux. Thanks again!

-- Regards

mremond commented 1 month ago

Hello @weiss,

Do you think we could have a patch that is backward compliant with older version of the script for people that use it in production already ?

weiss commented 1 month ago

It would be great to have your commit!

It's currently used with a very old ejabberd version and it's based on other local commits, but I had a quick go at rebasing it onto ejabberd 24.02:

https://github.com/weiss/ejabberd/tree/feature/extauth-ip

I did not yet get around to testing this version (beyond "it compiles"), sorry.

Do you think we could have a patch that is backward compliant with older version of the script

I think this would require a new ejabberd option to specify the extauth format/version.

joe-average-user commented 1 week ago

Hello again, we made further tests and seem to have included your patch into ejabberd 23.10. Now some questions arise, mainly from and around checking the system.