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

    2100 LED question

    Scheduled Pinned Locked Moved Hardware
    30 Posts 5 Posters 1.4k 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.
    • JonathanLeeJ
      JonathanLee
      last edited by JonathanLee

      Has anyone ever linked a LED to turn on when an access control list establishes a state.

      Example of what I want to occur.... Drifting off into dream land ....

      It's 11pm and someone turns on a gaming system, you know this individual has a test or maybe a soccer game tomorrow, all the sudden your firewall'a state established LED turn on and glows red.

      I sprang from my bed to see what was the matter. Away to the TV I flew like a flash, tore open the door, and went with dash. When, what to my wondering eyes should appear, the little one again with game controller in hand. Now little one you stand with a solemn face... go to bed ! Go to bed! Go back to bed now!"

      It would have one green and one red led holiday colors.

      Screenshot 2023-08-24 083855.jpg
      (link to xbox ip group rule...?)

      You could in theory add it to any rule you want by way of tracking id.

      Make sure to upvote

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        Anything can be coded given sufficient motivation. 😉

        M 1 Reply Last reply Reply Quote 1
        • M
          mer @stephenw10
          last edited by

          @stephenw10 "Show me the money!"

          1 Reply Last reply Reply Quote 1
          • JonathanLeeJ
            JonathanLee
            last edited by JonathanLee

            I am a computer science student right now, I have learned some Python, Assembly, and Java. I knew Basic as a kid for the Tandy 102. However, this programming language I have not learned yet, the constant $ is confusing. I think it is C. I really can not wait to take a class in this language. I even learned some bash scripting. It is C++ or C# right? We even did some PIC programming in mechatronics class but nothing looks like this language.

            The use of $ all the time makes me think of Microsofts Xenix operating system.

            Make sure to upvote

            J 1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              The script linked above? It's a shell script; so like a bash script except not bash, it uses the default bsd shell. https://man.freebsd.org/cgi/man.cgi?query=sh

              JonathanLeeJ 1 Reply Last reply Reply Quote 1
              • JonathanLeeJ
                JonathanLee @stephenw10
                last edited by

                @stephenw10 said in 2100 LED question:

                https://man.freebsd.org/cgi/man.cgi?query=sh

                Thanks $ "Expands to the positional parameters" There has got to be get this to work with a tracking id for an ACL

                IMG_20230824_104757565#1.jpg

                I did not know it could do solid red, pretty cool!!!

                Well changing the number in that script is easy but adding that script to the acl is going to be harder. I think I can just add in the command to change to red to the tracking id somehow, again within the open source code finding that section of code is harder.

                Make sure to upvote

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  You could run pfctl -vvss to check for open states using the ruleID and use that to trigger the LED via a script run on a cronjob.

                  JonathanLeeJ 1 Reply Last reply Reply Quote 1
                  • J
                    jrey @JonathanLee
                    last edited by

                    @JonathanLee said in 2100 LED question:

                    Microsofts Xenix

                    LOL - you said Microsoft Xenix,

                    Radio Shack back in the day ran this on the Model II (1979ish)
                    the computer is long gone, but I have a set of 8" install floppies and manuals around somewhere if you need them ;-)

                    Later iterations of the Radio Shack (Tandy) line after they changed from the Motorola processor and switched to Intel (IBM PC Clone), could ran SCO Unix - I pulled the manual from the shelf you want me to look something up for you

                    Screen Shot 2023-08-24 at 2.00.34 PM.png

                    Or if you want something more "original" we could go back to this
                    Screen Shot 2023-08-24 at 2.07.41 PM.png

                    From this core are also derived
                    Microsoft's OS/2 / Windows
                    and
                    Digital Equipment Corp (DEC) pdp and VAX based systems
                    the core systems in each remarkable close to the core unix
                    and
                    Apple's OS versions

                    what a blast - those day

                    	.TITLE	SHEP,’APPLE DOS’
                    *	6.3	10-6-78
                    *	8 BIT ASSEMBLER
                    	.M6502
                    *
                    **************************************************************************************
                    *	(C)  COPYRIGHT 1978  APPLE COMPUTER, INC
                    **************************************************************************************
                    ORG1	EQU	$1B00
                    ORG2	EQU	$3600
                    DISKIO	EQU	$3D00
                    ASC1	EQU	$3800
                    
                    JonathanLeeJ 1 Reply Last reply Reply Quote 1
                    • JonathanLeeJ
                      JonathanLee @jrey
                      last edited by JonathanLee

                      @jrey EPIC!!! I have a Xenix book too,

                      IMG_20230824_112849500.jpg

                      I have a VM that runs it so could play with it. I wanted it as a kid in the 1990s so bad. I had Dos 3.11 back in the day. I learned that the mail application is like Alpine

                      https://unix.stackexchange.com/questions/366048/xenix-sco-v-running-in-contemporary-machines-as-vms

                      Check out part one and two that is my addition to how to run it in virtual box step by step, no clue why someone marked it -1 for me :( I bet it is someone that hated that os or something.

                      Screenshot 2023-08-24 at 11.31.02 AM.png

                      Make sure to upvote

                      J 1 Reply Last reply Reply Quote 0
                      • JonathanLeeJ
                        JonathanLee @stephenw10
                        last edited by JonathanLee

                        @stephenw10

                        I got the output with the a rule using that command YEAH!!!

                        Screenshot 2023-08-24 at 11.23.44 AM.png

                        Make sure to upvote

                        1 Reply Last reply Reply Quote 0
                        • J
                          jrey @JonathanLee
                          last edited by

                          @JonathanLee said in 2100 LED question:

                          I have a VM that runs it so I could play with it

                          Cool I have and old DEC PDP emulator that I fire up from time to time just to perform a memory test (that is my memory - how much can I remember)

                          have fun with the lights. (like your "night before" re-wording) you could also just create some time based rules to block the late night gamer.. But then again the lights do sound like they are way more fun.

                          JonathanLeeJ 1 Reply Last reply Reply Quote 1
                          • JonathanLeeJ
                            JonathanLee @jrey
                            last edited by

                            @jrey I like the lights because even with the offline timers he turns it on to play what's already installed on it. Once at 3am till 5am on his last soccer game, he looked like a zombie the next day.

                            Make sure to upvote

                            1 Reply Last reply Reply Quote 0
                            • JonathanLeeJ
                              JonathanLee
                              last edited by JonathanLee

                              Screenshot 2023-08-24 at 11.51.41 AM.png

                              I got my rule id it is 43

                              However running

                              Screenshot 2023-08-24 at 11.52.32 AM.png

                              switch -R does not work for some reason

                              It would be these rules to show stats only

                              Screenshot 2023-08-24 at 12.10.29 PM.png

                              In linux you can just display specific information I wonder how to pluck that out in freebsd

                              pfctl -vvsr

                              I will figure it out I just need all the rules that are in use for GAME_IP_GROUP

                              YEAHHHH use them with pfctl -vvss | grep ', rule ... and we should be good to make a script use a if clause if !null it should work and make a cron for it

                              Make sure to upvote

                              1 Reply Last reply Reply Quote 0
                              • JonathanLeeJ
                                JonathanLee
                                last edited by JonathanLee

                                Screenshot 2023-08-24 at 12.19.07 PM.png

                                pfctl -vvss | grep ', rule 43'

                                Make sure to upvote

                                1 Reply Last reply Reply Quote 0
                                • JonathanLeeJ
                                  JonathanLee
                                  last edited by

                                  I am going to use this as a string entry and check to see if it is null if not turn the led on.

                                  Simple enough in theory.

                                  Screenshot 2023-08-24 at 1.02.54 PM.png

                                  Make sure to upvote

                                  1 Reply Last reply Reply Quote 0
                                  • JonathanLeeJ
                                    JonathanLee
                                    last edited by JonathanLee

                                    Something maybe like this

                                    #!/bin/sh
                                    pfctl -vvss | grep ', rule 79' >/dev/null
                                    res=$?
                                    
                                    if [ $res = 0 ]; then
                                      sysctl -q dev.gpio.2.led.2.pwm=1
                                      gpioctl -f /dev/gpioc2 6 duty 1 >/dev/null
                                    fi
                                    
                                    
                                    Or...
                                    
                                    #!/bin/sh
                                    
                                    str="$(pfctl -vvss | grep ', rule 79')"
                                    
                                    if [ -z "$str" ]; then
                                      sysctl -q dev.gpio.2.led.2.pwm=1
                                      gpioctl -f /dev/gpioc2 6 duty 1 >/dev/null
                                    fi
                                    

                                    Ref Researching:
                                    https://forums.freebsd.org/threads/bin-sh-how-to-save-a-shell-command-output-into-a-string-variable.90088/

                                    Make sure to upvote

                                    1 Reply Last reply Reply Quote 0
                                    • stephenw10S
                                      stephenw10 Netgate Administrator
                                      last edited by

                                      The problem there is that the rule number an change if you add or remove rules. I was hoping you might be able to see tags on rules in the states but I don't see a way to do that. Yet...

                                      JonathanLeeJ 2 Replies Last reply Reply Quote 1
                                      • JonathanLeeJ
                                        JonathanLee @stephenw10
                                        last edited by

                                        @stephenw10 It works if you don't adjust the rules I have it going now.

                                        Make sure to upvote

                                        1 Reply Last reply Reply Quote 0
                                        • JonathanLeeJ
                                          JonathanLee
                                          last edited by JonathanLee

                                          /root/deviceonlinenight

                                          #!/bin/sh
                                          pfctl -vvss | grep ', rule 79' >/dev/null
                                          res=$?
                                          if [ $res = 0 ]; 
                                          then
                                            sysctl -q dev.gpio.2.led.0.pwm=1
                                            gpioctl -f /dev/gpioc2 0 duty 200 >/dev/null
                                            sysctl -q dev.gpio.2.led.1.pwm=1
                                            gpioctl -f /dev/gpioc2 3 duty 200 >/dev/null
                                            sysctl -q dev.gpio.2.led.2.pwm=1
                                            gpioctl -f /dev/gpioc2 6 duty 200 >/dev/null
                                          else
                                            sysctl -q dev.gpio.2.led.0.pwm=1
                                            gpioctl -f /dev/gpioc2 0 duty 0 >/dev/null
                                            gpioctl -f /dev/gpioc2 1 duty 0 >/dev/null
                                            gpioctl -f /dev/gpioc2 2 duty 0 >/dev/null
                                            sysctl -q dev.gpio.2.led.1.pwm=1
                                            gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                                            gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null
                                            gpioctl -f /dev/gpioc2 5 duty 0 >/dev/null
                                            sysctl -q dev.gpio.2.led.2.pwm=1
                                            gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null
                                            gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                            gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null
                                          fi
                                          
                                          

                                          /root/deviceonlineday

                                          #!/bin/sh
                                          pfctl -vvss | grep ', rule 79' >/dev/null
                                          res=$?
                                          if [ $res = 0 ]; 
                                          then
                                            sysctl -q dev.gpio.2.led.1.pwm=1
                                            gpioctl -f /dev/gpioc2 3 duty 100 >/dev/null
                                            sysctl -q dev.gpio.2.led.2.pwm=1
                                            gpioctl -f /dev/gpioc2 6 duty 100 >/dev/null
                                          else
                                            sysctl -q dev.gpio.2.led.1.pwm=1
                                            gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                                            sysctl -q dev.gpio.2.led.2.pwm=1
                                            gpioctl -f /dev/gpioc2 7 duty 100 >/dev/null
                                          fi
                                          
                                          

                                          Make sure to upvote

                                          1 Reply Last reply Reply Quote 1
                                          • JonathanLeeJ
                                            JonathanLee @stephenw10
                                            last edited by JonathanLee

                                            @stephenw10

                                            pfctl -vvss| grep '192.168.1.11' would work great too as it would be IP address based not rule based
                                            also
                                            pfctl -vvss| grep -e 192.168.1.18 -e 192.168.1.11

                                            Make sure to upvote

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