Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    That damned Foscam iOS App… (OpenVPN tun problem)

    Scheduled Pinned Locked Moved OpenVPN
    16 Posts 4 Posters 4.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • johnpozJ
      johnpoz LAYER 8 Global Moderator
      last edited by

      Again your stating that you have to be on the same network as your camera's for them to work.. So you mean on the Camera's they do not have a gateway off their local network?  ie they don't point to pfsense as their gateway??

      if your problem is your camera's do not have a gateway, then that can be solved by either giving them one or source natting your vpn connection..

      An intelligent man is sometimes forced to be drunk to spend time with his fools
      If you get confused: Listen to the Music Play
      Please don't Chat/PM me for help, unless mod related
      SG-4860 24.11 | Lab VMs 2.8, 24.11

      1 Reply Last reply Reply Quote 0
      • panzP
        panz
        last edited by

        I don't know how to do that: I need step-by-step instructions  ::)

        pfSense 2.3.2-RELEASE-p1 (amd64)
        motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

        1 Reply Last reply Reply Quote 0
        • P
          pfBasic Banned
          last edited by

          Sorry if I'm not on the same pgae with what you're trying to do here. Here's what I think you're trying to get:

          You have some Foscams that have horrible security on one subnet which you want to block from everything but that subnet.
          You want to be able to VPN into your network from your phone and view those cameras.

          I'm doing something very similiar.
          I have a Foscam with horrible security on my LAN, I wrote two rules on LAN to block the Foscam's IP from everything but the LAN, also turned off or didn't conifgure everything on the Foscam itself that tries to access the internet.
          BLOCK ANY IPV4 SOURCE:FOSCAM_IP ANY ANY ANY ANY
          BLOCK ANY IPV4 ANY ANY DESTINATION:FOSCAM_IP ANY ANY

          I run an OpenVPN server on my pfsense box, on my phone when I'm away from the network I connect to my VPN, open up the Foscam app and it works. I wrote one rule on OpenVN server's interface to pass traffic from my OVPN Server subnet to my Foscam's IP.
          PASS ANY IPV4 SOURCE:OVPN_SERVER ANY DESTINATION:FOSCAM_IP ANY ANY

          Would this work for what you're trying to achieve?

          1 Reply Last reply Reply Quote 0
          • panzP
            panz
            last edited by

            @pfBasic:

            Sorry if I'm not on the same pgae with what you're trying to do here. Here's what I think you're trying to get:

            You have some Foscams that have horrible security on one subnet which you want to block from everything but that subnet.
            You want to be able to VPN into your network from your phone and view those cameras.

            I'm doing something very similiar.
            I have a Foscam with horrible security on my LAN, I wrote two rules on LAN to block the Foscam's IP from everything but the LAN, also turned off or didn't conifgure everything on the Foscam itself that tries to access the internet.
            BLOCK ANY IPV4 SOURCE:FOSCAM_IP ANY ANY ANY ANY
            BLOCK ANY IPV4 ANY ANY DESTINATION:FOSCAM_IP ANY ANY

            I run an OpenVPN server on my pfsense box, on my phone when I'm away from the network I connect to my VPN, open up the Foscam app and it works. I wrote one rule on OpenVN server's interface to pass traffic from my OVPN Server subnet to my Foscam's IP.
            PASS ANY IPV4 SOURCE:OVPN_SERVER ANY DESTINATION:FOSCAM_IP ANY ANY

            Would this work for what you're trying to achieve?

            Yes, but my Foscam cameras are on a different and physically separated interface; the reason is: Foscam (and Dahua) "disable p2p" function on the GUI doesn't disable it at all, so I put them on a different network (different from my "trusted" LAN).

            I can access this other LAN (called "CAM" in my screenshots) with other mobile iOS Apps via OPenVPN (like the very good LiveCams Pro), but not with the Foscam App, which behaves quite odd: when I input the parameters for an IP camera, the App works well. After closing and reopening it, Foscam App stops working.

            So, when the App doesn't stop working (when re-opened)? The answer is: only if the iOS device and the camera are on the same network. I can't debug this!

            pfSense 2.3.2-RELEASE-p1 (amd64)
            motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

            1 Reply Last reply Reply Quote 0
            • johnpozJ
              johnpoz LAYER 8 Global Moderator
              last edited by

              "ther mobile iOS Apps via OPenVPN (like the very good LiveCams Pro), but not with the Foscam App, which behaves quite odd: when I input the parameters for an IP camera, the App works well. After closing and reopening it, Foscam App stops working."

              Well this has nothing to do with device not having a gateway or not letting you access it via some non local network.. This sounds like some issue with your app and how it finds/connects to devices.  Your saying it works if you put in the IP..

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 24.11 | Lab VMs 2.8, 24.11

              1 Reply Last reply Reply Quote 0
              • panzP
                panz
                last edited by

                I put the IP and it works for the first time; then, if I exit the App, the next time I launch the app it doesn't work anymore.

                The App doesn't work either when the iPhone is WiFi-connected with the AP on the LAN interface; if I move the iPhone to another AP connected on the CAM interface, the App works perfectly!

                pfSense 2.3.2-RELEASE-p1 (amd64)
                motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

                1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator
                  last edited by

                  This is clearly a app issue..

                  Fix - don't use shitty app ;)

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.8, 24.11

                  1 Reply Last reply Reply Quote 0
                  • panzP
                    panz
                    last edited by

                    I can add another square to the puzzle: I have 2 Foscam cameras on a remote site, behind a Linksys WRT64GL router with Shibby-Tomato Firmware: the App works flawlessly reaching the two cameras behind the OpenVPN connection from my iPhone to the Tomato router!

                    pfSense 2.3.2-RELEASE-p1 (amd64)
                    motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

                    1 Reply Last reply Reply Quote 0
                    • johnpozJ
                      johnpoz LAYER 8 Global Moderator
                      last edited by

                      And is your openvpn connect to this wrt54GL (no such thing as 64GL) is it tun or tap.. If the app uses some sort of broadcast to find the camera vs using the IP you put in the last time.. Then that would explain how it works on your other connection.

                      Doesn't mean its not a shitty app..  An app that has to be on the same L2 network to talk to an IP camera that clearly is meant to work while your away from your house is a shitty freaking app..

                      You say it works when you put in the IP.. So there you go pfsense isn't blocking anything, etc..  That you close the app and reopen and now it doesn't work = shitty app!!  How exactly does the app try and find the camera?  Mdns?  Broadcast for name?  Some broadcast for some port?  It shouldn't have to find anything if you put in an IP of the camera..  It should just send a syn to that IP on whatever port it uses to talk on..

                      An intelligent man is sometimes forced to be drunk to spend time with his fools
                      If you get confused: Listen to the Music Play
                      Please don't Chat/PM me for help, unless mod related
                      SG-4860 24.11 | Lab VMs 2.8, 24.11

                      1 Reply Last reply Reply Quote 0
                      • panzP
                        panz
                        last edited by

                        Now I notice that there are some differences in the two OpenVPN logs:

                        This is the log from the OpenVPN session with the WRT54GL and my iPhone (the "Add Routes" at the end of the log reports two Nets added:
                        «Add Routes:
                        172.16.6.0/24
                        10.8.0.1/32»

                        2017-01-19 17:13:49 –--- OpenVPN Start -----
                        OpenVPN core 3.0.11 ios arm64 64-bit built on Apr 15 2016 14:13:50
                        2017-01-19 17:13:49 Frame=512/2048/512 mssfix-ctrl=1250
                        2017-01-19 17:13:49 UNUSED OPTIONS
                        4 [resolv-retry] [infinite]
                        5 [persist-key]
                        6 [persist-tun]
                        13 [verb] [3]
                        15 [tls-client]
                        16 [lport] [0]
                        17 [verify-x509-name] [***_] [name]

                        2017-01-19 17:13:49 EVENT: RESOLVE
                        2017-01-19 17:13:49 Contacting :1194 via UDP
                        2017-01-19 17:13:49 EVENT: WAIT
                        2017-01-19 17:13:49 SetTunnelSocket returned 1
                        2017-01-19 17:13:49 Connecting to [
                        .ddns.net]:1194 (**********) via UDPv4
                        2017-01-19 17:13:49 EVENT: CONNECTING
                        2017-01-19 17:13:49 Tunnel Options:V4,dev-type tun,link-mtu 1558,tun-mtu 1500,proto UDPv4,comp-lzo,keydir 1,cipher AES-128-CBC,auth SHA1,keysize 128,tls-auth,key-method 2,tls-client
                        2017-01-19 17:13:49 Peer Info:
                        IV_GUI_VER=net.openvpn.connect.ios 1.0.7-199
                        IV_VER=3.0.11
                        IV_PLAT=ios
                        IV_NCP=2
                        IV_TCPNL=1
                        IV_PROTO=2
                        IV_LZO=1

                        2017-01-19 17:13:50 NET WiFi:NotReachable/WR t–----
                        2017-01-19 17:13:50 NET Internet:ReachableViaWWAN/WR t------
                        2017-01-19 17:13:52 VERIFY OK: depth=1
                        cert. version    : 3
                        serial number    : **********
                        issuer name      : C=, ST=, L=, O=OpenVPN, OU=changeme, CN=, ??=, emailAddress=
                        subject name      : C=, ST=, L=, O=OpenVPN, OU=changeme, CN=, ??=**********, **********
                        issued  on        : **********
                        expires on        : **********1
                        signed using      : RSA with SHA1
                        RSA key size      : 2048 bits
                        basic constraints : CA=true

                        2017-01-19 17:13:52 VERIFY OK: depth=0
                        cert. version    : 3
                        serial number    : 02
                        issuer name      : C=IT, ST=, L=, O=OpenVPN, OU=changeme, CN=, ??=,**********
                        subject name      : C=IT, ST=, L=, O=OpenVPN, OU=changeme, CN=, ??=, **********
                        issued  on        : **********
                        expires on        : **********
                        signed using      : RSA with MD5
                        RSA key size      : 2048 bits
                        basic constraints : CA=false
                        cert. type        : SSL Server
                        key usage        : Digital Signature, Key Encipherment
                        ext key usage    : TLS Web Server Authentication

                        2017-01-19 17:13:54 SSL Handshake: TLSv1.0/TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA
                        2017-01-19 17:13:54 Session is ACTIVE
                        2017-01-19 17:13:54 EVENT: GET_CONFIG
                        2017-01-19 17:13:54 Sending PUSH_REQUEST to server...
                        2017-01-19 17:13:54 OPTIONS:
                        0 [route] [172.16.6.0] [255.255.255.0]
                        1 [route] [10.8.0.1]
                        2 [topology] [net30]
                        3 [ping] [15]
                        4 [ping-restart] [60]
                        5 [ifconfig] [10.8.0.6] [10.8.0.5]

                        2017-01-19 17:13:54 PROTOCOL OPTIONS:
                          cipher: AES-128-CBC
                          digest: SHA1
                          compress: LZO
                          peer ID: -1
                        2017-01-19 17:13:54 EVENT: ASSIGN_IP
                        2017-01-19 17:13:54 TunPersist: saving tun context:
                        Session Name: **********.ddns.net
                        Layer: OSI_LAYER_3
                        Remote Address: ***********
                        Tunnel Addresses:
                          10.8.0.6/30 -> 10.8.0.5 [net30]
                        Reroute Gateway: IPv4=0 IPv6=0 flags=[ IPv4 ]
                        Block IPv6: no
                        Add Routes:
                          172.16.6.0/24
                          10.8.0.1/32
                        Exclude Routes:
                        DNS Servers:
                        Search Domains:

                        2017-01-19 17:13:54 Connected via tun
                        2017-01-19 17:13:54 EVENT: CONNECTED @:1194 () via /UDPv4 on tun/10.8.0.6/
                        2017-01-19 17:13:54 LZO-ASYM init swap=0 asym=0
                        2017-01-19 17:13:54 SetStatus Connected

                        –

                        This is the log of a session with pfSense and my iPhone (the "connection" that doesn't work; it added
                        «Add Routes:
                        172.16.36.0/24»
                        ):

                        2017-01-19 17:11:00 –--- OpenVPN Start -----
                        OpenVPN core 3.0.11 ios arm64 64-bit built on Apr 15 2016 14:13:50
                        2017-01-19 17:11:00 Frame=512/2048/512 mssfix-ctrl=1250
                        2017-01-19 17:11:00 UNUSED OPTIONS
                        1 [persist-tun]
                        2 [persist-key]
                        5 [tls-client]
                        7 [resolv-retry] [infinite]
                        9 [lport] [0]
                        10 [verify-x509-name] [**********] [name]

                        2017-01-19 17:11:00 EVENT: RESOLVE
                        2017-01-19 17:11:00 Contacting :1194 via UDP
                        2017-01-19 17:11:00 EVENT: WAIT
                        2017-01-19 17:11:00 SetTunnelSocket returned 1
                        2017-01-19 17:11:00 Connecting to [
                        .ddns.net]:1194 (**********) via UDPv4
                        2017-01-19 17:11:00 EVENT: CONNECTING
                        2017-01-19 17:11:00 Tunnel Options:V4,dev-type tun,link-mtu 1569,tun-mtu 1500,proto UDPv4,keydir 1,cipher AES-128-CBC,auth SHA256,keysize 128,tls-auth,key-method 2,tls-client
                        2017-01-19 17:11:00 Peer Info:
                        IV_GUI_VER=net.openvpn.connect.ios 1.0.7-199
                        IV_VER=3.0.11
                        IV_PLAT=ios
                        IV_NCP=2
                        IV_TCPNL=1
                        IV_PROTO=2

                        2017-01-19 17:11:00 VERIFY OK: depth=1
                        cert. version    : 3
                        serial number    : 00
                        issuer name      : C=IT, ST=, L=, O=MyHomeNet, emailAddress=, CN=internal-ca
                        subject name      : C=IT, ST=
                        , L=, O=MyHomeNet, emailAddress=, CN=internal-ca
                        issued  on        : **********
                        expires on        : **********
                        signed using      : RSA with SHA-256
                        RSA key size      : 2048 bits
                        basic constraints : CA=true
                        key usage        : Key Cert Sign, CRL Sign

                        2017-01-19 17:11:00 VERIFY OK: depth=0
                        cert. version    : 3
                        serial number    : 01
                        issuer name      : C=IT, ST=, L=, O=, emailAddress=, CN=internal-ca
                        subject name      : C=IT, ST=, L=, O=, emailAddress=, CN=********************
                        issued  on        : **********
                        expires on        : **********
                        signed using      : RSA with SHA-256
                        RSA key size      : 2048 bits
                        basic constraints : CA=false
                        cert. type        : SSL Server
                        key usage        : Digital Signature, Key Encipherment
                        ext key usage    : TLS Web Server Authentication, ? ? ?

                        2017-01-19 17:11:00 SSL Handshake: TLSv1.2/TLS-DHE-RSA-WITH-AES-256-GCM-SHA384
                        2017-01-19 17:11:00 Session is ACTIVE
                        2017-01-19 17:11:00 EVENT: GET_CONFIG
                        2017-01-19 17:11:00 Sending PUSH_REQUEST to server…
                        2017-01-19 17:11:00 OPTIONS:
                        0 [route] [172.16.36.0] [255.255.255.0]
                        1 [route-gateway] [10.0.9.1]
                        2 [topology] [subnet]
                        3 [ping] [10]
                        4 [ping-restart] [60]
                        5 [ifconfig] [10.0.9.2] [255.255.255.0]

                        2017-01-19 17:11:00 PROTOCOL OPTIONS:
                          cipher: AES-128-CBC
                          digest: SHA256
                          compress: NONE
                          peer ID: -1
                        2017-01-19 17:11:00 EVENT: ASSIGN_IP
                        2017-01-19 17:11:00 TunPersist: saving tun context:
                        Session Name: **********.ddns.net
                        Layer: OSI_LAYER_3
                        Remote Address: **********
                        Tunnel Addresses:
                          10.0.9.2/24 -> 10.0.9.1
                        Reroute Gateway: IPv4=0 IPv6=0 flags=[ IPv4 ]
                        Block IPv6: no
                        Add Routes:
                          172.16.36.0/24
                        Exclude Routes:
                        DNS Servers:
                        Search Domains:

                        2017-01-19 17:11:00 Connected via tun
                        2017-01-19 17:11:00 EVENT: CONNECTED @.ddns.net:1194 () via /UDPv4 on tun/10.0.9.2/
                        2017-01-19 17:11:01 SetStatus Connected
                        2017-01-19 17:11:01 NET WiFi:NotReachable/WR t–----
                        2017-01-19 17:11:01 NET Internet:ReachableViaWWAN/WR t------
                        2017-01-19 17:11:46 TUN reset routes
                        2017-01-19 17:11:46 EVENT: DISCONNECTED
                        2017-01-19 17:11:46 Raw stats on disconnect:
                          BYTES_IN : 4863
                          BYTES_OUT : 4970
                          PACKETS_IN : 15
                          PACKETS_OUT : 25
                          TUN_BYTES_IN : 1000
                          TUN_PACKETS_IN : 10
                        2017-01-19 17:11:46 Performance stats on disconnect:
                          CPU usage (microseconds): 191855
                          Tunnel compression ratio (downlink): inf
                          Network bytes per CPU second: 51252
                          Tunnel bytes per CPU second: 5212
                        2017-01-19 17:11:46 ----- OpenVPN Stop -----

                        pfSense 2.3.2-RELEASE-p1 (amd64)
                        motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

                        1 Reply Last reply Reply Quote 0
                        • P
                          pfBasic Banned
                          last edited by

                          @panz:

                          Yes, but my Foscam cameras are on a different and physically separated interface; the reason is: Foscam (and Dahua) "disable p2p" function on the GUI doesn't disable it at all, so I put them on a different network (different from my "trusted" LAN).

                          I'm no It guy at all, but I kind of thought that one of the reasons we use pfSense is because it is versatile enough to work around shitty implementations like Foscam.
                          By that I mean, why does it matter if the GUI for the webcams doesn't work? pfSense automatically blocks anything you don't write a rule to pass, and you can assign static IP's to your cameras and write rules specific to your webcams. So even if you specifically configured your cameras to make all of your feeds available to the world, if pfSense doesn't let that traffic out, it isn't going anywhere. You can even log all of the traffic on your webcams if you wanted to. Basically, is it really necessary to isolate the webcams on their own subnet? It seems like an extra, unnecessary step that is complicating things.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.