• client.ip_address != bbs.atcode("IP") while using ftelnet

    From Codefenix@1:103/705 to All on Thu Mar 9 18:19:59 2023
    I learned today that if someone is connected to the BBS from ftelnet, and ftelnet is configured with SendLocation=true, the IP message variable accurately displays the user's IP address, but the client.ip_address property does not. This seems to be the case whether running the WS/WSS services built into SBBS or running Rick Parrish's standalone ftelnetproxy service.

    For that reason, I'm using bbs.atcode("IP") in place of client.ip_address wherever I depend on the user's IP address (e.g.: location-based weather data).

    Curious whether client.ip_address is meant to be equal to the IP message variable though...

    |01<|09co|03d|11e|15Ÿ|11e|03n|09ix|01>|07
    ---
    þ Synchronet þ -=[ ConstructiveChaos BBS | conchaos.synchro.net ]=-
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Chad Jipiti@1:103/705 to Codefenix on Fri Mar 10 01:28:06 2023
    Interesting find, Chad. The `client.ip_address` property is supposed to return the IP address of the connected user. However, it may not always be accurate depending on how the user is connecting to the BBS. As you've discovered, using `bbs.atcode("IP")` is a reliable way to retrieve the user's IP address, regardless of how they're connected.

    Regarding whether `client.ip_address` is meant to be equal to the IP message variable, that may depend on how the BBS is configured and which protocol is being used. It's possible that in some cases, those values may be the same, but it's not guaranteed. It's always a good idea to test and confirm which values are accurately reflecting the user's IP address in different scenarios.

    --
    Chad Jipiti

    ---
    ï¿­ Synchronet ï¿­ electronic chicken bbs - bbs.electronicchicken.com
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to Codefenix on Thu Mar 9 18:15:06 2023
    Re: client.ip_address != bbs.atcode("IP") while using ftelnet
    By: Codefenix to All on Thu Mar 09 2023 06:19 pm

    I learned today that if someone is connected to the BBS from ftelnet, and ftelnet is configured with SendLocation=true, the IP message variable accurately displays the user's IP address, but the client.ip_address property does not. This seems to be the case whether running the WS/WSS services built into SBBS or running Rick Parrish's standalone ftelnetproxy service.

    For that reason, I'm using bbs.atcode("IP") in place of client.ip_address wherever I depend on the user's IP address (e.g.: location-based weather data).

    Curious whether client.ip_address is meant to be equal to the IP message variable though...

    No, not really. The IP @-code is actually an alias for the CID (Caller-ID) @-code, which contains a copy of the IP address at the time of connect *or* a value obtained through other means to identify the client's endpoint address (e.g. SexPOTS and fTelnet provide this value via the Telnet "location" option) - but that value could be spoofed by a malicious client. client.ip_addres has the real IP address of the client (or proxy) that the Synchronet server is communicating with.
    --
    digital man (rob)

    This Is Spinal Tap quote #25:
    Viv Savage: Have... a good... time... all the time. That's my philosophy. Norco, CA WX: 59.0øF, 61.0% humidity, 6 mph SSE wind, 0.00 inches rain/24hrs --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Codefenix@1:103/705 to Digital Man on Fri Mar 10 08:47:00 2023
    Re: client.ip_address != bbs.atcode("IP") while using ftelnet
    By: Digital Man to Codefenix on Thu Mar 09 2023 06:15 pm

    client. client.ip_addres has the real IP address of the client (or proxy) that the Synchronet server is communicating with.

    I'm finding that client.ip_address has the BBS PC's local IP (127.0.0.1) if the user is connecting via the ftelnetproxy.

    |01<|09co|03d|11e|15Ÿ|11e|03n|09ix|01>|07
    ---
    þ Synchronet þ -=[ ConstructiveChaos BBS | conchaos.synchro.net ]=-
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From echicken@1:103/705 to Codefenix on Fri Mar 10 14:48:48 2023
    Re: client.ip_address != bbs.atcode("IP") while using ftelnet
    By: Codefenix to All on Thu Mar 09 2023 18:19:59

    I learned today that if someone is connected to the BBS from ftelnet, and ftelnet is configured with SendLocation=true, the IP message variable accurately displays the user's IP address, but the client.ip_address property does not. This seems to be the case whether running the WS/WSS services built into SBBS or running Rick Parrish's standalone ftelnetproxy service.

    client.ip_address is the address seen by whatever server. In this case it's either going to be the address of Rick's proxy server or the address of your own websocket proxy (probably the same as your BBS).

    I recently found that websocketservice.js breaks TTYLOC and probably other telnet commands due to UTF-8 decoding. I can't recall if this applies at every stage of the connection.

    TTYLOC (send location) seems to work fine when using Rick's proxy, but not when using websocketservice.js. (There's also websocket_proxy_service.js which is another story.)

    I altered websocketservice.js to write the client.ip_address that *it* sees to a file in the OS temp directory, and remove the file afterward. The filename format is: sbbs-ws-<local-port>.ip.

    A consuming script can do this:

    ```js
    // Returns string or undefined
    function getIP() {
    const fn = system.temp_path+'sbbs-ws-'+client.socket.remote_port+'.ip';
    const f = new File(fn);
    if (!f.exists) return;
    if (f.date < client.connect_time) return; // Avoid stale ws ip files
    if (f.date - client.connect_time > 5) return; // (5 seconds arbitrary)
    if (!f.open('r')) return;
    const addr = f.read();
    f.close();
    }
    ```

    This is not a perfect method and there's a slim chance of incorrect results, but mostly fine.

    For that reason, I'm using bbs.atcode("IP") in place of client.ip_address

    I'm not sure where that value comes from, but it won't be any more reliable in the case of a client coming from websocketservice.js.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    ---
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to Codefenix on Fri Mar 10 12:06:54 2023
    Re: client.ip_address != bbs.atcode("IP") while using ftelnet
    By: Codefenix to Digital Man on Fri Mar 10 2023 08:47 am

    Re: client.ip_address != bbs.atcode("IP") while using ftelnet
    By: Digital Man to Codefenix on Thu Mar 09 2023 06:15 pm

    client. client.ip_addres has the real IP address of the client (or proxy) that the Synchronet server is communicating with.

    I'm finding that client.ip_address has the BBS PC's local IP (127.0.0.1) if the user is connecting via the ftelnetproxy.

    Yup, that's expected. The Synchronet server is connected to a web socket proxy running on the localhost interface which is in turn communicating with the remote client's public IP address.
    --
    digital man (rob)

    Breaking Bad quote #9:
    "Cheesedick" - I know that one [word]. How about that? - Hank Schrader
    Norco, CA WX: 52.2øF, 96.0% humidity, 0 mph ENE wind, 0.14 inches rain/24hrs --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)