1
15.7 Legacy Series / Re: Transparent Proxy and Captive Portal Authentication
« on: February 12, 2016, 06:04:05 am »
Does anyone have a knowledge of it?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
# Ports IP Ports Description
80 (HTTP) 127.0.0.1 3128 redirect traffic to proxy
/usr/local/bin/cpdup -vvv -I -o /usr/local /mnt/usr/local
F1 OPNsense
F6 PXE
Boot: F1
# gpart show ada0
=> 63 31277169 ada0 MBR (15G)
63 31277169 1 freebsd [active] (15G)
| Folders | Commit | Tags / Branches |
|---------|------------|---------------------------------|
| src/ | 3b29c333de | tag: 15.7.25 origin/stable/15.7 |
| ports/ | c4125f1109 | origin/master |
| tools/ | de44675921 | origin/master |
So far I've seen a few users attempt to build OPNsense using vagrant with poor results. Usually spending too much time setting up a build environment. Seems to me that it would be much easier to just install FreeBSD 10.2 into a virtual machine.
===> usr.bin/tftp (depend)
===> usr.bin/time (depend)
===> usr.bin/tip (depend)
===> usr.bin/tip/tip (depend)
===> usr.bin/top (depend)
Making top.local.h from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.H
rm -f .depend
CC='cc ' mkdep -f .depend -a -DHAVE_GETOPT -DHAVE_STRERROR -DORDER -I/vagrant/opnsense/src/usr.bin/top -I/vagrant/opnsense/src/usr.bin/top/../../contrib/top -I. -DNDEBUG -std=gnu99 /vagrant/opnsense/src/usr.bin/top/../../contrib/top/commands.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/display.c /vagrant/opnsense/src/usr.bin/top/machine.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/screen.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/username.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/utils.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/version.c
In file included from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/display.c:40:
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:66:5: error: invalid token at start of a preprocessor expression
#if RANDOM_PW == 0
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:65:19: note: expanded from macro 'RANDOM_PW'
#define RANDOM_PW %random%
^
1 error generated.
In file included from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:49:
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:66:5: error: invalid token at start of a preprocessor expression
#if RANDOM_PW == 0
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:65:19: note: expanded from macro 'RANDOM_PW'
#define RANDOM_PW %random%
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:183:5: error: invalid token at start of a preprocessor expression
#if Default_TOPN == Infinity
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:46:22: note: expanded from macro 'Default_TOPN'
#define Default_TOPN %topn%
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:457:5: error: invalid token at start of a preprocessor expression
#if Default_TOPN == Infinity
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:46:22: note: expanded from macro 'Default_TOPN'
#define Default_TOPN %topn%
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:550:5: error: invalid token at start of a preprocessor expression
#if Default_TOPN == Infinity
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:46:22: note: expanded from macro 'Default_TOPN'
#define Default_TOPN %topn%
^
4 errors generated.
In file included from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/username.c:38:
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:66:5: error: invalid token at start of a preprocessor expression
#if RANDOM_PW == 0
^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:65:19: note: expanded from macro 'RANDOM_PW'
#define RANDOM_PW %random%
^
1 error generated.
mkdep: compile failed
*** [.depend] Error code 1
make[4]: stopped in /vagrant/opnsense/src/usr.bin/top
1 error
make[4]: stopped in /vagrant/opnsense/src/usr.bin/top
*** [depend_subdir_top] Error code 2
make[3]: stopped in /vagrant/opnsense/src/usr.bin
1 error
make[3]: stopped in /vagrant/opnsense/src/usr.bin
*** [usr.bin.depend__D] Error code 2
make[2]: stopped in /vagrant/opnsense/src
1 error
make[2]: stopped in /vagrant/opnsense/src
*** [_depend] Error code 2
make[1]: stopped in /vagrant/opnsense/src
1 error
make[1]: stopped in /vagrant/opnsense/src
*** [buildworld] Error code 2
make: stopped in /vagrant/opnsense/src
1 error
make: stopped in /vagrant/opnsense/src
*** Error code 2
Stop.
make: stopped in /vagrant/opnsense/tools
Firewall: NAT: Port Forward rules
If Proto Address Ports Address Ports IP Ports Description
LAN TCP LAN net * * 80 (HTTP) 127.0.0.1 3128 redirect traffic to proxy
/**
* Class Cron
* @package OPNsense\Cron
*/
class Cron extends BaseModel
{
/**
* create a new daily job
* @param string $origin
* @param string $command
* @param string $description
* @param string $weekdays day(s) of the week to run
* @param string $enabled default add disabled cron jobs, if triggered enabled be sure to call regenerate on cron.
* @return string
*/
public function newDailyJob($origin, $command, $description, $weekdays = "*", $enabled = "0")
{
$cron = $this->jobs->job->Add();
$uuid = $cron->getAttributes()['uuid'];
$cron->origin = $origin;
$cron->command = $command;
$cron->description = $description;
$cron->weekdays = $weekdays ;
$cron->enabled = $enabled;
return $uuid;
}
}
if ((string)$mdlMymodule->general->UpdateCron == "") {
$mdlCron = new Cron();
$mdlMymodule->general->UpdateCron = $mdlCron->newDailyJob("Mymodule", "mymodule test", "Mymodule Test cron", "1");
if ($mdlCron->performValidation()->count() == 0) {
$mdlCron->serializeToConfig();
$mdlMymodule->serializeToConfig($validateFullModel = false, $disable_validation = true);
Config::getInstance()->save();
}
}
# configctl mymodule test command works successfully on the command line.
Phalcon\Validation\Message\Group Object
(
[_position:protected] =>
[_messages:protected] => Array
(
[0] => Phalcon\Validation\Message Object
(
[_type:protected] => InclusionIn
[_message:protected] => Select a command from the list.
[_field:protected] => jobs.job.c98659f2-3555-471e-9e0c-e1acf26e791a.command
[_code:protected] => 0
)
)
)
<OPNsense>
<cron>
<jobs>
<job uuid="ae473210-e201-4c51-8eb5-0cb70f211101">
<origin>IDS</origin>
<enabled>0</enabled>
<minutes>0</minutes>
<hours>0</hours>
<days>*</days>
<months>*</months>
<weekdays>0</weekdays>
<who>root</who>
<command>ids update</command>
<parameters/>
<description>ids rule updates</description>
</job>
<job uuid="c98659f2-3555-471e-9e0c-e1acf26e791a">
<origin>MyModule</origin>
<enabled>0</enabled>
<minutes>0</minutes>
<hours>0</hours>
<days>*</days>
<months>*</months>
<weekdays>0</weekdays>
<who>root</who>
<command>mymodule test</command>
<parameters/>
<description>MyModule test job</description>
</job>
</jobs>
</cron>
</OPNsense>
# MyModule.xml
<model>
<mount>//OPNsense/MyModule</mount>
<description>
MyModule application
</description>
<items>
<general>
<UpdateCron type="ModelRelationField">
<Model>
<queues>
<source>OPNsense.Cron.Cron</source>
<items>jobs.job</items>
<display>description</display>
<filters>
<origin>/MyModule/</origin>
</filters>
</queues>
</Model>
<ValidationMessage>Related cron not found</ValidationMessage>
<Required>N</Required>
</UpdateCron>
</general>
</items>
</model>
# ServiceController.php
/**
* reconfigure MyModule
*/
public function reloadAction()
{
$status = "failed";
if ($this->request->isPost()) {
$mdlMyModule = new MyModule();
if ((string)$mdlMyModule->general->UpdateCron == "") {
$mdlCron = new Cron();
// update cron relation (if this doesn't break consistency)
$mdlMyModule->general->UpdateCron = $mdlCron->newDailyJob("MyModule", "mymodule test", "MyModule test job", "0");
if ($mdlCron->performValidation()->count() == 0) {
$mdlCron->serializeToConfig();
// save data to config, do not validate because the current in memory model doesn't know about the
// cron item just created.
$mdlMyModule->serializeToConfig($validateFullModel = false, $disable_validation = true);
Config::getInstance()->save();
}
}
$backend = new Backend();
$bckresult = trim($backend->configdRun("template reload OPNsense.MyModule"));
if ($bckresult == "OK") {
$status = "ok";
}
}
return array("status" => $status);
}
$mdlCron->performValidation()->count() return 1
$mdlCron->performValidation() return empty