Package Development Overview?

  • I have for a long time now really wanted the ability to restrict youtube videos from playing on my network per device based on what channel they belong to. That way my kids can come to me and say, there's this really great youtube channel, can you review it for me and whitelist it so I can watch the videos on the channel? Youtube is just far too big to address it with a blacklist.

    The pseudo code would look like this:

    1. Check each request against a list of host aliases that are allowed to watch videos from any channel
    2. If the request is from an allowed host, then return
    3. If the request is from a restricted host, do steps 4-6
    4. Regex the URL and determine if it's a youtube URL
    5. Grab the video ID and make a HTTP hit to the Google API to retreive the Channel Name
    6. If the Channel Name is on the whitelist, allow the request through, otherwise block it

    I'm interested in this functionality enough to take the time to write some custom code to make PFSense able to do this sort of thing but I have a few questions.

    1. I've already read the documentation on package creation from this page: and I've installed a package and looked at the artifact files in the file system, but I still don't feel like I know what's involved in creating a package. Is there a tutorial or a basic starting point or overview I can read that will clue me in on how this works? I'm looking for a two or three paragraph description that says something like. There are x components to package creation: the config file, the info file and any PHP code you write for your package. I'm also looking for something that tells me how package code is written and how it interacts with the request pipeline because I haven't found anything that talks about actually scripting the package.

    2. Do I really need a package for this if I'm not interested in making this pretty and available to everyone? If, for instance, I just want to inject a custom script into the pipeline and I'm fine with hard coding the whitelist and allowed hosts aliases so I don't need a GUI for the script is there an easier alternative to packages? It would be awesome if I could just write a script with a single function. That function receives input from pfsense when it is called that passes it the request information. I look at the request information and return a value based on some logic I write. If this is possible it would seem like it would greatly simplify what I'm trying to do right now.

    Thanks for the help guys

Log in to reply