Skip to content

Instantly share code, notes, and snippets.

@zlinuxboy
Forked from PiBa-NL/CUSTOM_rules.inc-pfSense
Created March 1, 2017 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zlinuxboy/b8d460c5f93e5236ef4ec3903ec8aeb8 to your computer and use it in GitHub Desktop.
Save zlinuxboy/b8d460c5f93e5236ef4ec3903ec8aeb8 to your computer and use it in GitHub Desktop.
adding custom rules on pfSense not supported by webgui
<?php
// Add this file as: /usr/local/pkg/CUSTOM_rules.inc
// pfSense will automatically add the rules defined here into the rules it loads in pf
require_once("util.inc");
function CUSTOM_rules_generate_rules($type) {
// called by filter.inc when pfSense rules generation happens
$rules = "";
switch($type) {
case 'nat':
$rules .= "# CUSTOM NAT RULES \n";
$rules .= "nat on em0 inet6 proto tcp from ! (em0) to any -> 123::456\n";
$rules .= "# END CUSTOM NAT RULES \n";
break;
case 'filter':
$rules .= "# CUSTOM RULES \n";
$rules .= "# END CUSTOM RULES \n";
break;
}
return $rules;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment