diff options
Diffstat (limited to 'packages/frickin')
-rw-r--r-- | packages/frickin/frickin.inc | 51 | ||||
-rw-r--r-- | packages/frickin/frickin.xml | 28 |
2 files changed, 62 insertions, 17 deletions
diff --git a/packages/frickin/frickin.inc b/packages/frickin/frickin.inc new file mode 100644 index 00000000..9a5d9f05 --- /dev/null +++ b/packages/frickin/frickin.inc @@ -0,0 +1,51 @@ +<?php + +function frickin_custom_php_install_command() { + $fout = fopen("/usr/local/etc/rc.d/frickin.sh", "w"); + fwrite($fout, "#!/bin/sh\n# This package was automatically generated\n# by the pfSense package system.\n\n"); + fwrite($fout, "# PACKAGE: Frickin Proxy\n"); + fwrite($fout, "# EXECUTABLE: frickin\n"); + fwrite($fout, "/usr/local/bin/frickin"); + fwrite($fout, " -s 127.0.0.1"); + fwrite($fout, " -c 20"); + fwrite($fout, " &\n"); + fclose($fout); + mwexec("/usr/bin/killall frickin"); + mwexec("chmod a+rx /usr/local/etc/rc.d/frickin.sh"); + mwexec("/usr/local/etc/rc.d/frickin.sh"); +} + +function custom_php_deinstall_command() { + unlink_if_exists("/usr/local/etc/rc.d/frickin.sh"); + unlink_if_exists("/usr/local/bin/frickin"); +} + +function frickin_generate_rules($type) { + global $config; + + $frickin_conf = $config['installedpackages']['frickin']['config'][0]; + if (!is_service_running('frickin')) { + log_error("Frickin is installed but not started. Not installing redirect rules."); + return; + } + + $ifaces = explode(',', $frickin_conf['active_interface']); + $ifaces = array_map('convert_friendly_interface_to_real_interface_name', $ifaces); + + switch($type) { + case 'nat': + foreach ($ifaces as $iface) { + $rules .= "rdr on $iface proto tcp from any to !($iface) port 1723 -> 127.0.0.1\n"; + $rules .= "rdr on $iface proto gre from any to !($iface) -> 127.0.0.1\n"; + } + break; + case 'filter': + break; + default: + break; + } + + return $rules; +} + +?>
\ No newline at end of file diff --git a/packages/frickin/frickin.xml b/packages/frickin/frickin.xml index f3974a55..b507649e 100644 --- a/packages/frickin/frickin.xml +++ b/packages/frickin/frickin.xml @@ -4,26 +4,20 @@ <version>1.2</version> <configpath>installedpackages->package->$packagename->configuration->settings</configpath> <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/frickin/frickin.inc</item> + </additional_files_needed> + <additional_files_needed> <prefix>/usr/local/bin/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/All/frickin</item> - </additional_files_needed> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/frickin/bin/frickin</item> + </additional_files_needed> <custom_php_install_command> - $fout = fopen("/usr/local/etc/rc.d/frickin.sh", "w"); - fwrite($fout, "#!/bin/sh\n# This package was automatically generated\n# by the pfSense package system.\n\n"); - fwrite($fout, "# PACKAGE: Frickin Proxy\n"); - fwrite($fout, "# EXECUTABLE: frickin\n"); - fwrite($fout, "/usr/local/bin/frickin"); - fwrite($fout, " -s 127.0.0.1"); - fwrite($fout, " -c 20"); - fwrite($fout, " &\n"); - fclose($fout); - mwexec("/usr/bin/killall frickin"); - mwexec("chmod a+rx /usr/local/etc/rc.d/frickin.sh"); - mwexec("/usr/local/etc/rc.d/frickin.sh"); + frickin_custom_php_install_command(); </custom_php_install_command> <custom_php_deinstall_command> - unlink_if_exists("/usr/local/etc/rc.d/frickin.sh"); - unlink_if_exists("/usr/local/bin/frickin"); + frickin_custom_php_deinstall_command(); </custom_php_deinstall_command> + <include_file>/usr/local/pkg/frickin.inc</include_file> </packagegui> |