2

I'm running Prosody server on ubuntu.
I was wondering if there's a possible way to get the IP address of each client who connects to my server, basically, I want 2 things:
1) I want to get the IP address of the user who uses a JID of my server.
2) I want to get the IP address of the user who enters a conference on my server.
Now there's a module that works kinda similar like what I need, but to get the IP, I have to use prosodyctl which doesn't help what I'm trying to do.
So, is there a possible way to save their IPs in a file maybe? or any other way to get it rather than using prosodyctl? Thank you.

Cha0s
  • 2,432
  • 2
  • 15
  • 26
KiDo
  • 145
  • 9
  • Have you looked in the prosody log file? – EEAA Apr 14 '15 at 12:11
  • 2
    @EEAA AFAIK by default the prosody config does not contain the clients' IPs. Only s2s connections IPs. KiDo I guess you could use a cron script to run prosodyctl and append the output to a file which you can then use for what your are trying to do. – Cha0s Apr 14 '15 at 12:13
  • 1
    @EEAA yes I did, there's a line where it tells that my JID has been connected to the server, but it doesn't give the IP address. – KiDo Apr 14 '15 at 12:14
  • 1
    That's a ridiculous design decision on the part of the prosody devs. – EEAA Apr 14 '15 at 12:15
  • 2
    Or they decided to respect the users' privacy by logging only non-identifiable stuff by default :) – Cha0s Apr 14 '15 at 12:18
  • @Cha0s nice idea, but I'm afraid it doesn't help as well, because running "prosodyctl" requires to add the JID of the user at the end of the command like this: "prosodyctl mod_lastlog username@example.com" – KiDo Apr 14 '15 at 12:22

1 Answers1

1

You need to enable mod_log_auth

https://code.google.com/p/prosody-modules/wiki/mod_log_auth

Then you need to add the following on your config file:

log_auth_ips = "all"

This will log the IP of all incoming connections (failed or not).

Cha0s
  • 2,432
  • 2
  • 15
  • 26
  • 1
    Thanks, it worked, but only 50%. I reconnected and my IP has been saved in the log file, so #1 is completed, but for #2, it didn't save the IP of whom joins a room on the server. which means it only saves the IP of whom has a JID on same my server. – KiDo Apr 14 '15 at 13:05
  • 1
    I see. I am afraid I don't know how to help you for #2. Maybe with some editing on mod_log_auth you could get it to also log the IPs of MUC rooms. If the JID is not on the same server, I believe you can only get the remote IP of the server that actually hosts the JID. – Cha0s Apr 14 '15 at 13:09
  • Seems like I can only get the IP of the server they're using, but their server doesn't redirect their IP to me, so I can only get the IP of the server and not the client. – KiDo Apr 14 '15 at 13:57
  • Indeed. On second thought that's absolutely normal. XMPP is quite alike SMTP in it's architecture. Same as with Email, you cannot see the IP of the user sending the email, but the IP of the SMTP server is using to send the email. That's the same with XMPP too with s2s connections. – Cha0s Apr 14 '15 at 14:08