Notification when a connection is established



  • Is it possible to setup a notification that a TCP connection has been established? If so please explain which package I would use or point me in the right direction.

    Example:

    I setup a port forward to access a camera from the outside of my network to the inside. When a connection is made, I would like the firewall to email me to let me know a connection has been established from X.X.X.X (remote client's public IP) going to Y.Y.Y.Y (My camera's private IP)

    Thanks in advance.



  • @mikeisfly Using a VPN to connect to your camera would give you instant notification that you're connected...



  • @NollipfSense I'm not trying to connect to the camera remotely I want to be notified when someone else connects to the camera remotely and I don't want to have to log into the firewall and keep refreshing the state table to see if that's done.



  • @mikeisfly That's why you use VPN. Is this your personal camera? Do you give out access to this camera to others?



  • @NollipfSense I know what the purpose of a VPN is. I'm working with a engineer to see if I can get greater compatibility between their software and my cameras. What I'm looking for specifically is the feature I'm asking about. It may not be possible but I think it could be a good diagnostic/information tool. I could look at the logs of the camera, I could refresh the state table of the firewall but this isn't what I'm asking for. I don't want to pull the information I want a notification pushed to me when a event happens (TCP connection to my camera). I can access the camera fine from outside my network.



  • @mikeisfly I am sure you should be able to accomplish the task with a script. You could search if there is such a script or one that you modify to your use. You could also consider may be posting a bounty



  • @mikeisfly : VPN is/was mentioned, because normally, devices like cameras are not accessible 'by the public' from the outside.

    I'm using myself a dedicated VPN access set on my home devices and Phone so I can access the companies network, which enables my to launch the app that let's me see all the connected cameras.

    By local law (France), I am allowed to use 'snapshots' on our web site (although the first camera is showing our clients up-close ... oops).

    With a simple scripts I do receive mails when some one is using a camera VPN access.

    I know, really public web cams exist. But imagine : these can be hit by really a lot of IP's (hit by a robot ?) : be ready to send out huge number of mails ...

    A solution might be : use a firewall (NAT) pass rule and have it log.
    Set up the logging to an external syslog server, and have something like fail2ban to analyse it. fail2ban could ban (not needed here) and also send a mail when a rule hits the criteria (visiting the IP of the camera).

    pfSense, by itself : you'll be in for some basic shell (bash or Python) scripting.



  • @Gertjan said in Notification when a connection is established:

    I know, really public web cams exist. But imagine : these can be hit by really a lot of IP's (hit by a robot ?)

    Security cameras are not just put on a network by themselves. There is a recorder, which the cameras connect to. Those cameras should be on their own network, with only the recorder reachable from elsewhere. Many recorders will have 2 network connections for that reason.



  • @JKnott said in Notification when a connection is established:

    There is a recorder, which the cameras connect to

    That's what I use : a stack of big boxes ( [these](https://www.dahuasecurity.com/products/productDetail/28297 - sorry for the publicity) ) with all the cameras and screens connected to it.
    But a typical SOHO camera these days has a Wifi interface, and are used as a local LAN autonomous device.



  • I have four Hikvision cameras on my network; so, I was looking at them to see whether the camera could notify...the events doesn't cover network access...only what the camera sees. Also, any robust firewall setup would not include access to LAN without the LAN device initiates the contact.



  • @NollipfSense what about a port forward. If you set that up then the camera will accept connection from the outside provided you have a strong username and password at the end device. Again I'm just looking for a particular functionality pfSense.



  • @mikeisfly Port forward would work if your intent is to give a few accesses to the camera...you might able to may be use Radius and script to email you when that happens. If the intent is to see whether anyone access the camera from the outside well a robust firewall would not allow that.



  • @mikeisfly said in Notification when a connection is established:

    Again I'm just looking for a particular functionality pfSense.

    There is no such built-in functionality within pfSense (nor any other firewall that I am aware of). The way to do this is to send all logs to an external server or SIEM and then parse the logs there and fire alerts on specific traffic from tools on that external server.

    There are many options in the external logging and SIEM world from free to $100,000 USD and more.



  • @bmeeks said in Notification when a connection is established:

    @mikeisfly said in Notification when a connection is established:

    Again I'm just looking for a particular functionality pfSense.

    There is no such built-in functionality within pfSense (nor any other firewall that I am aware of). The way to do this is to send all logs to an external server or SIEM and then parse the logs there and fire alerts on specific traffic from tools on that external server.

    There are many options in the external logging and SIEM world from free to $100,000 USD and more.

    Thank you. Maybe this is something the development team may want to look at to make the product stand out even more. Not sure who is looking for the feature but it occurred to me a few weeks ago, that it would be nice to have.


  • Netgate Administrator

    So like an alert-on-match option maybe?

    This is the first time I've seen it requested so there may not be much drive but I could see that being useful.

    Steve



  • @stephenw10 said in Notification when a connection is established:

    So like an alert-on-match option maybe?

    This is the first time I've seen it requested so there may not be much drive but I could see that being useful.

    Steve

    Yes, that would be awesome.



  • @bmeeks said in Notification when a connection is established:

    @mikeisfly said in Notification when a connection is established:

    Again I'm just looking for a particular functionality pfSense.

    There is no such built-in functionality within pfSense (nor any other firewall that I am aware of). The way to do this is to send all logs to an external server or SIEM and then parse the logs there and fire alerts on specific traffic from tools on that external server.

    There are many options in the external logging and SIEM world from free to $100,000 USD and more.

    +1 on what Bill said. I can personally recommend an ELK setup which you can send the pfSense logs to. I believe you can then setup alerts on a particular event. ELK is free and can be easily setup on Linux since it's very well documented (even I was able to do it). I've never used ELK for alerting, but I might eventually. Right now it's only for super fast log searches and nice visuals to quickly see things.



  • @mikeisfly said in Notification when a connection is established:

    Maybe this is something the development team may want to look at to make the product stand out even more.

    I can see this been useful on the camera as part of the camera's event monitoring...just not on a firewall. The day I get that notification is the day the firewall goes in the trash bin. I even block my cameras from going out to check for firmware update.



  • @NollipfSense said in Notification when a connection is established:

    @mikeisfly said in Notification when a connection is established:

    Maybe this is something the development team may want to look at to make the product stand out even more.

    I can see this been useful on the camera as part of the camera's event monitoring...just not on a firewall. The day I get that notification is the day the firewall goes in the trash bin. I even block my cameras from going out to check for firmware update.

    Not sure why getting a notification about a event that happened from a connection you explicitly allowed would be a bad thing? I'm looking for this functionality as more of a tracking tool. Like with any service the development team might implement you don't have to use it.



  • @Raffi_ said in Notification when a connection is established:

    @bmeeks said in Notification when a connection is established:

    @mikeisfly said in Notification when a connection is established:

    Again I'm just looking for a particular functionality pfSense.

    There is no such built-in functionality within pfSense (nor any other firewall that I am aware of). The way to do this is to send all logs to an external server or SIEM and then parse the logs there and fire alerts on specific traffic from tools on that external server.

    There are many options in the external logging and SIEM world from free to $100,000 USD and more.

    +1 on what Bill said. I can personally recommend an ELK setup which you can send the pfSense logs to. I believe you can then setup alerts on a particular event. ELK is free and can be easily setup on Linux since it's very well documented (even I was able to do it). I've never used ELK for alerting, but I might eventually. Right now it's only for super fast log searches and nice visuals to quickly see things.

    Thanks for the suggestion.



  • @mikeisfly said in Notification when a connection is established:

    @NollipfSense said in Notification when a connection is established:

    @mikeisfly said in Notification when a connection is established:

    Maybe this is something the development team may want to look at to make the product stand out even more.

    I can see this been useful on the camera as part of the camera's event monitoring...just not on a firewall. The day I get that notification is the day the firewall goes in the trash bin. I even block my cameras from going out to check for firmware update.

    Not sure why getting a notification about a event that happened from a connection you explicitly allowed would be a bad thing? I'm looking for this functionality as more of a tracking tool. Like with any service the development team might implement you don't have to use it.

    Okay, got you!



  • @mikeisfly said in Notification when a connection is established:

    Not sure why getting a notification about a event that happened from a connection you explicitly allowed would be a bad thing? I'm looking for this functionality as more of a tracking tool. Like with any service the development team might implement you don't have to use it.

    I think some of the responders in this thread initially misunderstood what you wanted. You just want to know when the camera accepts an allowed connection.

    I think this type of notification should be something the endpoint device (the camera in this case) does rather than the firewall. You really want the firewall concentrated on watching traffic and processing packets as fast and efficiently as possible so as to maximize security and throughput. If you give the firewall a lot ancilary tasks that instead really should be something a SIEM or the endpoint device handles, then you start to load the firewall up with a lot of baggage. That is bad for two reasons. First, the extra code and associated libraries just provide a larger attack surface; and second, a firewall busy analyzing logs and sending email notifications runs out of time slices to handle packets efficiently and so throughput suffers.

    There is a reason that the big commerical vendors do this type of stuff either with their own separate external tool (Checkpoint's SmartCenter, for example) or refer their users to the various SIEM tools out there (ArcSight being a biggie in the commercial market).



  • @bmeeks said in Notification when a connection is established:

    @mikeisfly said in Notification when a connection is established:

    Not sure why getting a notification about a event that happened from a connection you explicitly allowed would be a bad thing? I'm looking for this functionality as more of a tracking tool. Like with any service the development team might implement you don't have to use it.

    I think some of the responders in this thread initially misunderstood what you wanted. You just want to know when the camera accepts an allowed connection.

    I think this type of notification should be something the endpoint device (the camera in this case) does rather than the firewall. You really want the firewall concentrated on watching traffic and processing packets as fast and efficiently as possible so as to maximize security and throughput. If you give the firewall a lot ancilary tasks that instead really should be something a SIEM or the endpoint device handles, then you start to load the firewall up with a lot of baggage. That is bad for two reasons. First, the extra code and associated libraries just provide a larger attack surface; and second, a firewall busy analyzing logs and sending email notifications runs out of time slices to handle packets efficiently and so throughput suffers.

    There is a reason that the big commerical vendors do this type of stuff either with their own separate external tool (Checkpoint's SmartCenter, for example) or refer their users to the various SIEM tools out there (ArcSight being a biggie in the commercial market).

    I get your point, and your point is well made. I can see if you are tracking thousands of connections 24/7. I more or less wanted to prove that this software company I was dealing with never attempted to access the camera I gave them access too, on the flip side if they did access the camera I would monitor the connection and when they were done I would shut down the port forward that I created. In general I thought it might be a good idea for trouble shooting kind of like a debug or a packet capture. While you wouldn't run it 24/7 because of the resource drain it could provide a good trouble shooting tool. Like a SNMP trap on a TCP connection.


  • Netgate Administrator

    Mmm, it would have to be limited in some way because you could easily end up sending thousands of emails.

    I could imagine situations where it might be useful.



  • @mikeisfly said in Notification when a connection is established:

    or a packet capture.

    Check a build-up of of such a packet.
    You will have your router's MAC (= pfSense), the cameras MAC, the cameras's LAN IP and the IP (WAN IP) of the visitor.
    Not the payload, as it is all TLS these days (well, the camera should send over TLS, other scrap it).
    At most, you could see who - from the outside world - visited your device. If it isn't recording, as you can check using the same access time, then you will not know what they saw.

    Btw : One of world's most famous and most used free programs, fail2ban, can do what you want right out of the box.Comparable programs exists.

    Btw : my DVR's - see above - logs user access by login code ... everything is already there.


Log in to reply