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

    Execute script when a specific TCP connection has been established

    Scheduled Pinned Locked Moved General pfSense Questions
    5 Posts 3 Posters 544 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.
    • S
      s0nic
      last edited by

      I want a script to run when a specific TCP connection (Client –-> pfSense ---> Suspicious Internet Host) has been established. Does anyone have an idea how this can be solved?

      ;) Blocking is not the solution I'm asking for.

      tcptrack, tcpdump, iptables, suggestions?

      TNX
      S0NIC

      1 Reply Last reply Reply Quote 0
      • GruensFroeschliG
        GruensFroeschli
        last edited by

        How hacky can it be?

        We do what we must, because we can.

        Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

        1 Reply Last reply Reply Quote 0
        • S
          s0nic
          last edited by

          Medium to high should be ok.

          1 Reply Last reply Reply Quote 0
          • NogBadTheBadN
            NogBadTheBad
            last edited by

            Snort, no blocking and a custom alert ?

            The following alerts me when there is an inbound or outbound SSH connection to or from my DMZ :-

            alert tcp $EXTERNAL_NET any -> $HOME_NET $SSH_PORTS (msg:"SFTP/SSH INBOUND";
            flow:established,to_server;content:"SSH-";sid:1000501;rev:1;classtype:not-suspicious)

            alert tcp $HOME_NET any -> $EXTERNAL_NET $SSH_PORTS (msg:"SFTP/SSH OUTBOUND";
            flow:established,to_server;content:"SSH-";sid:1000502;rev:1;classtype:not-suspicious)

            It won't run a script, but what do you want the script to do ?

            Andy

            1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

            1 Reply Last reply Reply Quote 0
            • GruensFroeschliG
              GruensFroeschli
              last edited by

              really hacky:
              https://forum.pfsense.org/index.php?topic=65092.msg354840#msg354840

              You should be able to change the tcpdump arguments for it to look for the frames you're interested in.

              We do what we must, because we can.

              Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

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