Get remote address in Provision script

Hi there!

I need to identify our customers by IP Address. With the IP and some ext script i can query our radius server for the NAS-Port-Id to find the correct customer in our systems to provision some SIP Accounts.

However, i dont really want to rely on any “…Wan[IP|PPP]Connection.ExternalAddress” since this is more or less User-Supplied (or can be by some rougue Tr069 Client).Is there any way to get the Remote-IP from the http request inside of a provision script? Maybe via another exposed function (like declare/log/etc)?

Thanks in advance!

Kind regards!

Oh, seems like there already is a pull request for something like that https://github.com/genieacs/genieacs/pull/347

My current approach is more or less the same:

import { getRequestOrigin } from "./forwarded";
...
function rip(): any {
  let ip = "0.0.0.0";
  ip = getRequestOrigin(state.sessionContext.httpRequest).remoteAddress;
 return ip;
}