Session.ClientIp.Country

Use this forum to post questions relating to WinGate, feature requests, technical or configuration problems

Moderator: Qbik Staff

Session.ClientIp.Country

Postby JR Africa » Feb 02 16 7:22 pm

Hi Guys

I have amended my POP3 Collection service policy to check for country.
Unfortunately I appear to be getting no result from the query.
The notification of the list lookup check {{Session.ClientIp.Country}} is giving me "??"

I have taken advice and even replicated the policy attachment in this thread to no avail.
http://forum.wingate.com/viewtopic.php?f=12&t=51716

Any ideas ?
Thanks
JR Africa
 
Posts: 39
Joined: Aug 31 12 2:20 am

Re: Session.ClientIp.Country

Postby adrien » Feb 02 16 11:20 pm

Hi

Session.ClientIp is the IP of the client that connected to WinGate.

For the POP3 collection service, there is no client connecting to WinGate, it's WinGate which is the client.

Are you trying to check the country of the server you're connecting to, or did you mean a different service (e.g. POP3 server)?

Adrien
adrien
Qbik Staff
 
Posts: 5441
Joined: Sep 03 03 2:54 pm
Location: Auckland

Re: Session.ClientIp.Country

Postby JR Africa » Feb 03 16 11:05 pm

Hi Adrien

Ok that makes sense lol.

I am trying to see if I can block emails received from a specific country.
Can I utilise anything to check the mail header FROM ip to cross reference the country tables ?
Service : POP3 Collection Service : MessageRetrieved

J
JR Africa
 
Posts: 39
Joined: Aug 31 12 2:20 am

Re: Session.ClientIp.Country

Postby adrien » Feb 05 16 7:48 am

Hi

You'd need to access the most recent "Received" header, which logs the sending IP. Even though you can get header values from the event processor, you'd need to be able to parse the IP out, then assign it to an IPAddress object which has the Country member you could then check.

You could use a Jscript or Lua script to parse. Or you may have more luck spawning an external program or script to process the file.

Adrien
adrien
Qbik Staff
 
Posts: 5441
Joined: Sep 03 03 2:54 pm
Location: Auckland

Re: Session.ClientIp.Country

Postby JR Africa » Sep 28 16 8:04 pm

Hi Adrien

Old thread I know but I am still struggling with this one.

I have managed to extract the IP address from the message by first checking if Message.HasHeader("X-SF-Originating-IP") exists and then {{Message.GetHeader("X-SF-Originating-IP")}}.

I am really battling to parse this out and compare it to the built in IP to Country engine.

You mentioned using either Jscript or Lua script, but all attempts at this have usually ended up with Wingate crashing. Clearly I am not doing something right.

Could you possibly provide me with an example to take this IP and use it to query the Country engine and return the country code ?

Many thanks
JR Africa
 
Posts: 39
Joined: Aug 31 12 2:20 am

Re: Session.ClientIp.Country

Postby adrien » Oct 06 16 1:18 pm

Hi

I think probably the best solution would be to add / publish a function that can be used to look up the country code of an IP specified as text. This would avoid having to convert the header value somehow to an IP address object.

Because in the MessageRetrieved event there's no spare IP Address object you can assign to.

I'll whack it into WinGate 9 which is due out fairly soon, and let you know.

Regards

Adrien
adrien
Qbik Staff
 
Posts: 5441
Joined: Sep 03 03 2:54 pm
Location: Auckland


Return to WinGate

Who is online

Users browsing this forum: Bing [Bot] and 34 guests

cron